[RU]ComX title_en not anymore fix null (#953)

This commit is contained in:
Eshlender 2024-02-03 10:39:47 +05:00 committed by Draff
parent 3ce0383555
commit 90f361e243
2 changed files with 3 additions and 9 deletions

View File

@ -1,7 +1,7 @@
ext {
extName = 'Com-X'
extClass = '.ComX'
extVersionCode = 27
extVersionCode = 28
}
apply from: "$rootDir/common.gradle"

View File

@ -16,6 +16,7 @@ import eu.kanade.tachiyomi.util.asJsoup
import kotlinx.serialization.decodeFromString
import kotlinx.serialization.json.Json
import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.contentOrNull
import kotlinx.serialization.json.float
import kotlinx.serialization.json.jsonArray
import kotlinx.serialization.json.jsonObject
@ -315,14 +316,7 @@ class ComX : ParsedHttpSource() {
val chapters: List<SChapter>? = chaptersList?.map {
val chapter = SChapter.create()
// Usually "title" is main chapter name info, "title_en" is additional chapter name info.
// I decided to keep them both because who knows where they decided to put useful info today.
// Except when they are the same.
chapter.name = if (it.jsonObject["title"]!!.jsonPrimitive.content == it.jsonObject["title_en"]!!.jsonPrimitive.content) {
it.jsonObject["title"]!!.jsonPrimitive.content
} else {
(it.jsonObject["title"]!!.jsonPrimitive.content + " " + it.jsonObject["title_en"]!!.jsonPrimitive.content).trim()
}
chapter.name = it.jsonObject["title"]!!.jsonPrimitive.contentOrNull.toString()
chapter.date_upload = simpleDateFormat.parse(it.jsonObject["date"]!!.jsonPrimitive.content)?.time ?: 0L
chapter.chapter_number = it.jsonObject["posi"]!!.jsonPrimitive.float
// when it is Event add reading order numbers as prefix