mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-12 21:30:30 +05:30
refactor: directly add loaded videos to playlist to improve UX
This commit is contained in:
parent
b96d2aafc0
commit
ade0732ee6
@ -184,16 +184,15 @@ object PlaylistsHelper {
|
|||||||
} else {
|
} else {
|
||||||
// if not logged in, all video information needs to become fetched manually
|
// if not logged in, all video information needs to become fetched manually
|
||||||
// Only do so with `MAX_CONCURRENT_IMPORT_CALLS` videos at once to prevent performance issues
|
// Only do so with `MAX_CONCURRENT_IMPORT_CALLS` videos at once to prevent performance issues
|
||||||
val streams = playlist.videos.chunked(
|
for (videoIdList in playlist.videos.chunked(MAX_CONCURRENT_IMPORT_CALLS)) {
|
||||||
MAX_CONCURRENT_IMPORT_CALLS
|
val streams = videoIdList.parallelMap {
|
||||||
).map { videos ->
|
|
||||||
videos.parallelMap {
|
|
||||||
runCatching { StreamsExtractor.extractStreams(it) }
|
runCatching { StreamsExtractor.extractStreams(it) }
|
||||||
.getOrNull()
|
.getOrNull()
|
||||||
?.toStreamItem(it)
|
?.toStreamItem(it)
|
||||||
}.filterNotNull()
|
}.filterNotNull()
|
||||||
}.flatten()
|
|
||||||
addToPlaylist(playlistId, *streams.toTypedArray())
|
addToPlaylist(playlistId, *streams.toTypedArray())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user