SpyFakku: Fix Thumbnail (#4054)

* Fix Thumbnail

* Apply suggestion
This commit is contained in:
KenjieDec 2024-07-17 17:05:14 +07:00 committed by Draff
parent 02ebd645ad
commit 4754f27a16
No known key found for this signature in database
GPG Key ID: E8A89F3211677653
3 changed files with 22 additions and 13 deletions

View File

@ -1,7 +1,7 @@
ext {
extName = 'SpyFakku'
extClass = '.SpyFakku'
extVersionCode = 2
extVersionCode = 3
isNsfw = true
}

View File

@ -61,7 +61,7 @@ class SpyFakku : HttpSource() {
private fun popularManga(hentai: ShortHentai) = SManga.create().apply {
setUrlWithoutDomain("$baseUrl/g/${hentai.id}")
title = hentai.title
thumbnail_url = "$baseImageUrl/${hentai.hash}/cover"
thumbnail_url = "$baseImageUrl/${hentai.hash}/1/c"
}
override fun searchMangaParse(response: Response) = popularMangaParse(response)
@ -117,27 +117,27 @@ class SpyFakku : HttpSource() {
private fun Hentai.toSManga() = SManga.create().apply {
title = this@toSManga.title
url = "/g/$id"
author = (circles?.emptyToNull() ?: artists)?.joinToString { it.value }
artist = artists?.joinToString { it.value }
genre = tags?.joinToString { it.value }
thumbnail_url = "$baseImageUrl/$hash/cover"
author = (circles?.emptyToNull() ?: artists)?.joinToString { it.name }
artist = artists?.joinToString { it.name }
genre = tags?.joinToString { it.name }
thumbnail_url = "$baseImageUrl/$hash/1/c"
description = buildString {
this@toSManga.description?.let {
append(this@toSManga.description, "\n\n")
}
circles?.emptyToNull()?.joinToString { it.value }?.let {
circles?.emptyToNull()?.joinToString { it.name }?.let {
append("Circles: ", it, "\n")
}
publishers?.emptyToNull()?.joinToString { it.value }?.let {
publishers?.emptyToNull()?.joinToString { it.name }?.let {
append("Publishers: ", it, "\n")
}
magazines?.emptyToNull()?.joinToString { it.value }?.let {
magazines?.emptyToNull()?.joinToString { it.name }?.let {
append("Magazines: ", it, "\n")
}
events?.emptyToNull()?.joinToString { it.value }?.let {
events?.emptyToNull()?.joinToString { it.name }?.let {
append("Events: ", it, "\n\n")
}
parodies?.emptyToNull()?.joinToString { it.value }?.let {
parodies?.emptyToNull()?.joinToString { it.name }?.let {
append("Parodies: ", it, "\n")
}
append("Pages: ", pages, "\n\n")
@ -153,6 +153,15 @@ class SpyFakku : HttpSource() {
append("Added: ", dateReformat.format(it.time), "\n")
}
} catch (_: Exception) {}
append(
"Size: ",
when {
size >= 300 * 1000 * 1000 -> "${"%.2f".format(size / (1000.0 * 1000.0 * 1000.0))} GB"
size >= 100 * 1000 -> "${"%.2f".format(size / (1000.0 * 1000.0))} MB"
size >= 1000 -> "${"%.2f".format(size / (1000.0))} kB"
else -> "$size B"
},
)
}
status = SManga.COMPLETED
update_strategy = UpdateStrategy.ONLY_FETCH_ONCE

View File

@ -1,6 +1,5 @@
package eu.kanade.tachiyomi.extension.en.spyfakku
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
@ -17,6 +16,7 @@ class Hentai(
val released_at: String,
val created_at: String,
val pages: Int,
val size: Int = 0,
val publishers: List<Name>?,
val artists: List<Name>?,
val circles: List<Name>?,
@ -41,5 +41,5 @@ class Image(
@Serializable
class Name(
@SerialName("name") val value: String,
val name: String,
)