mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 22:30:30 +05:30
fix duplicated importing
This commit is contained in:
parent
b4100bd27c
commit
7c775f4937
@ -185,6 +185,7 @@ object PlaylistsHelper {
|
||||
|
||||
suspend fun importPlaylists(appContext: Context, playlists: List<ImportPlaylist>) {
|
||||
for (playlist in playlists) {
|
||||
Log.e("playlist", playlist.toString())
|
||||
val playlistId = createPlaylist(playlist.name!!, appContext) ?: continue
|
||||
runBlocking {
|
||||
val tasks = playlist.videos.map { videoId ->
|
||||
@ -210,7 +211,7 @@ object PlaylistsHelper {
|
||||
type = "playlist",
|
||||
visibility = "private",
|
||||
videos = list.relatedStreams.orEmpty().map {
|
||||
YOUTUBE_FRONTEND_URL + it.url!!.toID()
|
||||
YOUTUBE_FRONTEND_URL + "/watch?v=" + it.url!!.toID()
|
||||
}
|
||||
)
|
||||
)
|
||||
|
@ -114,15 +114,13 @@ class ImportHelper(
|
||||
|
||||
val playlistFile = ObjectMapper().readValue(uri.readText(), ImportPlaylistFile::class.java)
|
||||
|
||||
playlistFile.playlists.orEmpty().forEach {
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
playlistFile.playlists?.let {
|
||||
PlaylistsHelper.importPlaylists(activity, it)
|
||||
}
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
playlistFile.playlists?.let {
|
||||
PlaylistsHelper.importPlaylists(activity, it)
|
||||
}
|
||||
}
|
||||
|
||||
activity.toastFromMainThread(R.string.importsuccess)
|
||||
activity.toastFromMainThread(R.string.success)
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user