From ef36432ffc1e6a678c51170a24fa13b78358b96c Mon Sep 17 00:00:00 2001 From: AwkwardPeak7 <48650614+AwkwardPeak7@users.noreply.github.com> Date: Sat, 6 Apr 2024 11:43:47 +0500 Subject: [PATCH] HNI-Scantrad move to PizzaReader (#2267) --- src/all/hniscantrad/build.gradle | 8 ++--- .../extension/all/hniscantrad/HNIScantrad.kt | 29 +++++++++++++++++++ .../all/hniscantrad/HNIScantradFactory.kt | 19 ------------ 3 files changed, 33 insertions(+), 23 deletions(-) create mode 100644 src/all/hniscantrad/src/eu/kanade/tachiyomi/extension/all/hniscantrad/HNIScantrad.kt delete mode 100644 src/all/hniscantrad/src/eu/kanade/tachiyomi/extension/all/hniscantrad/HNIScantradFactory.kt diff --git a/src/all/hniscantrad/build.gradle b/src/all/hniscantrad/build.gradle index cdb039c8e..ecbddf52d 100644 --- a/src/all/hniscantrad/build.gradle +++ b/src/all/hniscantrad/build.gradle @@ -1,9 +1,9 @@ ext { extName = 'HNI-Scantrad' - extClass = '.HNIScantradFactory' - themePkg = 'foolslide' - baseUrl = 'https://hni-scantrad.com' - overrideVersionCode = 1 + extClass = '.HNIScantrad' + themePkg = 'pizzareader' + baseUrl = 'https://hni-scantrad.net' + overrideVersionCode = 5 } apply from: "$rootDir/common.gradle" diff --git a/src/all/hniscantrad/src/eu/kanade/tachiyomi/extension/all/hniscantrad/HNIScantrad.kt b/src/all/hniscantrad/src/eu/kanade/tachiyomi/extension/all/hniscantrad/HNIScantrad.kt new file mode 100644 index 000000000..98fb6898d --- /dev/null +++ b/src/all/hniscantrad/src/eu/kanade/tachiyomi/extension/all/hniscantrad/HNIScantrad.kt @@ -0,0 +1,29 @@ +package eu.kanade.tachiyomi.extension.all.hniscantrad + +import eu.kanade.tachiyomi.multisrc.pizzareader.PizzaReader +import eu.kanade.tachiyomi.source.model.SManga +import kotlinx.serialization.json.Json + +class HNIScantrad : PizzaReader("HNI-Scantrad", "https://hni-scantrad.net", "all") { + override val json = Json { + ignoreUnknownKeys = true + coerceInputValues = true + } + + override fun String.toStatus(): Int { + return if (isEmpty()) { + SManga.UNKNOWN + } else { + when (substring(0, 7)) { + "In cors" -> SManga.ONGOING + "On goin" -> SManga.ONGOING + "Complet" -> SManga.COMPLETED + "Conclus" -> SManga.COMPLETED + "Conclud" -> SManga.COMPLETED + "Licenzi" -> SManga.LICENSED + "License" -> SManga.LICENSED + else -> SManga.UNKNOWN + } + } + } +} diff --git a/src/all/hniscantrad/src/eu/kanade/tachiyomi/extension/all/hniscantrad/HNIScantradFactory.kt b/src/all/hniscantrad/src/eu/kanade/tachiyomi/extension/all/hniscantrad/HNIScantradFactory.kt deleted file mode 100644 index b83c06f7f..000000000 --- a/src/all/hniscantrad/src/eu/kanade/tachiyomi/extension/all/hniscantrad/HNIScantradFactory.kt +++ /dev/null @@ -1,19 +0,0 @@ -package eu.kanade.tachiyomi.extension.all.hniscantrad - -import eu.kanade.tachiyomi.multisrc.foolslide.FoolSlide -import eu.kanade.tachiyomi.source.SourceFactory -import okhttp3.Response - -class HNIScantradFactory : SourceFactory { - override fun createSources() = listOf(HNIScantradFR(), HNIScantradEN()) -} - -class HNIScantradFR : FoolSlide("HNI-Scantrad", "https://hni-scantrad.com", "fr", "/lel") { - override fun chapterListParse(response: Response) = - super.chapterListParse(response).filter { "/fr/" in it.url } -} - -class HNIScantradEN : FoolSlide("HNI-Scantrad", "https://hni-scantrad.com", "en", "/lel") { - override fun chapterListParse(response: Response) = - super.chapterListParse(response).filter { "/en-us/" in it.url } -}