tagging manga/manhwa/etc. for md v2's tags

This commit is contained in:
Jays2Kings 2021-03-22 16:36:18 -04:00
parent adf11063b7
commit 31bde4124d
2 changed files with 9 additions and 10 deletions

View File

@ -76,15 +76,13 @@ interface Manga : SManga {
val sourceName = Injekt.get<SourceManager>().getOrStub(source).name val sourceName = Injekt.get<SourceManager>().getOrStub(source).name
val currentTags = val currentTags =
genre?.split(",")?.map { it.trim().toLowerCase(Locale.US) } ?: emptyList() genre?.split(",")?.map { it.trim().toLowerCase(Locale.US) } ?: emptyList()
return if (currentTags.any { tag -> tag.startsWith("japanese") || isMangaTag(tag) }) { return if (currentTags.any { tag -> isMangaTag(tag) }) {
TYPE_MANGA TYPE_MANGA
} else if (currentTags.any { tag -> tag.startsWith("english") || isComicTag(tag) } || } else if (currentTags.any { tag -> isComicTag(tag) } ||
isComicSource(sourceName) isComicSource(sourceName)
) { ) {
TYPE_COMIC TYPE_COMIC
} else if (currentTags.any { tag -> } else if (currentTags.any { tag -> isManhuaTag(tag) } || sourceName.contains("manhua", true)
tag.startsWith("chinese") || isManhuaTag(tag)
} || sourceName.contains("manhua", true)
) { ) {
TYPE_MANHUA TYPE_MANHUA
} else if (currentTags.any { tag -> isManhwaTag(tag) } || isWebtoonSource(sourceName)) { } else if (currentTags.any { tag -> isManhwaTag(tag) } || isWebtoonSource(sourceName)) {
@ -121,19 +119,19 @@ interface Manga : SManga {
} }
fun isMangaTag(tag: String): Boolean { fun isMangaTag(tag: String): Boolean {
return tag in listOf("manga", "манга") return tag in listOf("manga", "манга", "jp") || tag.startsWith("japanese")
} }
fun isManhuaTag(tag: String): Boolean { fun isManhuaTag(tag: String): Boolean {
return tag in listOf("manhua", "маньхуа") return tag in listOf("manhua", "маньхуа", "cn", "hk", "zh-Hans", "zh-Hant") || tag.startsWith("chinese")
} }
fun isManhwaTag(tag: String): Boolean { fun isManhwaTag(tag: String): Boolean {
return tag in listOf("long strip", "manhwa", "манхва") return tag in listOf("long strip", "manhwa", "манхва", "kr") || tag.startsWith("korean")
} }
fun isComicTag(tag: String): Boolean { fun isComicTag(tag: String): Boolean {
return tag in listOf("comic", "комикс") return tag in listOf("comic", "комикс", "en", "gb") || tag.startsWith("english")
} }
fun isWebtoonSource(sourceName: String): Boolean { fun isWebtoonSource(sourceName: String): Boolean {

View File

@ -99,7 +99,8 @@ class MangaDex : DelegatedHttpSource() {
"ir" -> "fa" "ir" -> "fa"
"rs" -> "sh" "rs" -> "sh"
"ua" -> "uk" "ua" -> "uk"
"cn" -> "zh-Hans" "hk" -> "zh-Hant" "cn" -> "zh-Hans"
"hk" -> "zh-Hant"
else -> langCode else -> langCode
} }
} }