From 30e04eb48623ca77d97ff4bd63bb317e561ccba5 Mon Sep 17 00:00:00 2001 From: Koitharu Date: Sun, 10 Nov 2024 18:45:44 +0200 Subject: [PATCH] Update parsers --- build.gradle.kts | 2 +- src/main/kotlin/org/koitharu/kotatsu/dl/Main.kt | 5 +++-- src/main/kotlin/org/koitharu/kotatsu/dl/ui/InteractiveUi.kt | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 71aa1e6..205c27c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -31,7 +31,7 @@ dependencies { testImplementation(kotlin("test")) implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.9.0") implementation("com.github.ajalt.clikt:clikt-core:5.0.1") - implementation("com.github.KotatsuApp:kotatsu-parsers:08fe54c36d") + implementation("com.github.KotatsuApp:kotatsu-parsers:f3d14e101c") implementation("com.squareup.okhttp3:okhttp:4.12.0") implementation("com.squareup.okio:okio:3.9.0") implementation("io.webfolder:quickjs:1.1.0") diff --git a/src/main/kotlin/org/koitharu/kotatsu/dl/Main.kt b/src/main/kotlin/org/koitharu/kotatsu/dl/Main.kt index c9f8e9c..47f9a3a 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/dl/Main.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/dl/Main.kt @@ -15,6 +15,7 @@ import org.koitharu.kotatsu.dl.ui.askSelectBranch import org.koitharu.kotatsu.dl.util.AppCommand import org.koitharu.kotatsu.dl.util.ChaptersRange import org.koitharu.kotatsu.dl.util.colored +import org.koitharu.kotatsu.parsers.model.MangaParserSource import java.io.File class Main : AppCommand(name = "kotatsu-dl") { @@ -68,7 +69,7 @@ class Main : AppCommand(name = "kotatsu-dl") { print("Resolving link…") val source = linkResolver.getSource() val manga = linkResolver.getManga() - if (source == null) { + if (source == null || source == MangaParserSource.DUMMY) { println() error("Unsupported manga source") } @@ -101,7 +102,7 @@ class Main : AppCommand(name = "kotatsu-dl") { print("==>".green) print(' ') } - ChaptersRange.parse(readLine()) + ChaptersRange.parse(readlnOrNull()) } else { ChaptersRange.all() } diff --git a/src/main/kotlin/org/koitharu/kotatsu/dl/ui/InteractiveUi.kt b/src/main/kotlin/org/koitharu/kotatsu/dl/ui/InteractiveUi.kt index 1373e6d..f153b2f 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/dl/ui/InteractiveUi.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/dl/ui/InteractiveUi.kt @@ -24,7 +24,7 @@ fun askSelectBranch(chapters: List): List { print("==>".green) print(' ') } - val userInput = readLine()?.trim().ifNullOrEmpty { "1" } + val userInput = readlnOrNull()?.trim().ifNullOrEmpty { "1" } val branch = branches[userInput.toInt() - 1].first return chapters.filter { chapter -> chapter.branch == branch } } else {