mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-29 08:20:32 +05:30
Merge pull request #6664 from Bnyro/master
fix: incorrect FreeTube playlist export
This commit is contained in:
commit
85d345a49b
@ -218,13 +218,17 @@ object PlaylistsHelper {
|
||||
getPlaylists()
|
||||
.map { async { getPlaylist(it.id!!) } }
|
||||
.awaitAll()
|
||||
.map {
|
||||
val videos = it.relatedStreams.map { item ->
|
||||
item.url.orEmpty().replace("$YOUTUBE_FRONTEND_URL/watch?v=${item.url}", "")
|
||||
}.map { id ->
|
||||
FreeTubeVideo(id, it.name.orEmpty(), "", "")
|
||||
.map { playlist ->
|
||||
val videos = playlist.relatedStreams.map { videoInfo ->
|
||||
FreeTubeVideo(
|
||||
videoId = videoInfo.url.orEmpty().toID(),
|
||||
title = videoInfo.title.orEmpty(),
|
||||
author = videoInfo.uploaderName.orEmpty(),
|
||||
authorId = videoInfo.uploaderUrl.orEmpty().toID(),
|
||||
lengthSeconds = videoInfo.duration ?: 0L
|
||||
)
|
||||
}
|
||||
FreeTubeImportPlaylist(it.name.orEmpty(), videos)
|
||||
FreeTubeImportPlaylist(playlist.name.orEmpty(), videos)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,6 @@ import kotlinx.serialization.Serializable
|
||||
@Serializable
|
||||
data class FreeTubeImportPlaylist(
|
||||
@SerialName("playlistName") val name: String = "",
|
||||
// if type is `video` -> https://www.youtube.com/watch?v=IT734HriiHQ, works with shorts too
|
||||
var videos: List<FreeTubeVideo> = listOf()
|
||||
var videos: List<FreeTubeVideo> = listOf(),
|
||||
var protected: Boolean = true
|
||||
)
|
||||
|
@ -7,5 +7,7 @@ data class FreeTubeVideo(
|
||||
val videoId: String,
|
||||
val title: String,
|
||||
val author: String,
|
||||
val authorId: String
|
||||
val authorId: String,
|
||||
val lengthSeconds: Long,
|
||||
val type: String = "video"
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user