From ae0f49fc7c1ea8bd44dc321943500089effc23ed Mon Sep 17 00:00:00 2001 From: Alessandro Jean Date: Sun, 12 Dec 2021 18:41:26 -0300 Subject: [PATCH] Update GS URL and move it to Madara (closes #9980). (#10083) --- .../res/mipmap-hdpi/ic_launcher.png | Bin .../res/mipmap-mdpi/ic_launcher.png | Bin .../res/mipmap-xhdpi/ic_launcher.png | Bin .../res/mipmap-xxhdpi/ic_launcher.png | Bin .../res/mipmap-xxxhdpi/ic_launcher.png | Bin .../geassscanlator/res/web_hi_res_512.png | Bin .../geassscanlator/src/GeassScanlator.kt | 32 +++++++++ .../geassscanlator/src/GeassScanlator.kt | 63 ------------------ .../tachiyomi/multisrc/madara/Madara.kt | 10 +-- .../multisrc/madara/MadaraGenerator.kt | 1 + .../wpmangastream/WPMangaStreamGenerator.kt | 1 - 11 files changed, 39 insertions(+), 68 deletions(-) rename multisrc/overrides/{wpmangastream => madara}/geassscanlator/res/mipmap-hdpi/ic_launcher.png (100%) rename multisrc/overrides/{wpmangastream => madara}/geassscanlator/res/mipmap-mdpi/ic_launcher.png (100%) rename multisrc/overrides/{wpmangastream => madara}/geassscanlator/res/mipmap-xhdpi/ic_launcher.png (100%) rename multisrc/overrides/{wpmangastream => madara}/geassscanlator/res/mipmap-xxhdpi/ic_launcher.png (100%) rename multisrc/overrides/{wpmangastream => madara}/geassscanlator/res/mipmap-xxxhdpi/ic_launcher.png (100%) rename multisrc/overrides/{wpmangastream => madara}/geassscanlator/res/web_hi_res_512.png (100%) create mode 100644 multisrc/overrides/madara/geassscanlator/src/GeassScanlator.kt delete mode 100644 multisrc/overrides/wpmangastream/geassscanlator/src/GeassScanlator.kt diff --git a/multisrc/overrides/wpmangastream/geassscanlator/res/mipmap-hdpi/ic_launcher.png b/multisrc/overrides/madara/geassscanlator/res/mipmap-hdpi/ic_launcher.png similarity index 100% rename from multisrc/overrides/wpmangastream/geassscanlator/res/mipmap-hdpi/ic_launcher.png rename to multisrc/overrides/madara/geassscanlator/res/mipmap-hdpi/ic_launcher.png diff --git a/multisrc/overrides/wpmangastream/geassscanlator/res/mipmap-mdpi/ic_launcher.png b/multisrc/overrides/madara/geassscanlator/res/mipmap-mdpi/ic_launcher.png similarity index 100% rename from multisrc/overrides/wpmangastream/geassscanlator/res/mipmap-mdpi/ic_launcher.png rename to multisrc/overrides/madara/geassscanlator/res/mipmap-mdpi/ic_launcher.png diff --git a/multisrc/overrides/wpmangastream/geassscanlator/res/mipmap-xhdpi/ic_launcher.png b/multisrc/overrides/madara/geassscanlator/res/mipmap-xhdpi/ic_launcher.png similarity index 100% rename from multisrc/overrides/wpmangastream/geassscanlator/res/mipmap-xhdpi/ic_launcher.png rename to multisrc/overrides/madara/geassscanlator/res/mipmap-xhdpi/ic_launcher.png diff --git a/multisrc/overrides/wpmangastream/geassscanlator/res/mipmap-xxhdpi/ic_launcher.png b/multisrc/overrides/madara/geassscanlator/res/mipmap-xxhdpi/ic_launcher.png similarity index 100% rename from multisrc/overrides/wpmangastream/geassscanlator/res/mipmap-xxhdpi/ic_launcher.png rename to multisrc/overrides/madara/geassscanlator/res/mipmap-xxhdpi/ic_launcher.png diff --git a/multisrc/overrides/wpmangastream/geassscanlator/res/mipmap-xxxhdpi/ic_launcher.png b/multisrc/overrides/madara/geassscanlator/res/mipmap-xxxhdpi/ic_launcher.png similarity index 100% rename from multisrc/overrides/wpmangastream/geassscanlator/res/mipmap-xxxhdpi/ic_launcher.png rename to multisrc/overrides/madara/geassscanlator/res/mipmap-xxxhdpi/ic_launcher.png diff --git a/multisrc/overrides/wpmangastream/geassscanlator/res/web_hi_res_512.png b/multisrc/overrides/madara/geassscanlator/res/web_hi_res_512.png similarity index 100% rename from multisrc/overrides/wpmangastream/geassscanlator/res/web_hi_res_512.png rename to multisrc/overrides/madara/geassscanlator/res/web_hi_res_512.png diff --git a/multisrc/overrides/madara/geassscanlator/src/GeassScanlator.kt b/multisrc/overrides/madara/geassscanlator/src/GeassScanlator.kt new file mode 100644 index 000000000..c93737f52 --- /dev/null +++ b/multisrc/overrides/madara/geassscanlator/src/GeassScanlator.kt @@ -0,0 +1,32 @@ +package eu.kanade.tachiyomi.extension.pt.geassscanlator + +import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor +import eu.kanade.tachiyomi.multisrc.madara.Madara +import okhttp3.OkHttpClient +import java.text.SimpleDateFormat +import java.util.Locale +import java.util.concurrent.TimeUnit + +class GeassScanlator : Madara( + "Geass Scanlator", + "https://geassscan.net", + "pt-BR", + SimpleDateFormat("yyyy-MM-dd", Locale("pt", "BR")) +) { + + // Website changed from WpMangaStream to Madara (again). + override val versionId: Int = 2 + + override val client: OkHttpClient = super.client.newBuilder() + .addInterceptor(RateLimitInterceptor(1, 2, TimeUnit.SECONDS)) + .build() + + override val useNewChapterEndpoint: Boolean = true + + override val altName: String = "Nome alternativo: " + + // Tags are full of garbage, so remove them. + override val mangaDetailsSelectorTag: String = "" + + override fun popularMangaSelector() = "div.page-item-detail.manga" +} diff --git a/multisrc/overrides/wpmangastream/geassscanlator/src/GeassScanlator.kt b/multisrc/overrides/wpmangastream/geassscanlator/src/GeassScanlator.kt deleted file mode 100644 index d80e0f6f6..000000000 --- a/multisrc/overrides/wpmangastream/geassscanlator/src/GeassScanlator.kt +++ /dev/null @@ -1,63 +0,0 @@ -package eu.kanade.tachiyomi.extension.pt.geassscanlator - -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor -import eu.kanade.tachiyomi.multisrc.wpmangastream.WPMangaStream -import eu.kanade.tachiyomi.source.model.SChapter -import eu.kanade.tachiyomi.util.asJsoup -import okhttp3.OkHttpClient -import okhttp3.Response -import java.text.SimpleDateFormat -import java.util.Locale -import java.util.concurrent.TimeUnit - -class GeassScanlator : WPMangaStream( - "Geass Scanlator", - "https://geassscan.xyz", - "pt-BR", - SimpleDateFormat("MMMMM dd, yyyy", Locale("pt", "BR")) -) { - - override val client: OkHttpClient = super.client.newBuilder() - .addInterceptor(RateLimitInterceptor(1, 2, TimeUnit.SECONDS)) - .build() - - override val altName: String = "Nome alternativo: " - - override fun chapterListParse(response: Response): List { - val document = response.asJsoup() - - return document.select(chapterListSelector()) - .map { chapterFromElement(it) } - } - - // [...document.querySelectorAll('ul.genrez li')] - // .map(x => `Genre("${x.querySelector("label").innerHTML}", "${x.querySelector("input").value}")`) - // .join(',\n') - override fun getGenreList(): List = listOf( - Genre("Ação", "acao"), - Genre("Artes Marciais", "artes-marciais"), - Genre("Aventura", "aventura"), - Genre("Comédia", "comedia"), - Genre("Drama", "drama"), - Genre("Ecchi", "ecchi"), - Genre("Escolar", "escolar"), - Genre("Fantasia", "fantasia"), - Genre("Harem", "harem"), - Genre("Histórico", "historico"), - Genre("Horror", "horror"), - Genre("Magia", "magia"), - Genre("Manga", "manga"), - Genre("Manhua", "manhua"), - Genre("Mistério", "misterio"), - Genre("Romance", "romance"), - Genre("Sci-fi", "sci-fi"), - Genre("Seinen", "seinen"), - Genre("Shoujo", "shoujo"), - Genre("Shounen", "shounen"), - Genre("Shounen Ai", "shounen-ai"), - Genre("Slice of Life", "slice-of-life"), - Genre("Sobrenatural", "sobrenatural"), - Genre("Suspense", "suspense"), - Genre("Webtoon", "webtoon") - ) -} diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/Madara.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/Madara.kt index 1cc92cc49..0856ea347 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/Madara.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/Madara.kt @@ -360,9 +360,11 @@ abstract class Madara( .toMutableSet() // add tag(s) to genre - select(mangaDetailsSelectorTag).forEach { element -> - if (genres.contains(element.text()).not()) { - genres.add(element.text().toLowerCase(Locale.ROOT)) + if (mangaDetailsSelectorTag.isNotEmpty()) { + select(mangaDetailsSelectorTag).forEach { element -> + if (genres.contains(element.text()).not()) { + genres.add(element.text().toLowerCase(Locale.ROOT)) + } } } @@ -509,7 +511,7 @@ abstract class Madara( // Added "title" alternative chapter.date_upload = select("img").firstOrNull()?.attr("alt")?.let { parseRelativeDate(it) } ?: select("span a").firstOrNull()?.attr("title")?.let { parseRelativeDate(it) } - ?: parseChapterDate(select("span.chapter-release-date i").firstOrNull()?.text()) + ?: parseChapterDate(select("span.chapter-release-date i").firstOrNull()?.text()) } return chapter diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/MadaraGenerator.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/MadaraGenerator.kt index 74bdb2a6a..5d53177c0 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/MadaraGenerator.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/MadaraGenerator.kt @@ -91,6 +91,7 @@ class MadaraGenerator : ThemeSourceGenerator { SingleLang("Furio Scans", "https://furioscans.com", "pt-BR", overrideVersionCode = 4), SingleLang("GalaxyDegenScans", "https://gdstmp.site", "en", overrideVersionCode = 3), SingleLang("Gatemanga", "https://gatemanga.com", "ar"), + SingleLang("Geass Scanlator", "https://geassscan.net", "pt-BR", overrideVersionCode = 3), SingleLang("Gemanga", "https://gemanga.com", "ar"), SingleLang("Glory Scans", "https://gloryscan.com", "pt-BR", isNsfw = true, overrideVersionCode = 2), SingleLang("Gogoscans", "https://www.gogoscans.com", "en"), diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/wpmangastream/WPMangaStreamGenerator.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/wpmangastream/WPMangaStreamGenerator.kt index a36ce75d8..270290225 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/wpmangastream/WPMangaStreamGenerator.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/wpmangastream/WPMangaStreamGenerator.kt @@ -47,7 +47,6 @@ class WPMangaStreamGenerator : ThemeSourceGenerator { SingleLang("The Apollo Team", "https://theapollo.team", "en"), SingleLang("Sekte Doujin", "https://sektedoujin.xyz", "id", isNsfw = true, overrideVersionCode = 2), SingleLang("Phoenix Fansub", "https://phoenixfansub.com", "es", overrideVersionCode = 1), - SingleLang("Geass Scanlator", "https://geassscan.xyz", "pt-BR", overrideVersionCode = 2), SingleLang("Imagine Scan", "https://imaginescan.com.br", "pt-BR", isNsfw = true), SingleLang("Vapo Scan", "https://vaposcans.com", "pt-BR", overrideVersionCode = 2), SingleLang("Hakai Scan", "http://hakaiscan.xyz", "pt-BR", isNsfw = true),