From 83f52130db1452bb6714422ac6cfa110e54454c3 Mon Sep 17 00:00:00 2001 From: Alexander Date: Sun, 9 Apr 2023 16:58:25 +0300 Subject: [PATCH] [RU]ComX: Reading order to comics events, expanded description (#16000) * Crossover-events handle, chapter naming cleanup * Crossover-events handle, chapter naming cleanup * Add reading order numbers to all comics events, add a note to the comic description. --- src/ru/comx/build.gradle | 2 +- .../tachiyomi/extension/ru/comx/ComX.kt | 28 +++++++------------ 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/src/ru/comx/build.gradle b/src/ru/comx/build.gradle index 113c68bdb..50cd8885c 100644 --- a/src/ru/comx/build.gradle +++ b/src/ru/comx/build.gradle @@ -6,7 +6,7 @@ ext { extName = 'Com-X' pkgNameSuffix = 'ru.comx' extClass = '.ComX' - extVersionCode = 25 + extVersionCode = 26 } apply from: "$rootDir/common.gradle" diff --git a/src/ru/comx/src/eu/kanade/tachiyomi/extension/ru/comx/ComX.kt b/src/ru/comx/src/eu/kanade/tachiyomi/extension/ru/comx/ComX.kt index a04c78639..571c1306b 100644 --- a/src/ru/comx/src/eu/kanade/tachiyomi/extension/ru/comx/ComX.kt +++ b/src/ru/comx/src/eu/kanade/tachiyomi/extension/ru/comx/ComX.kt @@ -262,7 +262,11 @@ class ComX : ParsedHttpSource() { manga.genre = category + ", " + rawAgeStop + ", " + infoElement.select(".page__tags a").joinToString { it.text() } manga.status = parseStatus(infoElement.select(".page__list li:contains(Статус)").text()) - manga.description = infoElement.select(".page__header h1").text().replace(" / ", " | ").split(" | ").first() + "\n" + ratingStar + " " + ratingValue + " (голосов: " + ratingVotes + ")\n" + Jsoup.parse(infoElement.select(".page__text ").first()!!.html().replace("
", "REPLACbR")).text().replace("REPLACbR", "\n") + manga.description = infoElement.select(".page__header h1").text().replace(" / ", " | ").split(" | ").first() + "\n" + + if (document.select(".page__list li:contains(Тип выпуска)").text().contains("!!! События в комиксах - ХРОНОЛОГИЯ !!!")) { "Cобытие в комиксах - ХРОНОЛОГИЯ\n" } else { "" } + + ratingStar + " " + ratingValue + " (голосов: " + ratingVotes + ")\n" + + Jsoup.parse(infoElement.select(".page__text ").first()!!.html().replace("
", "REPLACbR")).text().replace("REPLACbR", "\n") + val src = infoElement.select(".img-wide img").attr("data-src") if (src.contains("://")) { manga.thumbnail_url = src @@ -298,20 +302,8 @@ class ComX : ParsedHttpSource() { val data = json.decodeFromString(dataStr) val chaptersList = data["chapters"]?.jsonArray - - // If chapter name starts with #number or every chapter starts with same name before #number then it is not crossover-event - fun checkCrossEvent(strTitKey: String): Boolean { - return !( - chaptersList.orEmpty().any { - it.jsonObject[strTitKey]!!.jsonPrimitive.content.startsWith("#") - } || chaptersList.orEmpty().all { - it.jsonObject[strTitKey]!!.jsonPrimitive.content.substringBefore('#') == - chaptersList!![0].jsonObject[strTitKey]!!.jsonPrimitive.content.substringBefore('#') - } - ) - } - - val isCrossoverEvent = checkCrossEvent("title_en") || checkCrossEvent("title") + val isEvent = document.select(".page__list li:contains(Тип выпуска)").text() + .contains("!!! События в комиксах - ХРОНОЛОГИЯ !!!") val chapters: List? = chaptersList?.map { val chapter = SChapter.create() @@ -321,12 +313,12 @@ class ComX : ParsedHttpSource() { 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 + (it.jsonObject["title"]!!.jsonPrimitive.content + " " + it.jsonObject["title_en"]!!.jsonPrimitive.content).trim() } chapter.date_upload = simpleDateFormat.parse(it.jsonObject["date"]!!.jsonPrimitive.content)?.time ?: 0L chapter.chapter_number = it.jsonObject["posi"]!!.jsonPrimitive.float - // when it is Crossover-Event add reading order numbers as prefix - if (isCrossoverEvent) { + // when it is Event add reading order numbers as prefix + if (isEvent) { chapter.name = chapter.chapter_number.toInt().toString() + " " + chapter.name } chapter.setUrlWithoutDomain("/readcomix/" + data["news_id"] + "/" + it.jsonObject["id"]!!.jsonPrimitive.content + ".html")