Skip to content

Commit

Permalink
Update parsers
Browse files Browse the repository at this point in the history
  • Loading branch information
Koitharu committed Oct 18, 2024
1 parent 57e7c8d commit 7c2c037
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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:481fb4f0d0")
implementation("com.github.KotatsuApp:kotatsu-parsers:08fe54c36d")
implementation("com.squareup.okhttp3:okhttp:4.12.0")
implementation("com.squareup.okio:okio:3.9.0")
implementation("io.webfolder:quickjs:1.1.0")
Expand Down
12 changes: 4 additions & 8 deletions src/main/kotlin/org/koitharu/kotatsu/dl/Main.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.koitharu.kotatsu.dl

import com.github.ajalt.clikt.command.main
import com.github.ajalt.clikt.core.ProgramResult
import com.github.ajalt.clikt.parameters.arguments.argument
import com.github.ajalt.clikt.parameters.options.*
import com.github.ajalt.clikt.parameters.types.enum
Expand Down Expand Up @@ -68,30 +67,27 @@ class Main : AppCommand(name = "kotatsu-dl") {
val linkResolver = context.newLinkResolver(link)
print("Resolving link…")
val source = linkResolver.getSource()
val manga = linkResolver.getManga()
if (source == null) {
println()
System.err.println("Unsupported manga source")
return 1
error("Unsupported manga source")
}
println('\r')
colored {
print("Source: ".cyan)
print(source.title.bold)
println()
}
val manga = linkResolver.getManga()
if (manga == null) {
System.err.println("Manga not found")
return 1
error("Manga not found")
}
colored {
print("Title: ".cyan)
println(manga.title.bold)
}
var chapters = manga.chapters
if (chapters.isNullOrEmpty()) {
System.err.println("Manga contains no chapters")
throw ProgramResult(1)
error("Manga contains no chapters")
}
chapters = askSelectBranch(chapters)
colored {
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/org/koitharu/kotatsu/dl/util/AppCommand.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ abstract class AppCommand(name: String) : CoreSuspendingCliktCommand(name) {
val exitCode = try {
invoke()
} catch (e: IllegalStateException) {
throw PrintMessage(e.message.ifNullOrEmpty { GENERIC_ERROR_MSG }, 2, true)
throw PrintMessage(e.message.ifNullOrEmpty { GENERIC_ERROR_MSG }, 1, true)
} catch (e: NotImplementedError) {
throw PrintMessage(e.message.ifNullOrEmpty { GENERIC_ERROR_MSG }, 2, true)
}
Expand Down

0 comments on commit 7c2c037

Please sign in to comment.