LibreTube/app/src/main/java/com/github/libretube/extensions/ToStreamItem.kt

38 lines
1.1 KiB
Kotlin
Raw Normal View History

2022-10-23 17:09:15 +05:30
package com.github.libretube.extensions
import com.github.libretube.api.obj.StreamItem
import com.github.libretube.api.obj.Streams
2022-11-20 20:24:55 +05:30
import com.github.libretube.db.obj.LocalPlaylistItem
2022-11-21 18:42:46 +05:30
import com.github.libretube.util.ProxyHelper
2022-10-23 17:09:15 +05:30
2022-10-23 19:34:15 +05:30
fun Streams.toStreamItem(videoId: String): StreamItem {
2022-10-23 17:09:15 +05:30
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
)
}
2022-11-20 20:24:55 +05:30
fun LocalPlaylistItem.toStreamItem(): StreamItem {
return StreamItem(
url = videoId,
title = title,
2022-11-21 18:42:46 +05:30
thumbnail = ProxyHelper.rewriteUrl(thumbnailUrl),
2022-11-20 20:24:55 +05:30
uploaderName = uploader,
uploaderUrl = uploaderUrl,
2022-11-21 18:42:46 +05:30
uploaderAvatar = ProxyHelper.rewriteUrl(uploaderAvatar),
2022-11-20 20:24:55 +05:30
uploadedDate = uploadDate,
uploaded = null,
duration = duration
)
}