From 95d3671f3d10273ac10d9f16790be700f9a62104 Mon Sep 17 00:00:00 2001 From: Mike <51273546+SnakeDoc83@users.noreply.github.com> Date: Thu, 8 Feb 2024 10:11:23 -0500 Subject: [PATCH] NepNep - conditionally add scanlator info (#1131) --- .../java/eu/kanade/tachiyomi/multisrc/nepnep/NepNep.kt | 9 +++++++-- .../kanade/tachiyomi/multisrc/nepnep/NepNepGenerator.kt | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/nepnep/NepNep.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/nepnep/NepNep.kt index 27e8a446d..306aa4ea2 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/nepnep/NepNep.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/nepnep/NepNep.kt @@ -310,11 +310,16 @@ abstract class NepNep( override fun chapterListParse(response: Response): List { val vmChapters = response.asJsoup().select("script:containsData(MainFunction)").first()!!.data() .substringAfter("vm.Chapters = ").substringBefore(";") - return json.parseToJsonElement(vmChapters).jsonArray.map { json -> + val array = json.parseToJsonElement(vmChapters).jsonArray + val hasDistinctTypes = array.map { it.getString("Type") }.distinct().count() > 1 + return array.map { json -> val indexChapter = json.getString("Chapter")!! + val type = json.getString("Type") SChapter.create().apply { - name = json.getString("ChapterName").let { if (it.isNullOrEmpty()) "${json.getString("Type")} ${chapterImage(indexChapter, true)}" else it } + name = json.getString("ChapterName").let { if (it.isNullOrEmpty()) "$type ${chapterImage(indexChapter, true)}" else it } url = "/read-online/" + response.request.url.toString().substringAfter("/manga/") + chapterURLEncode(indexChapter) + // only add type info as scanlator if there are differing types among chapter array + scanlator = if (hasDistinctTypes) type else null date_upload = try { json.getString("Date").let { dateFormat.parse("$it +0600")?.time } ?: 0 } catch (_: Exception) { diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/nepnep/NepNepGenerator.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/nepnep/NepNepGenerator.kt index 0c9705899..6bcadc5fc 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/nepnep/NepNepGenerator.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/nepnep/NepNepGenerator.kt @@ -9,7 +9,7 @@ class NepNepGenerator : ThemeSourceGenerator { override val themeClass = "NepNep" - override val baseVersionCode: Int = 11 + override val baseVersionCode: Int = 12 override val sources = listOf( SingleLang("MangaSee", "https://mangasee123.com", "en", overrideVersionCode = 24),