Add year constants
This commit is contained in:
@@ -2,4 +2,10 @@
|
||||
|
||||
package org.koitharu.kotatsu.parsers.model
|
||||
|
||||
const val RATING_UNKNOWN = -1f
|
||||
public const val RATING_UNKNOWN: Float = -1f
|
||||
|
||||
public const val YEAR_UNKNOWN: Int = 0
|
||||
|
||||
public const val YEAR_MIN: Int = 1900
|
||||
|
||||
public const val YEAR_MAX: Int = 2099
|
||||
|
||||
@@ -12,9 +12,9 @@ public data class MangaListFilter(
|
||||
@JvmField val contentRating: Set<ContentRating> = emptySet(),
|
||||
@JvmField val types: Set<ContentType> = emptySet(),
|
||||
@JvmField val demographics: Set<Demographic> = emptySet(),
|
||||
@JvmField val year: Int = 0,
|
||||
@JvmField val yearFrom: Int = 0,
|
||||
@JvmField val yearTo: Int = 0,
|
||||
@JvmField val year: Int = YEAR_UNKNOWN,
|
||||
@JvmField val yearFrom: Int = YEAR_UNKNOWN,
|
||||
@JvmField val yearTo: Int = YEAR_UNKNOWN,
|
||||
) {
|
||||
|
||||
public fun isEmpty(): Boolean = tags.isEmpty() &&
|
||||
@@ -24,9 +24,9 @@ public data class MangaListFilter(
|
||||
states.isEmpty() &&
|
||||
contentRating.isEmpty() &&
|
||||
query == null &&
|
||||
year == 0 &&
|
||||
yearFrom == 0 &&
|
||||
yearTo == 0 &&
|
||||
year == YEAR_UNKNOWN &&
|
||||
yearFrom == YEAR_UNKNOWN &&
|
||||
yearTo == YEAR_UNKNOWN &&
|
||||
types.isEmpty() &&
|
||||
demographics.isEmpty()
|
||||
|
||||
|
||||
@@ -107,11 +107,11 @@ internal class ComickFunParser(context: MangaLoaderContext) :
|
||||
)
|
||||
}
|
||||
|
||||
if (filter.yearFrom != 0) {
|
||||
if (filter.yearFrom != YEAR_UNKNOWN) {
|
||||
url.addQueryParameter("from", filter.yearFrom.toString())
|
||||
}
|
||||
|
||||
if (filter.yearTo != 0) {
|
||||
if (filter.yearTo != YEAR_UNKNOWN) {
|
||||
url.addQueryParameter("to", filter.yearTo.toString())
|
||||
}
|
||||
|
||||
|
||||
@@ -361,9 +361,9 @@ internal abstract class GroupleParser(
|
||||
payload["s_wait_upload"] = ""
|
||||
payload["s_sale"] = ""
|
||||
payload["years"] = buildString {
|
||||
append(filter.yearFrom.ifZero { 1900 })
|
||||
append(filter.yearFrom.ifZero { YEAR_MIN })
|
||||
append(',')
|
||||
append(filter.yearTo.ifZero { 2099 })
|
||||
append(filter.yearTo.ifZero { YEAR_MAX })
|
||||
}
|
||||
payload["+"] = "Искать".urlEncoded()
|
||||
return webClient.httpPost(url, payload)
|
||||
|
||||
Reference in New Issue
Block a user