Comick.fun: Allow optional description, chapter name (#12518)
This commit is contained in:
parent
6683290bdd
commit
4d910c38e6
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user