From a334c7aba2c1f4ea5e0cb3399b467decdc026e9d Mon Sep 17 00:00:00 2001 From: Bnyro Date: Fri, 16 Dec 2022 16:28:39 +0100 Subject: [PATCH] Make YT playlist import language independent --- app/src/main/java/com/github/libretube/util/ImportHelper.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/github/libretube/util/ImportHelper.kt b/app/src/main/java/com/github/libretube/util/ImportHelper.kt index e879907a4..1a53dfc74 100644 --- a/app/src/main/java/com/github/libretube/util/ImportHelper.kt +++ b/app/src/main/java/com/github/libretube/util/ImportHelper.kt @@ -121,8 +121,8 @@ class ImportHelper( activity.contentResolver.openInputStream(uri)?.use { val lines = it.bufferedReader().readLines() playlist.name = lines[1].split(",").reversed()[2] - val splitIndex = lines.indexOfFirst { line -> line.startsWith("Video ID") } - lines.subList(splitIndex + 1, lines.size).forEach { line -> + val splitIndex = lines.indexOfFirst { line -> line.isBlank() } + lines.subList(splitIndex + 2, lines.size).forEach { line -> line.split(",").firstOrNull()?.let { videoId -> if (videoId.isNotBlank()) playlist.videos = playlist.videos + videoId }