MangAdventure: sort by views (#10067)
This commit is contained in:
parent
bc39d9ae8f
commit
0e0a8f2bde
@ -29,7 +29,9 @@ abstract class MangAdventure(
|
|||||||
protected open val statuses = arrayOf("Any", "Completed", "Ongoing")
|
protected open val statuses = arrayOf("Any", "Completed", "Ongoing")
|
||||||
|
|
||||||
/** The site's sort order labels that correspond to [SortOrder.values]. */
|
/** The site's sort order labels that correspond to [SortOrder.values]. */
|
||||||
protected open val orders = arrayOf("Title", "Latest upload", "Chapter count")
|
protected open val orders = arrayOf(
|
||||||
|
"Title", "Views", "Latest upload", "Chapter count"
|
||||||
|
)
|
||||||
|
|
||||||
/** A user agent representing Tachiyomi. */
|
/** A user agent representing Tachiyomi. */
|
||||||
private val userAgent = "Mozilla/5.0 " +
|
private val userAgent = "Mozilla/5.0 " +
|
||||||
@ -61,7 +63,7 @@ abstract class MangAdventure(
|
|||||||
override fun popularMangaRequest(page: Int) =
|
override fun popularMangaRequest(page: Int) =
|
||||||
apiUri.buildUpon().appendEncodedPath("series").run {
|
apiUri.buildUpon().appendEncodedPath("series").run {
|
||||||
appendQueryParameter("page", page.toString())
|
appendQueryParameter("page", page.toString())
|
||||||
appendQueryParameter("sort", "-chapter_count")
|
appendQueryParameter("sort", "-views")
|
||||||
GET(toString(), headers)
|
GET(toString(), headers)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,15 +74,8 @@ abstract class MangAdventure(
|
|||||||
} else {
|
} else {
|
||||||
appendQueryParameter("page", page.toString())
|
appendQueryParameter("page", page.toString())
|
||||||
appendQueryParameter("title", query)
|
appendQueryParameter("title", query)
|
||||||
filters.forEach {
|
filters.filterIsInstance<UriFilter>().forEach {
|
||||||
when (it) {
|
appendQueryParameter(it.param, it.toString())
|
||||||
is Author -> appendQueryParameter("author", it.toString())
|
|
||||||
is Artist -> appendQueryParameter("artist", it.toString())
|
|
||||||
is Status -> appendQueryParameter("status", it.toString())
|
|
||||||
is SortOrder -> appendQueryParameter("sort", it.toString())
|
|
||||||
is CategoryList -> appendQueryParameter("categories", it.toString())
|
|
||||||
else -> Unit
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GET(toString(), headers)
|
GET(toString(), headers)
|
||||||
@ -96,6 +91,7 @@ abstract class MangAdventure(
|
|||||||
override fun pageListRequest(chapter: SChapter) =
|
override fun pageListRequest(chapter: SChapter) =
|
||||||
apiUri.buildUpon().appendEncodedPath("pages").run {
|
apiUri.buildUpon().appendEncodedPath("pages").run {
|
||||||
val (slug, vol, num) = chapter.components
|
val (slug, vol, num) = chapter.components
|
||||||
|
appendQueryParameter("track", "true")
|
||||||
appendQueryParameter("series", slug)
|
appendQueryParameter("series", slug)
|
||||||
appendQueryParameter("volume", vol)
|
appendQueryParameter("volume", vol)
|
||||||
appendQueryParameter("number", num)
|
appendQueryParameter("number", num)
|
||||||
@ -176,11 +172,15 @@ abstract class MangAdventure(
|
|||||||
url = series.url
|
url = series.url
|
||||||
title = series.title
|
title = series.title
|
||||||
thumbnail_url = series.cover
|
thumbnail_url = series.cover
|
||||||
description = series.description
|
description = series.description?.plus(
|
||||||
|
series.aliases?.joinToString("\n", "\n\nAlternative titles:\n")
|
||||||
|
)
|
||||||
author = series.authors?.joinToString()
|
author = series.authors?.joinToString()
|
||||||
artist = series.artists?.joinToString()
|
artist = series.artists?.joinToString()
|
||||||
genre = series.categories?.joinToString()
|
genre = series.categories?.joinToString()
|
||||||
status = when (series.completed) {
|
status = if (series.licensed == true) {
|
||||||
|
SManga.LICENSED
|
||||||
|
} else when (series.completed) {
|
||||||
true -> SManga.COMPLETED
|
true -> SManga.COMPLETED
|
||||||
false -> SManga.ONGOING
|
false -> SManga.ONGOING
|
||||||
null -> SManga.UNKNOWN
|
null -> SManga.UNKNOWN
|
||||||
|
@ -56,6 +56,8 @@ internal data class Series(
|
|||||||
val cover: String?,
|
val cover: String?,
|
||||||
val description: String? = null,
|
val description: String? = null,
|
||||||
val completed: Boolean? = null,
|
val completed: Boolean? = null,
|
||||||
|
val licensed: Boolean? = null,
|
||||||
|
val aliases: List<String>? = null,
|
||||||
val authors: List<String>? = null,
|
val authors: List<String>? = null,
|
||||||
val artists: List<String>? = null,
|
val artists: List<String>? = null,
|
||||||
val categories: List<String>? = null
|
val categories: List<String>? = null
|
||||||
|
@ -2,13 +2,23 @@ package eu.kanade.tachiyomi.multisrc.mangadventure
|
|||||||
|
|
||||||
import eu.kanade.tachiyomi.source.model.Filter
|
import eu.kanade.tachiyomi.source.model.Filter
|
||||||
|
|
||||||
|
internal interface UriFilter {
|
||||||
|
val param: String
|
||||||
|
|
||||||
|
override fun toString(): String
|
||||||
|
}
|
||||||
|
|
||||||
/** Filter representing the name of an author. */
|
/** Filter representing the name of an author. */
|
||||||
internal class Author : Filter.Text("Author") {
|
internal class Author : Filter.Text("Author"), UriFilter {
|
||||||
|
override val param = "author"
|
||||||
|
|
||||||
override fun toString() = state
|
override fun toString() = state
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Filter representing the name of an artist. */
|
/** Filter representing the name of an artist. */
|
||||||
internal class Artist : Filter.Text("Artist") {
|
internal class Artist : Filter.Text("Artist"), UriFilter {
|
||||||
|
override val param = "artist"
|
||||||
|
|
||||||
override fun toString() = state
|
override fun toString() = state
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -19,7 +29,9 @@ internal class Artist : Filter.Text("Artist") {
|
|||||||
*/
|
*/
|
||||||
internal class SortOrder(
|
internal class SortOrder(
|
||||||
private val labels: Array<String>
|
private val labels: Array<String>
|
||||||
) : Filter.Sort("Sort", values, null) {
|
) : Filter.Sort("Sort", values, null), UriFilter {
|
||||||
|
override val param = "sort"
|
||||||
|
|
||||||
override fun toString() = when (state?.ascending) {
|
override fun toString() = when (state?.ascending) {
|
||||||
null -> ""
|
null -> ""
|
||||||
true -> labels[state!!.index]
|
true -> labels[state!!.index]
|
||||||
@ -28,7 +40,9 @@ internal class SortOrder(
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
/** The available sort order values. */
|
/** The available sort order values. */
|
||||||
private val values = arrayOf("title", "latest_upload", "chapter_count")
|
private val values = arrayOf(
|
||||||
|
"title", "views", "latest_upload", "chapter_count"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,7 +53,9 @@ internal class SortOrder(
|
|||||||
*/
|
*/
|
||||||
internal class Status(
|
internal class Status(
|
||||||
statuses: Array<String>
|
statuses: Array<String>
|
||||||
) : Filter.Select<String>("Status", statuses) {
|
) : Filter.Select<String>("Status", statuses), UriFilter {
|
||||||
|
override val param = "status"
|
||||||
|
|
||||||
override fun toString() = values[state]
|
override fun toString() = values[state]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,7 +73,9 @@ internal class Category(name: String) : Filter.TriState(name)
|
|||||||
*/
|
*/
|
||||||
internal class CategoryList(
|
internal class CategoryList(
|
||||||
categories: List<String>
|
categories: List<String>
|
||||||
) : Filter.Group<Category>("Categories", categories.map(::Category)) {
|
) : Filter.Group<Category>("Categories", categories.map(::Category)), UriFilter {
|
||||||
|
override val param = "categories"
|
||||||
|
|
||||||
override fun toString() = state.filterNot { it.isIgnored() }
|
override fun toString() = state.filterNot { it.isIgnored() }
|
||||||
.joinToString(",") { if (it.isIncluded()) it.name else "-" + it.name }
|
.joinToString(",") { if (it.isIncluded()) it.name else "-" + it.name }
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ class MangAdventureGenerator : ThemeSourceGenerator {
|
|||||||
|
|
||||||
override val themeClass = "MangAdventure"
|
override val themeClass = "MangAdventure"
|
||||||
|
|
||||||
override val baseVersionCode = 6
|
override val baseVersionCode = 7
|
||||||
|
|
||||||
override val sources = listOf(
|
override val sources = listOf(
|
||||||
SingleLang("Arc-Relight", "https://arc-relight.com", "en", className = "ArcRelight"),
|
SingleLang("Arc-Relight", "https://arc-relight.com", "en", className = "ArcRelight"),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user