diff --git a/src/en/likemanga/res/mipmap-hdpi/ic_launcher.png b/multisrc/overrides/likemanga/likemanga/res/mipmap-hdpi/ic_launcher.png similarity index 100% rename from src/en/likemanga/res/mipmap-hdpi/ic_launcher.png rename to multisrc/overrides/likemanga/likemanga/res/mipmap-hdpi/ic_launcher.png diff --git a/src/en/likemanga/res/mipmap-mdpi/ic_launcher.png b/multisrc/overrides/likemanga/likemanga/res/mipmap-mdpi/ic_launcher.png similarity index 100% rename from src/en/likemanga/res/mipmap-mdpi/ic_launcher.png rename to multisrc/overrides/likemanga/likemanga/res/mipmap-mdpi/ic_launcher.png diff --git a/src/en/likemanga/res/mipmap-xhdpi/ic_launcher.png b/multisrc/overrides/likemanga/likemanga/res/mipmap-xhdpi/ic_launcher.png similarity index 100% rename from src/en/likemanga/res/mipmap-xhdpi/ic_launcher.png rename to multisrc/overrides/likemanga/likemanga/res/mipmap-xhdpi/ic_launcher.png diff --git a/src/en/likemanga/res/mipmap-xxhdpi/ic_launcher.png b/multisrc/overrides/likemanga/likemanga/res/mipmap-xxhdpi/ic_launcher.png similarity index 100% rename from src/en/likemanga/res/mipmap-xxhdpi/ic_launcher.png rename to multisrc/overrides/likemanga/likemanga/res/mipmap-xxhdpi/ic_launcher.png diff --git a/src/en/likemanga/res/mipmap-xxxhdpi/ic_launcher.png b/multisrc/overrides/likemanga/likemanga/res/mipmap-xxxhdpi/ic_launcher.png similarity index 100% rename from src/en/likemanga/res/mipmap-xxxhdpi/ic_launcher.png rename to multisrc/overrides/likemanga/likemanga/res/mipmap-xxxhdpi/ic_launcher.png diff --git a/multisrc/overrides/likemanga/likemanga/src/LikeMangaIO.kt b/multisrc/overrides/likemanga/likemanga/src/LikeMangaIO.kt new file mode 100644 index 000000000..f8fb29ca9 --- /dev/null +++ b/multisrc/overrides/likemanga/likemanga/src/LikeMangaIO.kt @@ -0,0 +1,10 @@ +package eu.kanade.tachiyomi.extension.en.likemanga + +import eu.kanade.tachiyomi.multisrc.likemanga.LikeManga +import eu.kanade.tachiyomi.network.interceptor.rateLimit + +class LikeMangaIO : LikeManga("LikeManga", "https://likemanga.io", "en") { + override val client = super.client.newBuilder() + .rateLimit(1, 2) + .build() +} diff --git a/multisrc/overrides/madara/zinmanhwa/res/mipmap-hdpi/ic_launcher.png b/multisrc/overrides/likemanga/zinmanhwa/res/mipmap-hdpi/ic_launcher.png similarity index 100% rename from multisrc/overrides/madara/zinmanhwa/res/mipmap-hdpi/ic_launcher.png rename to multisrc/overrides/likemanga/zinmanhwa/res/mipmap-hdpi/ic_launcher.png diff --git a/multisrc/overrides/madara/zinmanhwa/res/mipmap-mdpi/ic_launcher.png b/multisrc/overrides/likemanga/zinmanhwa/res/mipmap-mdpi/ic_launcher.png similarity index 100% rename from multisrc/overrides/madara/zinmanhwa/res/mipmap-mdpi/ic_launcher.png rename to multisrc/overrides/likemanga/zinmanhwa/res/mipmap-mdpi/ic_launcher.png diff --git a/multisrc/overrides/madara/zinmanhwa/res/mipmap-xhdpi/ic_launcher.png b/multisrc/overrides/likemanga/zinmanhwa/res/mipmap-xhdpi/ic_launcher.png similarity index 100% rename from multisrc/overrides/madara/zinmanhwa/res/mipmap-xhdpi/ic_launcher.png rename to multisrc/overrides/likemanga/zinmanhwa/res/mipmap-xhdpi/ic_launcher.png diff --git a/multisrc/overrides/madara/zinmanhwa/res/mipmap-xxhdpi/ic_launcher.png b/multisrc/overrides/likemanga/zinmanhwa/res/mipmap-xxhdpi/ic_launcher.png similarity index 100% rename from multisrc/overrides/madara/zinmanhwa/res/mipmap-xxhdpi/ic_launcher.png rename to multisrc/overrides/likemanga/zinmanhwa/res/mipmap-xxhdpi/ic_launcher.png diff --git a/multisrc/overrides/madara/zinmanhwa/res/mipmap-xxxhdpi/ic_launcher.png b/multisrc/overrides/likemanga/zinmanhwa/res/mipmap-xxxhdpi/ic_launcher.png similarity index 100% rename from multisrc/overrides/madara/zinmanhwa/res/mipmap-xxxhdpi/ic_launcher.png rename to multisrc/overrides/likemanga/zinmanhwa/res/mipmap-xxxhdpi/ic_launcher.png diff --git a/multisrc/overrides/likemanga/zinmanhwa/src/ZinMangaIO.kt b/multisrc/overrides/likemanga/zinmanhwa/src/ZinMangaIO.kt new file mode 100644 index 000000000..0246b0086 --- /dev/null +++ b/multisrc/overrides/likemanga/zinmanhwa/src/ZinMangaIO.kt @@ -0,0 +1,7 @@ +package eu.kanade.tachiyomi.extension.en.zinmanhwa + +import eu.kanade.tachiyomi.multisrc.likemanga.LikeManga + +class ZinMangaIO : LikeManga("ZinManga.io", "https://zinmanga.io", "en") { + override val versionId = 2 +} diff --git a/multisrc/overrides/madara/zinmanhwa/src/Zinmanhwa.kt b/multisrc/overrides/madara/zinmanhwa/src/Zinmanhwa.kt deleted file mode 100644 index cee727821..000000000 --- a/multisrc/overrides/madara/zinmanhwa/src/Zinmanhwa.kt +++ /dev/null @@ -1,12 +0,0 @@ -package eu.kanade.tachiyomi.extension.en.zinmanhwa - -import eu.kanade.tachiyomi.multisrc.madara.Madara -import java.text.SimpleDateFormat -import java.util.Locale - -class Zinmanhwa : Madara( - "Zinmanhwa", - "https://zinmanga.io", - "en", - dateFormat = SimpleDateFormat("dd/MM/yy", Locale.US), -) diff --git a/src/en/likemanga/src/eu/kanade/tachiyomi/extension/en/likemanga/LikeManga.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/likemanga/LikeManga.kt similarity index 95% rename from src/en/likemanga/src/eu/kanade/tachiyomi/extension/en/likemanga/LikeManga.kt rename to multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/likemanga/LikeManga.kt index dc6547a11..acef8d79b 100644 --- a/src/en/likemanga/src/eu/kanade/tachiyomi/extension/en/likemanga/LikeManga.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/likemanga/LikeManga.kt @@ -1,8 +1,7 @@ -package eu.kanade.tachiyomi.extension.en.likemanga +package eu.kanade.tachiyomi.multisrc.likemanga import android.util.Base64 import eu.kanade.tachiyomi.network.GET -import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.model.Filter import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.MangasPage @@ -25,19 +24,15 @@ import uy.kohesive.injekt.injectLazy import java.text.SimpleDateFormat import java.util.Locale -class LikeManga : ParsedHttpSource() { - - override val name = "LikeManga" - - override val lang = "en" - - override val baseUrl = "https://likemanga.io" +abstract class LikeManga( + override val name: String, + override val baseUrl: String, + override val lang: String, +) : ParsedHttpSource() { override val supportsLatest = true - override val client = network.cloudflareClient.newBuilder() - .rateLimit(1, 2) - .build() + override val client = network.cloudflareClient override fun headersBuilder() = super.headersBuilder() .add("Referer", "$baseUrl/") @@ -189,8 +184,7 @@ class LikeManga : ParsedHttpSource() { val lastPage = document.select("div.chapters_pagination a:not(.next)").last() ?.attr("onclick") - ?.substringAfter("(") - ?.substringBefore(")") + ?.run { chapterPageCountRegex.find(this)?.groupValues?.get(1) } ?.toIntOrNull() ?: return chapters @@ -289,5 +283,6 @@ class LikeManga : ParsedHttpSource() { val dateFormat by lazy { SimpleDateFormat("MMMM dd, yyyy", Locale.ENGLISH) } + private val chapterPageCountRegex = Regex("""load_list_chapter\((\d+)\)""") } } diff --git a/src/en/likemanga/src/eu/kanade/tachiyomi/extension/en/likemanga/LikeMangaFilters.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/likemanga/LikeMangaFilters.kt similarity index 97% rename from src/en/likemanga/src/eu/kanade/tachiyomi/extension/en/likemanga/LikeMangaFilters.kt rename to multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/likemanga/LikeMangaFilters.kt index 21946c782..82ee25472 100644 --- a/src/en/likemanga/src/eu/kanade/tachiyomi/extension/en/likemanga/LikeMangaFilters.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/likemanga/LikeMangaFilters.kt @@ -1,4 +1,4 @@ -package eu.kanade.tachiyomi.extension.en.likemanga +package eu.kanade.tachiyomi.multisrc.likemanga import eu.kanade.tachiyomi.source.model.Filter diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/likemanga/LikeMangaGenerator.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/likemanga/LikeMangaGenerator.kt new file mode 100644 index 000000000..5a51876d6 --- /dev/null +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/likemanga/LikeMangaGenerator.kt @@ -0,0 +1,25 @@ +package eu.kanade.tachiyomi.multisrc.likemanga + +import generator.ThemeSourceData.SingleLang +import generator.ThemeSourceGenerator + +class LikeMangaGenerator : ThemeSourceGenerator { + + override val themePkg = "likemanga" + + override val themeClass = "LikeManga" + + override val baseVersionCode: Int = 1 + + override val sources = listOf( + SingleLang("LikeManga", "https://likemanga.io", "en", className = "LikeMangaIO", pkgName = "likemanga", overrideVersionCode = 3), + SingleLang("ZinManga.io", "https://zinmanga.io", "en", className = "ZinMangaIO", pkgName = "zinmanhwa", overrideVersionCode = 34), + ) + + companion object { + @JvmStatic + fun main(args: Array) { + LikeMangaGenerator().createAll() + } + } +} 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 2616136ba..c883b5098 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 @@ -479,7 +479,6 @@ class MadaraGenerator : ThemeSourceGenerator { SingleLang("Zandy no Fansub", "https://zandynofansub.aishiteru.org", "en"), SingleLang("ZinChanManga", "https://zinchanmanga.net", "en", isNsfw = true, overrideVersionCode = 1), SingleLang("Zinmanga", "https://zinmanga.com", "en", overrideVersionCode = 1), - SingleLang("Zinmanhwa", "https://zinmanga.io", "en", overrideVersionCode = 1), SingleLang("ZuttoManga", "https://zuttomanga.com", "en", overrideVersionCode = 1), SingleLang("Çizgi Roman Arşivi", "https://cizgiromanarsivi.com", "tr", className = "CizgiRomanArsivi"), SingleLang("Detective Conan Ar", "https://manga.detectiveconanar.com", "ar", sourceName = "شبكة كونان العربية", overrideVersionCode = 2), diff --git a/src/en/likemanga/build.gradle b/src/en/likemanga/build.gradle deleted file mode 100644 index 7fd894ad3..000000000 --- a/src/en/likemanga/build.gradle +++ /dev/null @@ -1,7 +0,0 @@ -ext { - extName = 'LikeManga' - extClass = '.LikeManga' - extVersionCode = 3 -} - -apply from: "$rootDir/common.gradle"