Comick.fun: Allow optional description, chapter name (#12518)

This commit is contained in:
Vetle Ledaal 2022-07-11 22:42:02 +00:00 committed by GitHub
parent 6683290bdd
commit 4d910c38e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -6,7 +6,7 @@ ext {
extName = 'Comick.fun' extName = 'Comick.fun'
pkgNameSuffix = 'all.comickfun' pkgNameSuffix = 'all.comickfun'
extClass = '.ComickFunFactory' extClass = '.ComickFunFactory'
extVersionCode = 11 extVersionCode = 12
isNsfw = true isNsfw = true
} }

View File

@ -129,7 +129,7 @@ class SChapterDeserializer : KSerializer<SChapter> {
private fun formatChapterTitle(title: String?, chap: String?, vol: String?): String { private fun formatChapterTitle(title: String?, chap: String?, vol: String?): String {
val numNonNull = listOfNotNull(title.takeIf { !it.isNullOrBlank() }, chap, vol).size val numNonNull = listOfNotNull(title.takeIf { !it.isNullOrBlank() }, chap, vol).size
if (numNonNull == 0) throw RuntimeException("formatChapterTitle requires at least one non-null argument") if (numNonNull == 0) return "unknown"
val formattedTitle = StringBuilder() val formattedTitle = StringBuilder()
if (vol != null) formattedTitle.append("${numNonNull.takeIf { it > 1 }?.let { "Vol." } ?: "Volume"} $vol") if (vol != null) formattedTitle.append("${numNonNull.takeIf { it > 1 }?.let { "Vol." } ?: "Volume"} $vol")
@ -229,7 +229,7 @@ class SMangaDeserializer : KSerializer<SManga> {
"id" -> id = decodeIntElement(descriptor, index) "id" -> id = decodeIntElement(descriptor, index)
"artists" -> artist = nameList() "artists" -> artist = nameList()
"authors" -> author = nameList() "authors" -> author = nameList()
"desc" -> description = cleanDesc(decodeStringElement(descriptor, index)) "desc" -> tryTo { description = cleanDesc(decodeStringElement(descriptor, index)) }
// Isn't always a string in every api call // Isn't always a string in every api call
"demographic" -> tryTo { genre = listOfNotNull(genre, decodeStringElement(descriptor, index)).joinToString(", ") } "demographic" -> tryTo { genre = listOfNotNull(genre, decodeStringElement(descriptor, index)).joinToString(", ") }
// Isn't always a list of objects in every api call // Isn't always a list of objects in every api call