Fix Mangaowl search url building (#8570)
* Fix search url building * Update version
This commit is contained in:
parent
cce0c70265
commit
5edfbb5354
|
@ -5,7 +5,7 @@ ext {
|
||||||
extName = 'MangaOwl'
|
extName = 'MangaOwl'
|
||||||
pkgNameSuffix = 'en.mangaowl'
|
pkgNameSuffix = 'en.mangaowl'
|
||||||
extClass = '.MangaOwl'
|
extClass = '.MangaOwl'
|
||||||
extVersionCode = 21
|
extVersionCode = 22
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -90,13 +90,18 @@ class MangaOwl : ParsedHttpSource() {
|
||||||
|
|
||||||
filters.forEach { filter ->
|
filters.forEach { filter ->
|
||||||
when (filter) {
|
when (filter) {
|
||||||
is SearchFilter -> url.addQueryParameter("search_field", filter.toUriPart())
|
is SearchFieldFilter -> {
|
||||||
|
val fields = filter.state
|
||||||
|
.filter { it.state }
|
||||||
|
.joinToString("") { it.uriPart }
|
||||||
|
url.addQueryParameter("search_field", fields)
|
||||||
|
}
|
||||||
is SortFilter -> url.addQueryParameter("sort", filter.toUriPart())
|
is SortFilter -> url.addQueryParameter("sort", filter.toUriPart())
|
||||||
is StatusFilter -> url.addQueryParameter("completed", filter.toUriPart())
|
is StatusFilter -> url.addQueryParameter("completed", filter.toUriPart())
|
||||||
is GenreFilter -> {
|
is GenreFilter -> {
|
||||||
val genres = filter.state
|
val genres = filter.state
|
||||||
.filter { it.state }
|
.filter { it.state }
|
||||||
.joinToString(".") { it.uriPart }
|
.joinToString(",") { it.uriPart }
|
||||||
url.addQueryParameter("genres", genres)
|
url.addQueryParameter("genres", genres)
|
||||||
}
|
}
|
||||||
is MinChapterFilter -> url.addQueryParameter("chapter_from", filter.state)
|
is MinChapterFilter -> url.addQueryParameter("chapter_from", filter.state)
|
||||||
|
@ -181,7 +186,7 @@ class MangaOwl : ParsedHttpSource() {
|
||||||
// Filters
|
// Filters
|
||||||
|
|
||||||
override fun getFilterList() = FilterList(
|
override fun getFilterList() = FilterList(
|
||||||
SearchFilter(),
|
SearchFieldFilter(getSearchFields()),
|
||||||
SortFilter(),
|
SortFilter(),
|
||||||
StatusFilter(),
|
StatusFilter(),
|
||||||
GenreFilter(getGenreList()),
|
GenreFilter(getGenreList()),
|
||||||
|
@ -196,16 +201,6 @@ class MangaOwl : ParsedHttpSource() {
|
||||||
fun toUriPart() = vals[state].second
|
fun toUriPart() = vals[state].second
|
||||||
}
|
}
|
||||||
|
|
||||||
private class SearchFilter : UriPartFilter(
|
|
||||||
"Search in",
|
|
||||||
arrayOf(
|
|
||||||
Pair("Manga title", "1"),
|
|
||||||
Pair("Authors", "2"),
|
|
||||||
Pair("Description", "3"),
|
|
||||||
Pair("All", "123")
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
private class SortFilter : UriPartFilter(
|
private class SortFilter : UriPartFilter(
|
||||||
"Sort by",
|
"Sort by",
|
||||||
arrayOf(
|
arrayOf(
|
||||||
|
@ -339,6 +334,15 @@ class MangaOwl : ParsedHttpSource() {
|
||||||
Genre("Zombies", "108")
|
Genre("Zombies", "108")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
private class SearchField(name: String, state: Boolean, val uriPart: String) : Filter.CheckBox(name, state)
|
||||||
|
private class SearchFieldFilter(fields: List<SearchField>) : Filter.Group<SearchField>("Search in", fields)
|
||||||
|
|
||||||
|
private fun getSearchFields() = listOf(
|
||||||
|
SearchField("Manga title", true, "1"),
|
||||||
|
SearchField("Authors", true, "2"),
|
||||||
|
SearchField("Description", false, "3")
|
||||||
|
)
|
||||||
|
|
||||||
private class MinChapterFilter : Filter.Text("Minimum Chapters")
|
private class MinChapterFilter : Filter.Text("Minimum Chapters")
|
||||||
private class MaxChapterFilter : Filter.Text("Maximum Chapters")
|
private class MaxChapterFilter : Filter.Text("Maximum Chapters")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue