From e636eda84028ef5e10fd426b7e6028fd6966a417 Mon Sep 17 00:00:00 2001 From: dragonx943 Date: Sun, 14 Sep 2025 03:57:20 +0700 Subject: [PATCH] Remove unused import + Fix warns --- .../kotatsu/parsers/site/en/VioletScans.kt | 16 +++++++--------- .../parsers/site/mangabox/MangaboxParser.kt | 2 +- .../parsers/site/mangabox/en/MangakakalotTv.kt | 2 +- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/VioletScans.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/VioletScans.kt index 45c1ff92..a58a3b2f 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/VioletScans.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/VioletScans.kt @@ -9,9 +9,7 @@ import org.koitharu.kotatsu.parsers.model.* import org.koitharu.kotatsu.parsers.model.search.MangaSearchQuery import org.koitharu.kotatsu.parsers.model.search.MangaSearchQueryCapabilities import org.koitharu.kotatsu.parsers.model.search.SearchCapability -import org.koitharu.kotatsu.parsers.model.search.QueryCriteria import org.koitharu.kotatsu.parsers.model.search.QueryCriteria.* -import org.koitharu.kotatsu.parsers.model.search.SearchableField import org.koitharu.kotatsu.parsers.model.search.SearchableField.* import org.koitharu.kotatsu.parsers.util.generateUid import org.koitharu.kotatsu.parsers.util.parseHtml @@ -49,20 +47,20 @@ internal class VioletScans(context: MangaLoaderContext) : var searchParameter = "" query.criteria.forEach { criterion -> when (criterion) { - is QueryCriteria.Match<*> -> { - if (criterion.field == SearchableField.TITLE_NAME) { + is Match<*> -> { + if (criterion.field == TITLE_NAME) { searchParameter = criterion.value.toString() } } - is QueryCriteria.Exclude<*> -> null - is QueryCriteria.Range<*> -> null - is QueryCriteria.Include<*> -> null + is Exclude<*> -> null + is Range<*> -> null + is Include<*> -> null } } // scrapeNonSearchList has considerable less payload as response so this is a optimization return when { - !searchParameter.isNullOrEmpty() -> scrapeSearchList(searchParameter, page) + searchParameter.isNotEmpty() -> scrapeSearchList(searchParameter, page) else -> scrapeNonSearchList(page) } } @@ -199,7 +197,7 @@ internal class VioletScans(context: MangaLoaderContext) : } val dateFormat = SimpleDateFormat("MMMM d, yyyy", Locale.ENGLISH) - val date = dateFormat.parseSafe(dateString) ?: 0L + val date = dateFormat.parseSafe(dateString) val chaptersList = root.selectFirstOrThrow("#chapterlist ul") val chapters = chaptersList.select("li") diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/mangabox/MangaboxParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/mangabox/MangaboxParser.kt index ac74ac9c..f25d89d7 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/mangabox/MangaboxParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/mangabox/MangaboxParser.kt @@ -271,7 +271,7 @@ internal abstract class MangaboxParser( val fullUrl = chapter.url.toAbsoluteUrl(domain) val doc = webClient.httpGet(fullUrl).parseHtml() - if (doc.select(selectPage).isNullOrEmpty()) { + if (doc.select(selectPage).isEmpty()) { val fullUrl2 = chapter.url.toAbsoluteUrl(domain).replace(domain, otherDomain) val doc2 = webClient.httpGet(fullUrl2).parseHtml() diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/mangabox/en/MangakakalotTv.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/mangabox/en/MangakakalotTv.kt index a4d2eb1f..d2721cf1 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/mangabox/en/MangakakalotTv.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/mangabox/en/MangakakalotTv.kt @@ -128,7 +128,7 @@ internal class MangakakalotTv(context: MangaLoaderContext) : url = href, publicUrl = href.toAbsoluteUrl(div.host ?: domain), coverUrl = div.selectFirst("img")?.src(), - title = div.selectFirstOrThrow("h3").text().orEmpty(), + title = div.selectFirstOrThrow("h3").text(), altTitles = emptySet(), rating = RATING_UNKNOWN, tags = emptySet(),