[RU]Desu fix null show (#10978)

* [RU]Desu fix null show

* typot
This commit is contained in:
e-shl 2022-03-01 21:48:51 +05:00 committed by GitHub
parent 219bf0b1d2
commit 982be66732
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 9 deletions

View File

@ -6,7 +6,7 @@ ext {
extName = 'Desu' extName = 'Desu'
pkgNameSuffix = 'ru.desu' pkgNameSuffix = 'ru.desu'
extClass = '.Desu' extClass = '.Desu'
extVersionCode = 14 extVersionCode = 15
} }
apply from: "$rootDir/common.gradle" apply from: "$rootDir/common.gradle"

View File

@ -11,6 +11,7 @@ import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.source.online.HttpSource import eu.kanade.tachiyomi.source.online.HttpSource
import kotlinx.serialization.json.Json import kotlinx.serialization.json.Json
import kotlinx.serialization.json.JsonObject import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.contentOrNull
import kotlinx.serialization.json.float import kotlinx.serialization.json.float
import kotlinx.serialization.json.floatOrNull import kotlinx.serialization.json.floatOrNull
import kotlinx.serialization.json.int import kotlinx.serialization.json.int
@ -23,6 +24,7 @@ import okhttp3.Request
import okhttp3.Response import okhttp3.Response
import rx.Observable import rx.Observable
import uy.kohesive.injekt.injectLazy import uy.kohesive.injekt.injectLazy
import java.text.DecimalFormat
class Desu : HttpSource() { class Desu : HttpSource() {
override val name = "Desu" override val name = "Desu"
@ -91,7 +93,7 @@ class Desu : HttpSource() {
var altName = "" var altName = ""
if (obj["synonyms"]?.jsonPrimitive?.content.orEmpty().isNotEmpty()) { if (obj["synonyms"]!!.jsonPrimitive.contentOrNull != null) {
altName = "Альтернативные названия:\n" + altName = "Альтернативные названия:\n" +
obj["synonyms"]!!.jsonPrimitive.content obj["synonyms"]!!.jsonPrimitive.content
.replace("|", " / ") + .replace("|", " / ") +
@ -202,15 +204,11 @@ class Desu : HttpSource() {
return obj["chapters"]!!.jsonObject["list"]!!.jsonArray.map { return obj["chapters"]!!.jsonObject["list"]!!.jsonArray.map {
val chapterObj = it.jsonObject val chapterObj = it.jsonObject
val ch = chapterObj["ch"]!!.jsonPrimitive.float val ch = chapterObj["ch"]!!.jsonPrimitive.float
val fullNumStr = "${chapterObj["vol"]!!.jsonPrimitive.int} . Глава $ch" val fullNumStr = "${chapterObj["vol"]!!.jsonPrimitive.int}. Глава " + DecimalFormat("#,###.##").format(ch).replace(",", ".")
val title = chapterObj["title"]?.jsonPrimitive?.content.orEmpty() val title = chapterObj["title"]!!.jsonPrimitive.contentOrNull ?: ""
SChapter.create().apply { SChapter.create().apply {
name = if (title.isEmpty()) { name = "$fullNumStr $title"
fullNumStr
} else {
"$fullNumStr: $title"
}
url = "/$cid/chapter/${chapterObj["id"]!!.jsonPrimitive.int}" url = "/$cid/chapter/${chapterObj["id"]!!.jsonPrimitive.int}"
chapter_number = ch chapter_number = ch
date_upload = chapterObj["date"]!!.jsonPrimitive.long * 1000L date_upload = chapterObj["date"]!!.jsonPrimitive.long * 1000L