Tri-state genre filtering for Batoto (#5618)
* Tri-state genre filtering for Batoto * include or exclude genres * Fixes typo for Harlequin genre * Update build.gradle * Cleaner genre filter list syntax - batoto
This commit is contained in:
parent
8c66a35f27
commit
771f65d7e9
|
@ -5,7 +5,7 @@ ext {
|
|||
extName = 'Bato.to'
|
||||
pkgNameSuffix = 'all.batoto'
|
||||
extClass = '.BatoToFactory'
|
||||
extVersionCode = 3
|
||||
extVersionCode = 4
|
||||
libVersion = '1.2'
|
||||
containsNsfw = true
|
||||
}
|
||||
|
|
|
@ -92,16 +92,21 @@ open class BatoTo(
|
|||
}
|
||||
}
|
||||
is GenreFilter -> {
|
||||
val genreToInclude = mutableListOf<String>()
|
||||
filter.state.forEach { content ->
|
||||
if (content.state) {
|
||||
genreToInclude.add(content.name)
|
||||
}
|
||||
}
|
||||
if (genreToInclude.isNotEmpty()) {
|
||||
val genreToInclude = filter.state
|
||||
.filter { it.isIncluded() }
|
||||
.map { it.name }
|
||||
|
||||
val genreToExclude = filter.state
|
||||
.filter { it.isExcluded() }
|
||||
.map { it.name }
|
||||
|
||||
if (genreToInclude.isNotEmpty() || genreToExclude.isNotEmpty()) {
|
||||
url.addQueryParameter(
|
||||
"genres",
|
||||
genreToInclude
|
||||
.joinToString(",") +
|
||||
"|" +
|
||||
genreToExclude
|
||||
.joinToString(",")
|
||||
)
|
||||
}
|
||||
|
@ -298,8 +303,7 @@ open class BatoTo(
|
|||
override fun imageUrlParse(document: Document): String = throw UnsupportedOperationException("Not used")
|
||||
|
||||
private class OriginFilter(genres: List<Tag>) : Filter.Group<Tag>("Origin", genres)
|
||||
private class GenreFilter(genres: List<Tag>) : Filter.Group<Tag>("Genres", genres)
|
||||
|
||||
private class GenreFilter(genres: List<Genre>) : Filter.Group<Genre>("Genres", genres)
|
||||
|
||||
private class ChapterFilter : UriPartFilter(
|
||||
"Chapters",
|
||||
|
@ -383,111 +387,111 @@ open class BatoTo(
|
|||
)
|
||||
|
||||
private fun getGenreList() = listOf(
|
||||
Tag("Artbook"),
|
||||
Tag("Cartoon"),
|
||||
Tag("Comic"),
|
||||
Tag("Doujinshi"),
|
||||
Tag("Imageset"),
|
||||
Tag("Manga"),
|
||||
Tag("Manhua"),
|
||||
Tag("Manhwa"),
|
||||
Tag("Webtoon"),
|
||||
Tag("Western"),
|
||||
Tag("Josei"),
|
||||
Tag("Seinen"),
|
||||
Tag("Shoujo"),
|
||||
Tag("Shoujo_Ai"),
|
||||
Tag("Shounen"),
|
||||
Tag("Shounen_Ai"),
|
||||
Tag("Yaoi"),
|
||||
Tag("Yuri"),
|
||||
Tag("Ecchi"),
|
||||
Tag("Mature"),
|
||||
Tag("Adult"),
|
||||
Tag("Gore"),
|
||||
Tag("Violence"),
|
||||
Tag("Smut"),
|
||||
Tag("Hentai"),
|
||||
Tag("4_Koma"),
|
||||
Tag("Action"),
|
||||
Tag("Adaptation"),
|
||||
Tag("Adventure"),
|
||||
Tag("Aliens"),
|
||||
Tag("Animals"),
|
||||
Tag("Anthology"),
|
||||
Tag("Comedy"),
|
||||
Tag("Cooking"),
|
||||
Tag("Crime"),
|
||||
Tag("Crossdressing"),
|
||||
Tag("Delinquents"),
|
||||
Tag("Dementia"),
|
||||
Tag("Demons"),
|
||||
Tag("Drama"),
|
||||
Tag("Fantasy"),
|
||||
Tag("Fan_Colored"),
|
||||
Tag("Full_Color"),
|
||||
Tag("Game"),
|
||||
Tag("Gender_Bender"),
|
||||
Tag("Genderswap"),
|
||||
Tag("Ghosts"),
|
||||
Tag("Gyaru"),
|
||||
Tag("Harem"),
|
||||
Tag("Halequin"),
|
||||
Tag("Historical"),
|
||||
Tag("Horror"),
|
||||
Tag("Incest"),
|
||||
Tag("Isekai"),
|
||||
Tag("Kids"),
|
||||
Tag("Loli"),
|
||||
Tag("Lolicon"),
|
||||
Tag("Magic"),
|
||||
Tag("Magical_Girls"),
|
||||
Tag("Martial_Arts"),
|
||||
Tag("Mecha"),
|
||||
Tag("Medical"),
|
||||
Tag("Military"),
|
||||
Tag("Monster_Girls"),
|
||||
Tag("Monsters"),
|
||||
Tag("Music"),
|
||||
Tag("Mystery"),
|
||||
Tag("Netorare"),
|
||||
Tag("Ninja"),
|
||||
Tag("Office_Workers"),
|
||||
Tag("Oneshot"),
|
||||
Tag("Parody"),
|
||||
Tag("Philosophical"),
|
||||
Tag("Police"),
|
||||
Tag("Post_Apocalyptic"),
|
||||
Tag("Psychological"),
|
||||
Tag("Reincarnation"),
|
||||
Tag("Reverse_Harem"),
|
||||
Tag("Romance"),
|
||||
Tag("Samurai"),
|
||||
Tag("School_Life"),
|
||||
Tag("Sci_Fi"),
|
||||
Tag("Shota"),
|
||||
Tag("Shotacon"),
|
||||
Tag("Slice_Of_Life"),
|
||||
Tag("SM_BDSM"),
|
||||
Tag("Space"),
|
||||
Tag("Sports"),
|
||||
Tag("Super_Power"),
|
||||
Tag("Superhero"),
|
||||
Tag("Supernatural"),
|
||||
Tag("Survival"),
|
||||
Tag("Thriller"),
|
||||
Tag("Time_Travel"),
|
||||
Tag("Tragedy"),
|
||||
Tag("Vampires"),
|
||||
Tag("Video_Games"),
|
||||
Tag("Virtual_Reality"),
|
||||
Tag("Wuxia"),
|
||||
Tag("Xianxia"),
|
||||
Tag("Xuanhuan"),
|
||||
Tag("Zombies"),
|
||||
Tag("award_winning"),
|
||||
Tag("youkai"),
|
||||
Tag("uncategorized")
|
||||
Genre("Artbook"),
|
||||
Genre("Cartoon"),
|
||||
Genre("Comic"),
|
||||
Genre("Doujinshi"),
|
||||
Genre("Imageset"),
|
||||
Genre("Manga"),
|
||||
Genre("Manhua"),
|
||||
Genre("Manhwa"),
|
||||
Genre("Webtoon"),
|
||||
Genre("Western"),
|
||||
Genre("Josei"),
|
||||
Genre("Seinen"),
|
||||
Genre("Shoujo"),
|
||||
Genre("Shoujo_Ai"),
|
||||
Genre("Shounen"),
|
||||
Genre("Shounen_Ai"),
|
||||
Genre("Yaoi"),
|
||||
Genre("Yuri"),
|
||||
Genre("Ecchi"),
|
||||
Genre("Mature"),
|
||||
Genre("Adult"),
|
||||
Genre("Gore"),
|
||||
Genre("Violence"),
|
||||
Genre("Smut"),
|
||||
Genre("Hentai"),
|
||||
Genre("4_Koma"),
|
||||
Genre("Action"),
|
||||
Genre("Adaptation"),
|
||||
Genre("Adventure"),
|
||||
Genre("Aliens"),
|
||||
Genre("Animals"),
|
||||
Genre("Anthology"),
|
||||
Genre("Comedy"),
|
||||
Genre("Cooking"),
|
||||
Genre("Crime"),
|
||||
Genre("Crossdressing"),
|
||||
Genre("Delinquents"),
|
||||
Genre("Dementia"),
|
||||
Genre("Demons"),
|
||||
Genre("Drama"),
|
||||
Genre("Fantasy"),
|
||||
Genre("Fan_Colored"),
|
||||
Genre("Full_Color"),
|
||||
Genre("Game"),
|
||||
Genre("Gender_Bender"),
|
||||
Genre("Genderswap"),
|
||||
Genre("Ghosts"),
|
||||
Genre("Gyaru"),
|
||||
Genre("Harem"),
|
||||
Genre("Harlequin"),
|
||||
Genre("Historical"),
|
||||
Genre("Horror"),
|
||||
Genre("Incest"),
|
||||
Genre("Isekai"),
|
||||
Genre("Kids"),
|
||||
Genre("Loli"),
|
||||
Genre("Lolicon"),
|
||||
Genre("Magic"),
|
||||
Genre("Magical_Girls"),
|
||||
Genre("Martial_Arts"),
|
||||
Genre("Mecha"),
|
||||
Genre("Medical"),
|
||||
Genre("Military"),
|
||||
Genre("Monster_Girls"),
|
||||
Genre("Monsters"),
|
||||
Genre("Music"),
|
||||
Genre("Mystery"),
|
||||
Genre("Netorare"),
|
||||
Genre("Ninja"),
|
||||
Genre("Office_Workers"),
|
||||
Genre("Oneshot"),
|
||||
Genre("Parody"),
|
||||
Genre("Philosophical"),
|
||||
Genre("Police"),
|
||||
Genre("Post_Apocalyptic"),
|
||||
Genre("Psychological"),
|
||||
Genre("Reincarnation"),
|
||||
Genre("Reverse_Harem"),
|
||||
Genre("Romance"),
|
||||
Genre("Samurai"),
|
||||
Genre("School_Life"),
|
||||
Genre("Sci_Fi"),
|
||||
Genre("Shota"),
|
||||
Genre("Shotacon"),
|
||||
Genre("Slice_Of_Life"),
|
||||
Genre("SM_BDSM"),
|
||||
Genre("Space"),
|
||||
Genre("Sports"),
|
||||
Genre("Super_Power"),
|
||||
Genre("Superhero"),
|
||||
Genre("Supernatural"),
|
||||
Genre("Survival"),
|
||||
Genre("Thriller"),
|
||||
Genre("Time_Travel"),
|
||||
Genre("Tragedy"),
|
||||
Genre("Vampires"),
|
||||
Genre("Video_Games"),
|
||||
Genre("Virtual_Reality"),
|
||||
Genre("Wuxia"),
|
||||
Genre("Xianxia"),
|
||||
Genre("Xuanhuan"),
|
||||
Genre("Zombies"),
|
||||
Genre("award_winning"),
|
||||
Genre("youkai"),
|
||||
Genre("uncategorized")
|
||||
)
|
||||
|
||||
private open class UriPartFilter(displayName: String, val vals: Array<Pair<String, String>>) :
|
||||
|
@ -496,4 +500,5 @@ open class BatoTo(
|
|||
}
|
||||
|
||||
private class Tag(name: String) : Filter.CheckBox(name)
|
||||
private class Genre(name: String) : Filter.TriState(name)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue