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 { ext {
extName = 'SpyFakku' extName = 'SpyFakku'
extClass = '.SpyFakku' extClass = '.SpyFakku'
extVersionCode = 2 extVersionCode = 3
isNsfw = true isNsfw = true
} }

View File

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

View File

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