This commit is contained in:
vfsfitvnm
2022-06-19 11:24:11 +02:00
parent f7a6481323
commit 6c15889360
4 changed files with 11 additions and 19 deletions

View File

@@ -20,20 +20,12 @@ data class ThumbnailRenderer(
@Serializable
data class Thumbnail(
val url: String,
val height: Int,
val width: Int
val height: Int?,
val width: Int?
) {
val isResizable: Boolean
get() = !url.startsWith("https://i.ytimg.com")
fun width(width: Int): String {
return when {
url.startsWith("https://lh3.googleusercontent.com") -> "$url-w$width-h${width * height / this.width}"
url.startsWith("https://yt3.ggpht.com") -> "$url-s$width"
else -> url
}
}
fun size(size: Int): String {
return when {
url.startsWith("https://lh3.googleusercontent.com") -> "$url-w$size-h$size"