Do quite a bit of code cleanup
This commit is contained in:
@@ -18,12 +18,6 @@ import exh.metadata.metadata.base.insertFlatMetadata
|
||||
import exh.util.await
|
||||
import exh.util.floor
|
||||
import exh.util.nullIfZero
|
||||
import kotlinx.serialization.decodeFromString
|
||||
import kotlinx.serialization.json.Json
|
||||
import kotlinx.serialization.json.JsonObject
|
||||
import kotlinx.serialization.json.intOrNull
|
||||
import kotlinx.serialization.json.jsonObject
|
||||
import kotlinx.serialization.json.jsonPrimitive
|
||||
import okhttp3.Response
|
||||
import rx.Completable
|
||||
import rx.Single
|
||||
|
||||
@@ -10,7 +10,7 @@ import exh.md.utils.MdUtil
|
||||
import exh.md.utils.setMDUrlWithoutDomain
|
||||
import okhttp3.CacheControl
|
||||
import okhttp3.Headers
|
||||
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
|
||||
import okhttp3.HttpUrl.Companion.toHttpUrl
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.Request
|
||||
import okhttp3.Response
|
||||
@@ -75,7 +75,7 @@ class SearchHandler(val client: OkHttpClient, private val headers: Headers, val
|
||||
val demographics = mutableListOf<String>()
|
||||
|
||||
// Do traditional search
|
||||
val url = "${MdUtil.baseUrl}/?page=search".toHttpUrlOrNull()!!.newBuilder()
|
||||
val url = "${MdUtil.baseUrl}/?page=search".toHttpUrl().newBuilder()
|
||||
.addQueryParameter("p", page.toString())
|
||||
.addQueryParameter("title", query.replace(WHITESPACE_REGEX, " "))
|
||||
|
||||
|
||||
@@ -21,4 +21,4 @@ data class ChapterPageSerializer(
|
||||
val pages: List<String>,
|
||||
val server: String,
|
||||
val mangaId: Int
|
||||
)
|
||||
)
|
||||
|
||||
@@ -49,13 +49,11 @@ object SourceTagsUtil {
|
||||
}
|
||||
|
||||
fun parseTag(tag: String) = RaisedTag(
|
||||
(
|
||||
if (tag.startsWith("-")) {
|
||||
tag.substringAfter("-")
|
||||
} else {
|
||||
tag
|
||||
}
|
||||
).substringBefore(':', missingDelimiterValue = "").trimOrNull(),
|
||||
if (tag.startsWith("-")) {
|
||||
tag.substringAfter("-")
|
||||
} else {
|
||||
tag
|
||||
}.substringBefore(':', missingDelimiterValue = "").trimOrNull(),
|
||||
tag.substringAfter(':', missingDelimiterValue = tag).trim(),
|
||||
if (tag.startsWith("-")) TAG_TYPE_EXCLUDE else TAG_TYPE_DEFAULT
|
||||
)
|
||||
@@ -94,6 +92,6 @@ object SourceTagsUtil {
|
||||
private const val TAG_TYPE_DEFAULT = 1
|
||||
}
|
||||
|
||||
fun Manga.getRaisedTags(genres: List<String>? = null): List<RaisedTag>? = (genres ?: this.getGenres())?.map {
|
||||
fun Manga.getRaisedTags(genres: List<String>? = getGenres()): List<RaisedTag>? = genres?.map {
|
||||
SourceTagsUtil.parseTag(it)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user