Fix search and add filters (#8667)
This commit is contained in:
parent
933e566fba
commit
c19a5c64ce
@ -5,7 +5,7 @@ ext {
|
|||||||
extName = 'Mangahere'
|
extName = 'Mangahere'
|
||||||
pkgNameSuffix = 'en.mangahere'
|
pkgNameSuffix = 'en.mangahere'
|
||||||
extClass = '.Mangahere'
|
extClass = '.Mangahere'
|
||||||
extVersionCode = 16
|
extVersionCode = 17
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,6 +93,10 @@ class Mangahere : ParsedHttpSource() {
|
|||||||
when (filter) {
|
when (filter) {
|
||||||
is TypeList -> url.addEncodedQueryParameter("type", types[filter.values[filter.state]].toString())
|
is TypeList -> url.addEncodedQueryParameter("type", types[filter.values[filter.state]].toString())
|
||||||
is CompletionList -> url.addEncodedQueryParameter("st", filter.state.toString())
|
is CompletionList -> url.addEncodedQueryParameter("st", filter.state.toString())
|
||||||
|
is RatingList -> {
|
||||||
|
url.addEncodedQueryParameter("rating_method", "gt")
|
||||||
|
url.addEncodedQueryParameter("rating", filter.state.toString())
|
||||||
|
}
|
||||||
is GenreList -> {
|
is GenreList -> {
|
||||||
val includeGenres = mutableSetOf<Int>()
|
val includeGenres = mutableSetOf<Int>()
|
||||||
val excludeGenres = mutableSetOf<Int>()
|
val excludeGenres = mutableSetOf<Int>()
|
||||||
@ -105,6 +109,18 @@ class Mangahere : ParsedHttpSource() {
|
|||||||
addEncodedQueryParameter("nogenres", excludeGenres.joinToString(","))
|
addEncodedQueryParameter("nogenres", excludeGenres.joinToString(","))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
is ArtistFilter -> {
|
||||||
|
url.addEncodedQueryParameter("artist_method", "cw")
|
||||||
|
url.addEncodedQueryParameter("artist", filter.state)
|
||||||
|
}
|
||||||
|
is AuthorFilter -> {
|
||||||
|
url.addEncodedQueryParameter("author_method", "cw")
|
||||||
|
url.addEncodedQueryParameter("author", filter.state)
|
||||||
|
}
|
||||||
|
is YearFilter -> {
|
||||||
|
url.addEncodedQueryParameter("released_method", "eq")
|
||||||
|
url.addEncodedQueryParameter("released", filter.state)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,14 +130,6 @@ class Mangahere : ParsedHttpSource() {
|
|||||||
addEncodedQueryParameter("sort", null)
|
addEncodedQueryParameter("sort", null)
|
||||||
addEncodedQueryParameter("stype", 1.toString())
|
addEncodedQueryParameter("stype", 1.toString())
|
||||||
addEncodedQueryParameter("name", null)
|
addEncodedQueryParameter("name", null)
|
||||||
addEncodedQueryParameter("author_method", "cw")
|
|
||||||
addEncodedQueryParameter("author", null)
|
|
||||||
addEncodedQueryParameter("artist_method", "cw")
|
|
||||||
addEncodedQueryParameter("artist", null)
|
|
||||||
addEncodedQueryParameter("rating_method", "eq")
|
|
||||||
addEncodedQueryParameter("rating", null)
|
|
||||||
addEncodedQueryParameter("released_method", "eq")
|
|
||||||
addEncodedQueryParameter("released", null)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return GET(url.toString(), headers)
|
return GET(url.toString(), headers)
|
||||||
@ -316,14 +324,23 @@ class Mangahere : ParsedHttpSource() {
|
|||||||
|
|
||||||
private class Genre(title: String, val id: Int) : Filter.TriState(title)
|
private class Genre(title: String, val id: Int) : Filter.TriState(title)
|
||||||
|
|
||||||
private class TypeList(types: Array<String>) : Filter.Select<String>("Type", types, 0)
|
private class TypeList(types: Array<String>) : Filter.Select<String>("Type", types, 1)
|
||||||
private class CompletionList(completions: Array<String>) : Filter.Select<String>("Completed series", completions, 0)
|
private class CompletionList(completions: Array<String>) : Filter.Select<String>("Completed series", completions, 0)
|
||||||
|
private class RatingList(ratings: Array<String>) : Filter.Select<String>("Minimum rating", ratings, 0)
|
||||||
private class GenreList(genres: List<Genre>) : Filter.Group<Genre>("Genres", genres)
|
private class GenreList(genres: List<Genre>) : Filter.Group<Genre>("Genres", genres)
|
||||||
|
|
||||||
|
private class ArtistFilter(name: String) : Filter.Text(name)
|
||||||
|
private class AuthorFilter(name: String) : Filter.Text(name)
|
||||||
|
private class YearFilter(name: String) : Filter.Text(name)
|
||||||
|
|
||||||
override fun getFilterList() = FilterList(
|
override fun getFilterList() = FilterList(
|
||||||
TypeList(types.keys.toList().sorted().toTypedArray()),
|
TypeList(types.keys.toList().sorted().toTypedArray()),
|
||||||
CompletionList(completions),
|
ArtistFilter("Artist"),
|
||||||
GenreList(genres())
|
AuthorFilter("Author"),
|
||||||
|
GenreList(genres()),
|
||||||
|
RatingList(ratings),
|
||||||
|
YearFilter("Year released"),
|
||||||
|
CompletionList(completions)
|
||||||
)
|
)
|
||||||
|
|
||||||
private val types = hashMapOf(
|
private val types = hashMapOf(
|
||||||
@ -338,6 +355,7 @@ class Mangahere : ParsedHttpSource() {
|
|||||||
)
|
)
|
||||||
|
|
||||||
private val completions = arrayOf("Either", "No", "Yes")
|
private val completions = arrayOf("Either", "No", "Yes")
|
||||||
|
private val ratings = arrayOf("No Stars", "1 Star", "2 Stars", "3 Stars", "4 Stars", "5 Stars")
|
||||||
|
|
||||||
private fun genres() = arrayListOf(
|
private fun genres() = arrayListOf(
|
||||||
Genre("Action", 1),
|
Genre("Action", 1),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user