Fixed MangaPark filtering (#3459)
* Fixed MangaPark filtering Fixed MangaPark filtering as requested in #3361. Added additional sort options (views last 365/180/90 days). Improved filter URLs by omitting empty/default URL parameters. * Added 8 genre to MangaPark filter All available GenreFilter are in sync with what you can filter for on the MangaPark website.
This commit is contained in:
parent
396c203047
commit
e569048840
@ -5,7 +5,7 @@ ext {
|
||||
appName = 'Tachiyomi: MangaPark'
|
||||
pkgNameSuffix = 'en.mangapark'
|
||||
extClass = '.MangaPark'
|
||||
extVersionCode = 12
|
||||
extVersionCode = 13
|
||||
libVersion = '1.2'
|
||||
}
|
||||
|
||||
|
@ -60,12 +60,16 @@ class MangaPark : ConfigurableSource, ParsedHttpSource() {
|
||||
|
||||
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
||||
val uri = Uri.parse("$baseUrl/search").buildUpon()
|
||||
uri.appendQueryParameter("q", query)
|
||||
if (query.isNotEmpty()) {
|
||||
uri.appendQueryParameter("q", query)
|
||||
}
|
||||
filters.forEach {
|
||||
if (it is UriFilter)
|
||||
it.addToUri(uri)
|
||||
}
|
||||
uri.appendQueryParameter("page", page.toString())
|
||||
if (page != 1) {
|
||||
uri.appendQueryParameter("page", page.toString())
|
||||
}
|
||||
return GET(uri.toString())
|
||||
}
|
||||
|
||||
@ -262,7 +266,9 @@ class MangaPark : ConfigurableSource, ParsedHttpSource() {
|
||||
private class SearchTypeFilter(name: String, val uriParam: String) :
|
||||
Filter.Select<String>(name, STATE_MAP), UriFilter {
|
||||
override fun addToUri(uri: Uri.Builder) {
|
||||
uri.appendQueryParameter(uriParam, STATE_MAP[state])
|
||||
if (STATE_MAP[state] != "contain") {
|
||||
uri.appendQueryParameter(uriParam, STATE_MAP[state])
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
@ -272,7 +278,9 @@ class MangaPark : ConfigurableSource, ParsedHttpSource() {
|
||||
|
||||
private class AuthorArtistText : Filter.Text("Author/Artist"), UriFilter {
|
||||
override fun addToUri(uri: Uri.Builder) {
|
||||
uri.appendQueryParameter("autart", state)
|
||||
if (state.isNotEmpty()) {
|
||||
uri.appendQueryParameter("autart", state)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -297,7 +305,9 @@ class MangaPark : ConfigurableSource, ParsedHttpSource() {
|
||||
GenreFilter("doujinshi", "Doujinshi"),
|
||||
GenreFilter("drama", "Drama"),
|
||||
GenreFilter("ecchi", "Ecchi"),
|
||||
GenreFilter("fan-colored", "Fan colored"),
|
||||
GenreFilter("fantasy", "Fantasy"),
|
||||
GenreFilter("food", "Food"),
|
||||
GenreFilter("full-color", "Full color"),
|
||||
GenreFilter("game", "Game"),
|
||||
GenreFilter("gender-bender", "Gender bender"),
|
||||
@ -316,6 +326,7 @@ class MangaPark : ConfigurableSource, ParsedHttpSource() {
|
||||
GenreFilter("loli", "Loli"),
|
||||
GenreFilter("lolicon", "Lolicon"),
|
||||
GenreFilter("long-strip", "Long strip"),
|
||||
GenreFilter("mafia", "Mafia"),
|
||||
GenreFilter("magic", "Magic"),
|
||||
GenreFilter("magical-girls", "Magical girls"),
|
||||
GenreFilter("manhwa", "Manhwa"),
|
||||
@ -328,6 +339,7 @@ class MangaPark : ConfigurableSource, ParsedHttpSource() {
|
||||
GenreFilter("monsters", "Monsters"),
|
||||
GenreFilter("music", "Music"),
|
||||
GenreFilter("mystery", "Mystery"),
|
||||
GenreFilter("ninja", "Ninja"),
|
||||
GenreFilter("office-workers", "Office workers"),
|
||||
GenreFilter("official-colored", "Official colored"),
|
||||
GenreFilter("one-shot", "One shot"),
|
||||
@ -339,6 +351,7 @@ class MangaPark : ConfigurableSource, ParsedHttpSource() {
|
||||
GenreFilter("reincarnation", "Reincarnation"),
|
||||
GenreFilter("reverse-harem", "Reverse harem"),
|
||||
GenreFilter("romance", "Romance"),
|
||||
GenreFilter("samurai", "Samurai"),
|
||||
GenreFilter("school-life", "School life"),
|
||||
GenreFilter("sci-fi", "Sci fi"),
|
||||
GenreFilter("seinen", "Seinen"),
|
||||
@ -359,11 +372,14 @@ class MangaPark : ConfigurableSource, ParsedHttpSource() {
|
||||
GenreFilter("suspense", "Suspense"),
|
||||
GenreFilter("thriller", "Thriller"),
|
||||
GenreFilter("time-travel", "Time travel"),
|
||||
GenreFilter("toomics", "Toomics"),
|
||||
GenreFilter("traditional-games", "Traditional games"),
|
||||
GenreFilter("tragedy", "Tragedy"),
|
||||
GenreFilter("user-created", "User created"),
|
||||
GenreFilter("vampire", "Vampire"),
|
||||
GenreFilter("vampires", "Vampires"),
|
||||
GenreFilter("video-games", "Video games"),
|
||||
GenreFilter("virtual-reality", "Virtual reality"),
|
||||
GenreFilter("web-comic", "Web comic"),
|
||||
GenreFilter("webtoon", "Webtoon"),
|
||||
GenreFilter("wuxia", "Wuxia"),
|
||||
@ -372,8 +388,15 @@ class MangaPark : ConfigurableSource, ParsedHttpSource() {
|
||||
GenreFilter("zombies", "Zombies")
|
||||
)), UriFilter {
|
||||
override fun addToUri(uri: Uri.Builder) {
|
||||
uri.appendQueryParameter("genres", state.filter { it.isIncluded() }.joinToString(",") { it.uriParam })
|
||||
uri.appendQueryParameter("genres-exclude", state.filter { it.isExcluded() }.joinToString(",") { it.uriParam })
|
||||
val genresParameterValue = state.filter { it.isIncluded() }.joinToString(",") { it.uriParam }
|
||||
if (genresParameterValue.isNotEmpty()) {
|
||||
uri.appendQueryParameter("genres", genresParameterValue)
|
||||
}
|
||||
|
||||
val genresExcludeParameterValue = state.filter { it.isExcluded() }.joinToString(",") { it.uriParam }
|
||||
if (genresExcludeParameterValue.isNotEmpty()) {
|
||||
uri.appendQueryParameter("genres-exclude", genresExcludeParameterValue)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -431,10 +454,13 @@ class MangaPark : ConfigurableSource, ParsedHttpSource() {
|
||||
|
||||
private class SortFilter : UriSelectFilter("Sort", "orderby", arrayOf(
|
||||
Pair("a-z", "A-Z"),
|
||||
Pair("views", "Views"),
|
||||
Pair("views_a", "Views all-time"),
|
||||
Pair("views_y", "Views last 365 days"),
|
||||
Pair("views_s", "Views last 180 days"),
|
||||
Pair("views_t", "Views last 90 days"),
|
||||
Pair("rating", "Rating"),
|
||||
Pair("latest", "Latest"),
|
||||
Pair("add", "New manga")
|
||||
Pair("update", "Latest"),
|
||||
Pair("create", "New manga")
|
||||
), firstIsUnspecified = false, defaultValue = 1)
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user