Merge pull request #448 from arkon/fix-mangadex-genre-search
Fix searching with only genres in MangaDex (closes #444)
This commit is contained in:
commit
911ab35dff
|
@ -5,8 +5,8 @@ ext {
|
||||||
appName = 'Tachiyomi: MangaDex'
|
appName = 'Tachiyomi: MangaDex'
|
||||||
pkgNameSuffix = 'all.mangadex'
|
pkgNameSuffix = 'all.mangadex'
|
||||||
extClass = '.MangadexFactory'
|
extClass = '.MangadexFactory'
|
||||||
extVersionCode = 34
|
extVersionCode = 35
|
||||||
extVersionSuffix = 34
|
extVersionSuffix = 35
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -249,8 +249,9 @@ open class Mangadex(override val lang: String, private val internalLang: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
val genres = mutableListOf<String>()
|
val genres = mutableListOf<String>()
|
||||||
|
val genreList = getGenreList()
|
||||||
mangaJson.get("genres").asJsonArray.forEach { id ->
|
mangaJson.get("genres").asJsonArray.forEach { id ->
|
||||||
GENRE_LIST.find { it -> it.id == id.string }?.let { genre ->
|
genreList.find { it -> it.id == id.string }?.let { genre ->
|
||||||
genres.add(genre.name)
|
genres.add(genre.name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -424,39 +425,10 @@ open class Mangadex(override val lang: String, private val internalLang: String,
|
||||||
R18(),
|
R18(),
|
||||||
Demographic(),
|
Demographic(),
|
||||||
OriginalLanguage(),
|
OriginalLanguage(),
|
||||||
GenreList(GENRE_LIST)
|
GenreList(getGenreList())
|
||||||
)
|
)
|
||||||
|
|
||||||
companion object {
|
private fun getGenreList() =listOf(
|
||||||
private val WHITESPACE_REGEX = "\\s".toRegex()
|
|
||||||
|
|
||||||
// This number matches to the cookie
|
|
||||||
private const val NO_R18 = 0
|
|
||||||
private const val ALL = 1
|
|
||||||
private const val ONLY_R18 = 2
|
|
||||||
|
|
||||||
private const val SHOW_R18_PREF_Title = "Default R18 Setting"
|
|
||||||
private const val SHOW_R18_PREF = "showR18Default"
|
|
||||||
|
|
||||||
private const val API_MANGA = "/api/manga/"
|
|
||||||
private const val API_CHAPTER = "/api/chapter/"
|
|
||||||
|
|
||||||
private val SOURCE_LANG_LIST = listOf(
|
|
||||||
Pair("All", "0"),
|
|
||||||
Pair("Japanese", "2"),
|
|
||||||
Pair("English", "1"),
|
|
||||||
Pair("Polish", "3"),
|
|
||||||
Pair("German", "8"),
|
|
||||||
Pair("French", "10"),
|
|
||||||
Pair("Vietnamese", "12"),
|
|
||||||
Pair("Chinese", "21"),
|
|
||||||
Pair("Indonesian", "27"),
|
|
||||||
Pair("Korean", "28"),
|
|
||||||
Pair("Spanish (LATAM)", "29"),
|
|
||||||
Pair("Thai", "32"),
|
|
||||||
Pair("Filipino", "34")
|
|
||||||
)
|
|
||||||
private val GENRE_LIST = listOf(
|
|
||||||
Genre("1", "4-koma"),
|
Genre("1", "4-koma"),
|
||||||
Genre("2", "Action"),
|
Genre("2", "Action"),
|
||||||
Genre("3", "Adventure"),
|
Genre("3", "Adventure"),
|
||||||
|
@ -498,6 +470,35 @@ open class Mangadex(override val lang: String, private val internalLang: String,
|
||||||
Genre("39", "[no chapters]"),
|
Genre("39", "[no chapters]"),
|
||||||
Genre("40", "Game"),
|
Genre("40", "Game"),
|
||||||
Genre("41", "Isekai"))
|
Genre("41", "Isekai"))
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private val WHITESPACE_REGEX = "\\s".toRegex()
|
||||||
|
|
||||||
|
// This number matches to the cookie
|
||||||
|
private const val NO_R18 = 0
|
||||||
|
private const val ALL = 1
|
||||||
|
private const val ONLY_R18 = 2
|
||||||
|
|
||||||
|
private const val SHOW_R18_PREF_Title = "Default R18 Setting"
|
||||||
|
private const val SHOW_R18_PREF = "showR18Default"
|
||||||
|
|
||||||
|
private const val API_MANGA = "/api/manga/"
|
||||||
|
private const val API_CHAPTER = "/api/chapter/"
|
||||||
|
|
||||||
|
private val SOURCE_LANG_LIST = listOf(
|
||||||
|
Pair("All", "0"),
|
||||||
|
Pair("Japanese", "2"),
|
||||||
|
Pair("English", "1"),
|
||||||
|
Pair("Polish", "3"),
|
||||||
|
Pair("German", "8"),
|
||||||
|
Pair("French", "10"),
|
||||||
|
Pair("Vietnamese", "12"),
|
||||||
|
Pair("Chinese", "21"),
|
||||||
|
Pair("Indonesian", "27"),
|
||||||
|
Pair("Korean", "28"),
|
||||||
|
Pair("Spanish (LATAM)", "29"),
|
||||||
|
Pair("Thai", "32"),
|
||||||
|
Pair("Filipino", "34"))
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue