From 95f8795bfad53c1ec397a40936f0b0c501a6cde7 Mon Sep 17 00:00:00 2001 From: Mike <51273546+SnakeDoc83@users.noreply.github.com> Date: Fri, 24 Apr 2020 23:23:31 -0400 Subject: [PATCH] DbMultiverse - additional languages (#2782) * DbMultiverse - additional languages * Separate file for "en" class --- .../dragonball_multiverse/build.gradle | 6 +- .../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 .../res/web_hi_res_512.png | Bin .../all/dragonball_multiverse/DbMFactory.kt | 83 ++++++++++++++++++ .../dragonball_multiverse/DbMultiverse.kt | 9 +- .../dragonball_multiverse/DbMultiverseEN.kt | 3 + 10 files changed, 93 insertions(+), 8 deletions(-) rename src/{en => all}/dragonball_multiverse/build.gradle (65%) rename src/{en => all}/dragonball_multiverse/res/mipmap-hdpi/ic_launcher.png (100%) rename src/{en => all}/dragonball_multiverse/res/mipmap-mdpi/ic_launcher.png (100%) rename src/{en => all}/dragonball_multiverse/res/mipmap-xhdpi/ic_launcher.png (100%) rename src/{en => all}/dragonball_multiverse/res/mipmap-xxhdpi/ic_launcher.png (100%) rename src/{en => all}/dragonball_multiverse/res/mipmap-xxxhdpi/ic_launcher.png (100%) rename src/{en => all}/dragonball_multiverse/res/web_hi_res_512.png (100%) create mode 100644 src/all/dragonball_multiverse/src/eu/kanade/tachiyomi/extension/all/dragonball_multiverse/DbMFactory.kt rename src/{en/dragonball_multiverse/src/eu/kanade/tachiyomi/extension/en => all/dragonball_multiverse/src/eu/kanade/tachiyomi/extension/all}/dragonball_multiverse/DbMultiverse.kt (93%) create mode 100644 src/all/dragonball_multiverse/src/eu/kanade/tachiyomi/extension/en/dragonball_multiverse/DbMultiverseEN.kt diff --git a/src/en/dragonball_multiverse/build.gradle b/src/all/dragonball_multiverse/build.gradle similarity index 65% rename from src/en/dragonball_multiverse/build.gradle rename to src/all/dragonball_multiverse/build.gradle index 50216af5b..1389905df 100644 --- a/src/en/dragonball_multiverse/build.gradle +++ b/src/all/dragonball_multiverse/build.gradle @@ -3,9 +3,9 @@ apply plugin: 'kotlin-android' ext { appName = 'Tachiyomi: Dragon Ball Multiverse' - pkgNameSuffix = 'en.dragonball_multiverse' - extClass = '.DbMultiverse' - extVersionCode = 3 + pkgNameSuffix = 'all.dragonball_multiverse' + extClass = '.DbMFactory' + extVersionCode = 1 libVersion = '1.2' } diff --git a/src/en/dragonball_multiverse/res/mipmap-hdpi/ic_launcher.png b/src/all/dragonball_multiverse/res/mipmap-hdpi/ic_launcher.png similarity index 100% rename from src/en/dragonball_multiverse/res/mipmap-hdpi/ic_launcher.png rename to src/all/dragonball_multiverse/res/mipmap-hdpi/ic_launcher.png diff --git a/src/en/dragonball_multiverse/res/mipmap-mdpi/ic_launcher.png b/src/all/dragonball_multiverse/res/mipmap-mdpi/ic_launcher.png similarity index 100% rename from src/en/dragonball_multiverse/res/mipmap-mdpi/ic_launcher.png rename to src/all/dragonball_multiverse/res/mipmap-mdpi/ic_launcher.png diff --git a/src/en/dragonball_multiverse/res/mipmap-xhdpi/ic_launcher.png b/src/all/dragonball_multiverse/res/mipmap-xhdpi/ic_launcher.png similarity index 100% rename from src/en/dragonball_multiverse/res/mipmap-xhdpi/ic_launcher.png rename to src/all/dragonball_multiverse/res/mipmap-xhdpi/ic_launcher.png diff --git a/src/en/dragonball_multiverse/res/mipmap-xxhdpi/ic_launcher.png b/src/all/dragonball_multiverse/res/mipmap-xxhdpi/ic_launcher.png similarity index 100% rename from src/en/dragonball_multiverse/res/mipmap-xxhdpi/ic_launcher.png rename to src/all/dragonball_multiverse/res/mipmap-xxhdpi/ic_launcher.png diff --git a/src/en/dragonball_multiverse/res/mipmap-xxxhdpi/ic_launcher.png b/src/all/dragonball_multiverse/res/mipmap-xxxhdpi/ic_launcher.png similarity index 100% rename from src/en/dragonball_multiverse/res/mipmap-xxxhdpi/ic_launcher.png rename to src/all/dragonball_multiverse/res/mipmap-xxxhdpi/ic_launcher.png diff --git a/src/en/dragonball_multiverse/res/web_hi_res_512.png b/src/all/dragonball_multiverse/res/web_hi_res_512.png similarity index 100% rename from src/en/dragonball_multiverse/res/web_hi_res_512.png rename to src/all/dragonball_multiverse/res/web_hi_res_512.png diff --git a/src/all/dragonball_multiverse/src/eu/kanade/tachiyomi/extension/all/dragonball_multiverse/DbMFactory.kt b/src/all/dragonball_multiverse/src/eu/kanade/tachiyomi/extension/all/dragonball_multiverse/DbMFactory.kt new file mode 100644 index 000000000..ab1b42a97 --- /dev/null +++ b/src/all/dragonball_multiverse/src/eu/kanade/tachiyomi/extension/all/dragonball_multiverse/DbMFactory.kt @@ -0,0 +1,83 @@ +@file:Suppress("ClassName") + +package eu.kanade.tachiyomi.extension.all.dragonball_multiverse + +import eu.kanade.tachiyomi.source.Source +import eu.kanade.tachiyomi.source.SourceFactory + +class DbMFactory : SourceFactory { + override fun createSources(): List = listOf( + DbMultiverseEN(), + DbMultiverseFR(), + DbMultiverseJP(), + DbMultiverseCN(), + DbMultiverseES(), + DbMultiverseIT(), + DbMultiversePT(), + DbMultiverseDE(), + DbMultiversePL(), + DbMultiverseNL(), + DbMultiverseFR_PA(), + DbMultiverseTR_TR(), + DbMultiversePT_BR(), + DbMultiverseHU_HU(), + DbMultiverseGA_ES(), + DbMultiverseCT_CT(), + DbMultiverseNO_NO(), + DbMultiverseRU_RU(), + DbMultiverseRO_RO(), + DbMultiverseEU_EH(), + DbMultiverseLT_LT(), + DbMultiverseHR_HR(), + DbMultiverseKR_KR(), + DbMultiverseFI_FI(), + DbMultiverseHE_HE(), + DbMultiverseBG_BG(), + DbMultiverseSV_SE(), + DbMultiverseGR_GR(), + DbMultiverseES_CO(), + DbMultiverseAR_JO(), + DbMultiverseTL_PI(), + DbMultiverseLA_LA(), + DbMultiverseDA_DK(), + DbMultiverseCO_FR(), + DbMultiverseBR_FR(), + DbMultiverseXX_VE() + ) +} + +class DbMultiverseFR : DbMultiverse("fr") +class DbMultiverseJP : DbMultiverse("jp") +class DbMultiverseCN : DbMultiverse("cn") +class DbMultiverseES : DbMultiverse("es") +class DbMultiverseIT : DbMultiverse("it") +class DbMultiversePT : DbMultiverse("pt") +class DbMultiverseDE : DbMultiverse("de") +class DbMultiversePL : DbMultiverse("pl") +class DbMultiverseNL : DbMultiverse("nl") +class DbMultiverseFR_PA : DbMultiverse("fr-PA") +class DbMultiverseTR_TR : DbMultiverse("tr-TR") +class DbMultiversePT_BR : DbMultiverse("pt-BR") +class DbMultiverseHU_HU : DbMultiverse("hu-HU") +class DbMultiverseGA_ES : DbMultiverse("ga-ES") +class DbMultiverseCT_CT : DbMultiverse("ct-CT") +class DbMultiverseNO_NO : DbMultiverse("no-NO") +class DbMultiverseRU_RU : DbMultiverse("ru-RU") +class DbMultiverseRO_RO : DbMultiverse("ro-RO") +class DbMultiverseEU_EH : DbMultiverse("eu-EH") +class DbMultiverseLT_LT : DbMultiverse("lt-LT") +class DbMultiverseHR_HR : DbMultiverse("hr-HR") +class DbMultiverseKR_KR : DbMultiverse("kr-KR") +class DbMultiverseFI_FI : DbMultiverse("fi-FI") +class DbMultiverseHE_HE : DbMultiverse("he-HE") +class DbMultiverseBG_BG : DbMultiverse("bg-BG") +class DbMultiverseSV_SE : DbMultiverse("sv-SE") +class DbMultiverseGR_GR : DbMultiverse("gr-GR") +class DbMultiverseES_CO : DbMultiverse("es-CO") +class DbMultiverseAR_JO : DbMultiverse("ar-JO") +class DbMultiverseTL_PI : DbMultiverse("tl-PI") +class DbMultiverseLA_LA : DbMultiverse("la-LA") +class DbMultiverseDA_DK : DbMultiverse("da-DK") +class DbMultiverseCO_FR : DbMultiverse("co-FR") +class DbMultiverseBR_FR : DbMultiverse("br-FR") +class DbMultiverseXX_VE : DbMultiverse("xx-VE") diff --git a/src/en/dragonball_multiverse/src/eu/kanade/tachiyomi/extension/en/dragonball_multiverse/DbMultiverse.kt b/src/all/dragonball_multiverse/src/eu/kanade/tachiyomi/extension/all/dragonball_multiverse/DbMultiverse.kt similarity index 93% rename from src/en/dragonball_multiverse/src/eu/kanade/tachiyomi/extension/en/dragonball_multiverse/DbMultiverse.kt rename to src/all/dragonball_multiverse/src/eu/kanade/tachiyomi/extension/all/dragonball_multiverse/DbMultiverse.kt index 0a8827a18..3b5f43dce 100644 --- a/src/en/dragonball_multiverse/src/eu/kanade/tachiyomi/extension/en/dragonball_multiverse/DbMultiverse.kt +++ b/src/all/dragonball_multiverse/src/eu/kanade/tachiyomi/extension/all/dragonball_multiverse/DbMultiverse.kt @@ -1,4 +1,4 @@ -package eu.kanade.tachiyomi.extension.en.dragonball_multiverse +package eu.kanade.tachiyomi.extension.all.dragonball_multiverse import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.MangasPage @@ -13,12 +13,11 @@ import org.jsoup.nodes.Document import org.jsoup.nodes.Element import rx.Observable -open class DbMultiverse : ParsedHttpSource() { +abstract class DbMultiverse(override val lang: String) : ParsedHttpSource() { override val name = "Dragon Ball Multiverse" override val baseUrl = "https://www.dragonball-multiverse.com" override val supportsLatest = false - override val lang = "en" private fun chapterFromElement(element: Element, name: String): SChapter { val chapter = SChapter.create() @@ -65,7 +64,7 @@ open class DbMultiverse : ParsedHttpSource() { private fun createManga(document: Document?) = SManga.create().apply { title = name status = SManga.ONGOING - url = "/en/chapters.html" + url = "/${lang.replace("-", "_")}/chapters.html" description = "Dragon Ball Multiverse (DBM) is a free online comic, made by a whole team of fans. It's our personal sequel to DBZ." thumbnail_url = document?.select("div[ch=\"1\"] img")?.attr("abs:src") } @@ -82,7 +81,7 @@ open class DbMultiverse : ParsedHttpSource() { override fun popularMangaNextPageSelector(): String? = throw UnsupportedOperationException() - override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable = Observable.empty() + override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable = Observable.just(MangasPage(emptyList(), false)) override fun searchMangaFromElement(element: Element): SManga = throw UnsupportedOperationException() diff --git a/src/all/dragonball_multiverse/src/eu/kanade/tachiyomi/extension/en/dragonball_multiverse/DbMultiverseEN.kt b/src/all/dragonball_multiverse/src/eu/kanade/tachiyomi/extension/en/dragonball_multiverse/DbMultiverseEN.kt new file mode 100644 index 000000000..12d216c33 --- /dev/null +++ b/src/all/dragonball_multiverse/src/eu/kanade/tachiyomi/extension/en/dragonball_multiverse/DbMultiverseEN.kt @@ -0,0 +1,3 @@ +package eu.kanade.tachiyomi.extension.all.dragonball_multiverse + +class DbMultiverseEN : DbMultiverse("en")