Make MS into a multilang extension. (#13658)
This commit is contained in:
parent
63f0776018
commit
df7ec63ad7
|
@ -1,12 +0,0 @@
|
||||||
package eu.kanade.tachiyomi.extension.es.miauscan
|
|
||||||
|
|
||||||
import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesia
|
|
||||||
import java.text.SimpleDateFormat
|
|
||||||
import java.util.Locale
|
|
||||||
|
|
||||||
class MiauScan : MangaThemesia(
|
|
||||||
"Miau Scan",
|
|
||||||
"https://miauscan.com",
|
|
||||||
"es",
|
|
||||||
dateFormat = SimpleDateFormat("MMMM dd, yyyy", Locale("es"))
|
|
||||||
)
|
|
|
@ -0,0 +1,71 @@
|
||||||
|
package eu.kanade.tachiyomi.extension.all.miauscan
|
||||||
|
|
||||||
|
import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesia
|
||||||
|
import eu.kanade.tachiyomi.source.SourceFactory
|
||||||
|
import eu.kanade.tachiyomi.source.model.Filter
|
||||||
|
import eu.kanade.tachiyomi.source.model.FilterList
|
||||||
|
import eu.kanade.tachiyomi.source.model.SManga
|
||||||
|
import okhttp3.Request
|
||||||
|
import org.jsoup.nodes.Document
|
||||||
|
import org.jsoup.nodes.Element
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.Locale
|
||||||
|
|
||||||
|
class MiauScanFactory : SourceFactory {
|
||||||
|
override fun createSources() = listOf(
|
||||||
|
MiauScan("es", Filter.TriState.STATE_EXCLUDE),
|
||||||
|
MiauScan("pt-BR", Filter.TriState.STATE_INCLUDE)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
open class MiauScan(lang: String, private val portugueseMode: Int) : MangaThemesia(
|
||||||
|
name = "Miau Scan",
|
||||||
|
baseUrl = "https://miauscan.com",
|
||||||
|
lang = lang,
|
||||||
|
dateFormat = SimpleDateFormat("MMMM dd, yyyy", Locale("es"))
|
||||||
|
) {
|
||||||
|
|
||||||
|
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
||||||
|
val genreFilterIndex = filters.indexOfFirst { it is GenreListFilter }
|
||||||
|
val genreFilter = filters.getOrNull(genreFilterIndex) as? GenreListFilter
|
||||||
|
?: GenreListFilter(emptyList())
|
||||||
|
|
||||||
|
val overloadedGenreFilter = GenreListFilter(
|
||||||
|
genres = genreFilter.state + listOf(
|
||||||
|
Genre("", PORTUGUESE_GENRE, portugueseMode)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
val overloadedFilters = filters.toMutableList().apply {
|
||||||
|
if (genreFilterIndex != -1) {
|
||||||
|
removeAt(genreFilterIndex)
|
||||||
|
}
|
||||||
|
|
||||||
|
add(overloadedGenreFilter)
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.searchMangaRequest(page, query, FilterList(overloadedFilters))
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun searchMangaFromElement(element: Element): SManga {
|
||||||
|
return super.searchMangaFromElement(element).apply {
|
||||||
|
title = title.replace(PORTUGUESE_SUFFIX, "")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun mangaDetailsParse(document: Document): SManga {
|
||||||
|
return super.mangaDetailsParse(document).apply {
|
||||||
|
title = title.replace(PORTUGUESE_SUFFIX, "")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getGenreList(): List<Genre> {
|
||||||
|
return super.getGenreList().filter { it.value != PORTUGUESE_GENRE }
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
const val PORTUGUESE_GENRE = "307"
|
||||||
|
|
||||||
|
val PORTUGUESE_SUFFIX = "^\\(\\s*Portugu[êe]s\\s*\\)\\s*".toRegex(RegexOption.IGNORE_CASE)
|
||||||
|
}
|
||||||
|
}
|
|
@ -363,7 +363,12 @@ abstract class MangaThemesia(
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
protected class Genre(name: String, val value: String) : Filter.TriState(name)
|
protected class Genre(
|
||||||
|
name: String,
|
||||||
|
val value: String,
|
||||||
|
state: Int = STATE_IGNORE
|
||||||
|
) : Filter.TriState(name, state)
|
||||||
|
|
||||||
protected class GenreListFilter(genres: List<Genre>) : Filter.Group<Genre>("Genre", genres)
|
protected class GenreListFilter(genres: List<Genre>) : Filter.Group<Genre>("Genre", genres)
|
||||||
|
|
||||||
private var genrelist: List<Genre>? = null
|
private var genrelist: List<Genre>? = null
|
||||||
|
|
|
@ -17,6 +17,7 @@ class MangaThemesiaGenerator : ThemeSourceGenerator {
|
||||||
MultiLang("Asura Scans", "https://www.asurascans.com", listOf("en", "tr"), className = "AsuraScansFactory", pkgName = "asurascans", overrideVersionCode = 16),
|
MultiLang("Asura Scans", "https://www.asurascans.com", listOf("en", "tr"), className = "AsuraScansFactory", pkgName = "asurascans", overrideVersionCode = 16),
|
||||||
MultiLang("Flame Scans", "https://flamescans.org", listOf("ar", "en"), className = "FlameScansFactory", pkgName = "flamescans", overrideVersionCode = 1),
|
MultiLang("Flame Scans", "https://flamescans.org", listOf("ar", "en"), className = "FlameScansFactory", pkgName = "flamescans", overrideVersionCode = 1),
|
||||||
MultiLang("Komik Lab", "https://komiklab.com", listOf("en", "id"), className = "KomikLabFactory", pkgName = "komiklab", overrideVersionCode = 1),
|
MultiLang("Komik Lab", "https://komiklab.com", listOf("en", "id"), className = "KomikLabFactory", pkgName = "komiklab", overrideVersionCode = 1),
|
||||||
|
MultiLang("Miau Scan", "https://miauscan.com", listOf("es", "pt-BR")),
|
||||||
SingleLang("Ace Scans", "https://acescans.xyz", "en", isNsfw = true, overrideVersionCode = 2),
|
SingleLang("Ace Scans", "https://acescans.xyz", "en", isNsfw = true, overrideVersionCode = 2),
|
||||||
SingleLang("Alpha Scans", "https://alpha-scans.org", "en", overrideVersionCode = 1),
|
SingleLang("Alpha Scans", "https://alpha-scans.org", "en", overrideVersionCode = 1),
|
||||||
SingleLang("Animated Glitched Scans", "https://anigliscans.com", "en"),
|
SingleLang("Animated Glitched Scans", "https://anigliscans.com", "en"),
|
||||||
|
@ -73,7 +74,6 @@ class MangaThemesiaGenerator : ThemeSourceGenerator {
|
||||||
SingleLang("Martial Manga", "https://martialmanga.com", "es"),
|
SingleLang("Martial Manga", "https://martialmanga.com", "es"),
|
||||||
SingleLang("MasterKomik", "https://masterkomik.com", "id", overrideVersionCode = 1),
|
SingleLang("MasterKomik", "https://masterkomik.com", "id", overrideVersionCode = 1),
|
||||||
SingleLang("MELOKOMIK", "https://melokomik.xyz", "id"),
|
SingleLang("MELOKOMIK", "https://melokomik.xyz", "id"),
|
||||||
SingleLang("Miau Scan", "https://miauscan.com", "es"),
|
|
||||||
SingleLang("Mihentai", "https://mihentai.com", "all", isNsfw = true, overrideVersionCode = 1),
|
SingleLang("Mihentai", "https://mihentai.com", "all", isNsfw = true, overrideVersionCode = 1),
|
||||||
SingleLang("Mode Scanlator", "https://modescanlator.com", "pt-BR", overrideVersionCode = 8),
|
SingleLang("Mode Scanlator", "https://modescanlator.com", "pt-BR", overrideVersionCode = 8),
|
||||||
SingleLang("Nekomik", "https://nekomik.com", "id"),
|
SingleLang("Nekomik", "https://nekomik.com", "id"),
|
||||||
|
|
Loading…
Reference in New Issue