Skip to content

Commit

Permalink
Merge pull request #6865 from Bnyro/master
Browse files Browse the repository at this point in the history
refactor: directly add loaded videos to playlist to improve UX
  • Loading branch information
Bnyro authored Dec 7, 2024
2 parents 84a79a1 + ade0732 commit 589bd45
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions app/src/main/java/com/github/libretube/api/PlaylistsHelper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -184,16 +184,15 @@ object PlaylistsHelper {
} else {
// 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
val streams = playlist.videos.chunked(
MAX_CONCURRENT_IMPORT_CALLS
).map { videos ->
videos.parallelMap {
for (videoIdList in playlist.videos.chunked(MAX_CONCURRENT_IMPORT_CALLS)) {
val streams = videoIdList.parallelMap {
runCatching { StreamsExtractor.extractStreams(it) }
.getOrNull()
?.toStreamItem(it)
}.filterNotNull()
}.flatten()
addToPlaylist(playlistId, *streams.toTypedArray())

addToPlaylist(playlistId, *streams.toTypedArray())
}
}
}
}
Expand Down

0 comments on commit 589bd45

Please sign in to comment.