[RU]Desu status smart (#12182)

* [RU]Desu status smart

* no adult
This commit is contained in:
Ejan 2022-06-13 19:42:50 +05:00 committed by GitHub
parent e2b61a2ff3
commit 6bbd8b3375
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 18 deletions

View File

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

View File

@ -79,10 +79,10 @@ class Desu : HttpSource() {
val rawAgeStop = when (obj["adult"]!!.jsonPrimitive.int) { val rawAgeStop = when (obj["adult"]!!.jsonPrimitive.int) {
1 -> "18+" 1 -> "18+"
else -> "0+" else -> ""
} }
val rawTypeStr = when (obj["kind"]!!.jsonPrimitive.content) { val category = when (obj["kind"]!!.jsonPrimitive.content) {
"manga" -> "Манга" "manga" -> "Манга"
"manhwa" -> "Манхва" "manhwa" -> "Манхва"
"manhua" -> "Маньхуа" "manhua" -> "Маньхуа"
@ -108,22 +108,25 @@ class Desu : HttpSource() {
obj["description"]!!.jsonPrimitive.content obj["description"]!!.jsonPrimitive.content
genre = if (chapter) { genre = if (chapter) {
"$category, $rawAgeStop, " +
obj["genres"]!!.jsonArray obj["genres"]!!.jsonArray
.map { it.jsonObject["russian"]!!.jsonPrimitive.content } .map { it.jsonObject["russian"]!!.jsonPrimitive.content }
.plusElement(rawTypeStr)
.plusElement(rawAgeStop)
.joinToString() .joinToString()
} else { } else {
obj["genres"]!!.jsonPrimitive.content + ", " + rawTypeStr + ", " + rawAgeStop category + ", " + rawAgeStop + ", " + obj["genres"]!!.jsonPrimitive.content
} }
status = when (obj["status"]!!.jsonPrimitive.content) { status = when (obj["trans_status"]!!.jsonPrimitive.content) {
"continued" -> SManga.ONGOING
"completed" -> SManga.COMPLETED
else -> when (obj["status"]!!.jsonPrimitive.content) {
"ongoing" -> SManga.ONGOING "ongoing" -> SManga.ONGOING
"released" -> SManga.COMPLETED "released" -> SManga.COMPLETED
// "copyright" -> SManga.LICENSED Hides available chapters! // "copyright" -> SManga.LICENSED Hides available chapters!
else -> SManga.UNKNOWN else -> SManga.UNKNOWN
} }
} }
}
override fun popularMangaRequest(page: Int) = override fun popularMangaRequest(page: Int) =
GET("$baseUrl$API_URL/?limit=50&order=popular&page=$page") GET("$baseUrl$API_URL/?limit=50&order=popular&page=$page")
@ -171,7 +174,7 @@ class Desu : HttpSource() {
} }
private fun titleDetailsRequest(manga: SManga): Request { private fun titleDetailsRequest(manga: SManga): Request {
return GET(baseUrl + API_URL + manga.url, headers) return GET(baseUrl + API_URL + manga.url + "/", headers)
} }
// Workaround to allow "Open in browser" use the real URL. // Workaround to allow "Open in browser" use the real URL.
@ -216,9 +219,7 @@ class Desu : HttpSource() {
}.filter { it.chapter_number <= objChapter.jsonObject["last"]!!.jsonObject["ch"]!!.jsonPrimitive.float } }.filter { it.chapter_number <= objChapter.jsonObject["last"]!!.jsonObject["ch"]!!.jsonPrimitive.float }
} }
override fun chapterListRequest(manga: SManga): Request { override fun chapterListRequest(manga: SManga): Request = titleDetailsRequest(manga)
return GET(baseUrl + API_URL + manga.url, headers)
}
override fun pageListRequest(chapter: SChapter): Request { override fun pageListRequest(chapter: SChapter): Request {
return GET(baseUrl + API_URL + chapter.url, headers) return GET(baseUrl + API_URL + chapter.url, headers)