From 8ad0505cd1d2bc0d44f535e5584e3a4e54648b29 Mon Sep 17 00:00:00 2001 From: KirinRaikage Date: Sun, 2 Jul 2023 22:38:53 +0200 Subject: [PATCH] Fix status parsing for PhenixScans and SushiScan (#16988) --- .../phenixscans/src/PhenixScans.kt | 19 ++++++++++++++++++- .../mangathemesia/sushiscan/src/SushiScan.kt | 9 +++++++-- .../mangathemesia/MangaThemesiaGenerator.kt | 4 ++-- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/multisrc/overrides/mangathemesia/phenixscans/src/PhenixScans.kt b/multisrc/overrides/mangathemesia/phenixscans/src/PhenixScans.kt index 1394f9772..d57f96a85 100644 --- a/multisrc/overrides/mangathemesia/phenixscans/src/PhenixScans.kt +++ b/multisrc/overrides/mangathemesia/phenixscans/src/PhenixScans.kt @@ -1,7 +1,24 @@ package eu.kanade.tachiyomi.extension.fr.phenixscans import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesia +import eu.kanade.tachiyomi.source.model.SManga +import org.jsoup.nodes.Document import java.text.SimpleDateFormat import java.util.Locale -class PhenixScans : MangaThemesia("PhenixScans", "https://phenixscans.fr", "fr", dateFormat = SimpleDateFormat("MMMM dd, yyyy", Locale.FRENCH)) +class PhenixScans : MangaThemesia("PhenixScans", "https://phenixscans.fr", "fr", dateFormat = SimpleDateFormat("MMMM dd, yyyy", Locale.FRENCH)) { + override val seriesAuthorSelector = ".imptdt:contains(Auteur) i, .fmed b:contains(Auteur)+span" + override val seriesStatusSelector = ".imptdt:contains(Statut) i" + + override fun String?.parseStatus(): Int = when { + this == null -> SManga.UNKNOWN + this.contains("En Cours", ignoreCase = true) -> SManga.ONGOING + this.contains("Terminé", ignoreCase = true) -> SManga.COMPLETED + else -> SManga.UNKNOWN + } + + override fun mangaDetailsParse(document: Document): SManga = + super.mangaDetailsParse(document).apply { + status = document.select(seriesStatusSelector).text().parseStatus() + } +} diff --git a/multisrc/overrides/mangathemesia/sushiscan/src/SushiScan.kt b/multisrc/overrides/mangathemesia/sushiscan/src/SushiScan.kt index 1f99422ae..6a09eed4f 100644 --- a/multisrc/overrides/mangathemesia/sushiscan/src/SushiScan.kt +++ b/multisrc/overrides/mangathemesia/sushiscan/src/SushiScan.kt @@ -11,8 +11,8 @@ import java.util.Locale class SushiScan : MangaThemesia("Sushi-Scan", "https://sushiscan.net", "fr", dateFormat = SimpleDateFormat("MMMM dd, yyyy", Locale.FRENCH)) { override val altNamePrefix = "Nom alternatif : " - override val seriesAuthorSelector = ".infotable tr:contains(Auteur) td:last-child" - override val seriesStatusSelector = ".infotable tr:contains(Statut) td:last-child" + override val seriesAuthorSelector = ".imptdt:contains(Auteur) i, .fmed b:contains(Auteur)+span" + override val seriesStatusSelector = ".imptdt:contains(Statut) i" override fun String?.parseStatus(): Int = when { this == null -> SManga.UNKNOWN this.contains("En Cours", ignoreCase = true) -> SManga.ONGOING @@ -20,6 +20,11 @@ class SushiScan : MangaThemesia("Sushi-Scan", "https://sushiscan.net", "fr", dat else -> SManga.UNKNOWN } + override fun mangaDetailsParse(document: Document): SManga = + super.mangaDetailsParse(document).apply { + status = document.select(seriesStatusSelector).text().parseStatus() + } + // Overriding to fix http -> https when needed override fun pageListParse(document: Document): List { val htmlPages = document.select(pageSelector) diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangathemesia/MangaThemesiaGenerator.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangathemesia/MangaThemesiaGenerator.kt index 7939d5789..6dc7d5fac 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangathemesia/MangaThemesiaGenerator.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangathemesia/MangaThemesiaGenerator.kt @@ -97,7 +97,7 @@ class MangaThemesiaGenerator : ThemeSourceGenerator { SingleLang("Ozul Scans", "https://ozulscans.com", "ar"), SingleLang("Patatescans", "https://patatescans.com", "fr", isNsfw = true, overrideVersionCode = 2), SingleLang("Phantom Scans", "https://phantomscans.com", "en", overrideVersionCode = 1), - SingleLang("PhenixScans", "https://phenixscans.fr", "fr", className = "PhenixScans"), + SingleLang("PhenixScans", "https://phenixscans.fr", "fr", className = "PhenixScans", overrideVersionCode = 1), SingleLang("Pi Scans", "https://piscans.in", "id", overrideVersionCode = 1), SingleLang("PMScans", "https://rackusreads.com", "en", overrideVersionCode = 3), SingleLang("Raiki Scan", "https://raikiscan.com", "es"), @@ -115,7 +115,7 @@ class MangaThemesiaGenerator : ThemeSourceGenerator { SingleLang("Snudae Scans", "https://snudaescans.com", "en", isNsfw = true, className = "BatotoScans", overrideVersionCode = 1), SingleLang("Summer Fansub", "https://smmr.in", "pt-BR", isNsfw = true), SingleLang("Surya Scans", "https://suryascans.com", "en"), - SingleLang("Sushi-Scan", "https://sushiscan.net", "fr", className = "SushiScan", overrideVersionCode = 4), + SingleLang("Sushi-Scan", "https://sushiscan.net", "fr", className = "SushiScan", overrideVersionCode = 5), SingleLang("Tarot Scans", "https://www.tarotscans.com", "tr"), SingleLang("The Apollo Team", "https://theapollo.team", "en"), SingleLang("Tsundoku Traduções", "https://tsundoku.com.br", "pt-BR", className = "TsundokuTraducoes", overrideVersionCode = 9),