mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-15 23:00:31 +05:30
38 lines
1.1 KiB
Kotlin
38 lines
1.1 KiB
Kotlin
package com.github.libretube.extensions
|
|
|
|
import com.github.libretube.api.obj.StreamItem
|
|
import com.github.libretube.api.obj.Streams
|
|
import com.github.libretube.db.obj.LocalPlaylistItem
|
|
import com.github.libretube.util.ProxyHelper
|
|
|
|
fun Streams.toStreamItem(videoId: String): StreamItem {
|
|
return StreamItem(
|
|
url = videoId,
|
|
title = title,
|
|
thumbnail = thumbnailUrl,
|
|
uploaderName = uploader,
|
|
uploaderUrl = uploaderUrl,
|
|
uploaderAvatar = uploaderAvatar,
|
|
uploadedDate = uploadDate,
|
|
uploaded = null,
|
|
duration = duration,
|
|
views = views,
|
|
uploaderVerified = uploaderVerified,
|
|
shortDescription = description
|
|
)
|
|
}
|
|
|
|
fun LocalPlaylistItem.toStreamItem(): StreamItem {
|
|
return StreamItem(
|
|
url = videoId,
|
|
title = title,
|
|
thumbnail = ProxyHelper.rewriteUrl(thumbnailUrl),
|
|
uploaderName = uploader,
|
|
uploaderUrl = uploaderUrl,
|
|
uploaderAvatar = ProxyHelper.rewriteUrl(uploaderAvatar),
|
|
uploadedDate = uploadDate,
|
|
uploaded = null,
|
|
duration = duration
|
|
)
|
|
}
|