Merge remote-tracking branch 'origin/SortOrderPopularitytime' into feature/advanced_filter
This commit is contained in:
@@ -14,4 +14,9 @@ enum class SortOrder {
|
||||
ADDED,
|
||||
ADDED_ASC,
|
||||
RELEVANCE,
|
||||
POPULARITY_HOUR,
|
||||
POPULARITY_TODAY,
|
||||
POPULARITY_WEEK,
|
||||
POPULARITY_MONTH,
|
||||
POPULARITY_YEAR,
|
||||
}
|
||||
|
||||
@@ -53,6 +53,11 @@ internal class BatoToParser(context: MangaLoaderContext) : PagedMangaParser(
|
||||
SortOrder.UPDATED,
|
||||
SortOrder.POPULARITY,
|
||||
SortOrder.ALPHABETICAL,
|
||||
SortOrder.POPULARITY_YEAR,
|
||||
SortOrder.POPULARITY_MONTH,
|
||||
SortOrder.POPULARITY_WEEK,
|
||||
SortOrder.POPULARITY_TODAY,
|
||||
SortOrder.POPULARITY_HOUR,
|
||||
)
|
||||
|
||||
override val availableStates: Set<MangaState> = EnumSet.allOf(MangaState::class.java)
|
||||
@@ -108,6 +113,11 @@ internal class BatoToParser(context: MangaLoaderContext) : PagedMangaParser(
|
||||
SortOrder.POPULARITY -> append("views_a.za")
|
||||
SortOrder.NEWEST -> append("create.za")
|
||||
SortOrder.ALPHABETICAL -> append("title.az")
|
||||
SortOrder.POPULARITY_YEAR -> append("views_y.za")
|
||||
SortOrder.POPULARITY_MONTH -> append("views_m.za")
|
||||
SortOrder.POPULARITY_WEEK -> append("views_w.za")
|
||||
SortOrder.POPULARITY_TODAY -> append("views_d.za")
|
||||
SortOrder.POPULARITY_HOUR -> append("views_h.za")
|
||||
else -> append("update.za")
|
||||
}
|
||||
|
||||
|
||||
@@ -108,6 +108,7 @@ internal class MangaDexParser(context: MangaLoaderContext) : MangaParser(context
|
||||
SortOrder.ADDED -> "[createdAt]=desc"
|
||||
SortOrder.ADDED_ASC -> "[createdAt]=asc"
|
||||
SortOrder.RELEVANCE -> "&order[relevance]=desc"
|
||||
else -> "[latestUploadedChapter]=desc"
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ internal class NHentaiParser(context: MangaLoaderContext) :
|
||||
".tag-container:contains(Languages:) span.tags a:not(.tag-17249) span.name" // tag-17249 = translated
|
||||
override val idImg = "image-container"
|
||||
|
||||
override val availableSortOrders: Set<SortOrder> = EnumSet.of(SortOrder.UPDATED, SortOrder.POPULARITY)
|
||||
override val availableSortOrders: Set<SortOrder> = EnumSet.of(SortOrder.UPDATED, SortOrder.POPULARITY, SortOrder.POPULARITY_TODAY, SortOrder.POPULARITY_WEEK)
|
||||
|
||||
override val isMultipleTagsSupported = true
|
||||
|
||||
@@ -57,48 +57,24 @@ internal class NHentaiParser(context: MangaLoaderContext) :
|
||||
}
|
||||
|
||||
is MangaListFilter.Advanced -> {
|
||||
if (filter.tags.size > 1 || (filter.tags.isNotEmpty() && filter.locale != null)) {
|
||||
append("/search/?q=")
|
||||
append(buildQuery(filter.tags, filter.locale).urlEncoded())
|
||||
if (filter.sortOrder == SortOrder.POPULARITY) {
|
||||
append("&sort=popular")
|
||||
}
|
||||
append("&")
|
||||
} else if (filter.tags.isNotEmpty()) {
|
||||
filter.tags.oneOrThrowIfMany()?.let {
|
||||
append("/tag/")
|
||||
append(it.key)
|
||||
}
|
||||
append("/")
|
||||
if (filter.sortOrder == SortOrder.POPULARITY) {
|
||||
append("popular")
|
||||
}
|
||||
if (page > 1) {
|
||||
append("?")
|
||||
}
|
||||
} else if (filter.locale != null) {
|
||||
append("/language/")
|
||||
append(filter.locale.toLanguagePath())
|
||||
append("/")
|
||||
if (filter.sortOrder == SortOrder.POPULARITY) {
|
||||
append("popular")
|
||||
}
|
||||
if (page > 1) {
|
||||
append("?")
|
||||
}
|
||||
} else {
|
||||
if (filter.sortOrder == SortOrder.POPULARITY) {
|
||||
append("/?sort=popular&")
|
||||
} else {
|
||||
append("/?")
|
||||
}
|
||||
append("/search/?q=pages:>0 ")
|
||||
// for Search with query
|
||||
// append(filter.query.urlEncoded())
|
||||
// append(' ')
|
||||
append(buildQuery(filter.tags, filter.locale).urlEncoded())
|
||||
when (filter.sortOrder) {
|
||||
SortOrder.POPULARITY -> append("&sort=popular")
|
||||
SortOrder.POPULARITY_TODAY -> append("&sort=popular-today")
|
||||
SortOrder.POPULARITY_WEEK -> append("&sort=popular-week")
|
||||
SortOrder.UPDATED -> {}
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
|
||||
null -> append("/?")
|
||||
null -> append("/search/?q=pages:>0 ")
|
||||
}
|
||||
if (page > 1) {
|
||||
append("page=")
|
||||
append("&page=")
|
||||
append(page.toString())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user