[Ổ Truyện] Small fixes (#2027)

Draken 9 months ago committed by GitHub
parent 14cff0d651
commit 39703e3ebb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

1
.gitignore vendored

@ -27,6 +27,7 @@
# When using Gradle or Maven with auto-import, you should exclude module files, # When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using # since they will be recreated, and may cause churn. Uncomment if using
# auto-import. # auto-import.
.idea/.name
.idea/artifacts .idea/artifacts
.idea/compiler.xml .idea/compiler.xml
.idea/jarRepositories.xml .idea/jarRepositories.xml

2
.idea/.gitignore vendored

@ -3,3 +3,5 @@
/workspace.xml /workspace.xml
# GitHub Copilot persisted chat sessions # GitHub Copilot persisted chat sessions
/copilot/chatSessions /copilot/chatSessions
.name

@ -32,9 +32,7 @@ import java.text.SimpleDateFormat
import java.util.EnumSet import java.util.EnumSet
import java.util.Locale import java.util.Locale
import java.util.TimeZone import java.util.TimeZone
import org.koitharu.kotatsu.parsers.Broken
@Broken
@MangaSourceParser("OTRUYEN", "Ổ Truyện", "vi") @MangaSourceParser("OTRUYEN", "Ổ Truyện", "vi")
internal class OTruyenParser(context: MangaLoaderContext) : internal class OTruyenParser(context: MangaLoaderContext) :
PagedMangaParser(context, MangaParserSource.OTRUYEN, 24) { PagedMangaParser(context, MangaParserSource.OTRUYEN, 24) {
@ -132,16 +130,10 @@ internal class OTruyenParser(context: MangaLoaderContext) :
url = jo.getString("slug"), url = jo.getString("slug"),
publicUrl = "https://otruyen.cc/truyen-tranh/${jo.getString("slug")}", publicUrl = "https://otruyen.cc/truyen-tranh/${jo.getString("slug")}",
title = jo.getString("name"), title = jo.getString("name"),
altTitles = jo.getJSONArray("origin_name").mapJSONToSet { it.toString() }, altTitles = emptySet(),
coverUrl = "https://img.otruyenapi.com/uploads/comics/${jo.getString("thumb_url")}", coverUrl = "https://img.otruyenapi.com/uploads/comics/${jo.getString("thumb_url")}",
authors = jo.getJSONArray("author").mapJSONToSet { it.toString() }, authors = emptySet(),
tags = jo.getJSONArray("category").mapJSONToSet { category -> tags = emptySet(),
MangaTag(
title = category.getString("name"),
key = category.getString("slug"),
source = source,
)
},
state = when (jo.getString("status")) { state = when (jo.getString("status")) {
"ongoing" -> MangaState.ONGOING "ongoing" -> MangaState.ONGOING
"coming_soon" -> MangaState.UPCOMING "coming_soon" -> MangaState.UPCOMING
@ -184,8 +176,12 @@ internal class OTruyenParser(context: MangaLoaderContext) :
} }
return manga.copy( return manga.copy(
altTitles = item.getJSONArray("origin_name").mapJSONToSet { it.toString() }, altTitles = item.getJSONArray("origin_name").let { jsonArray ->
authors = item.getJSONArray("author").mapJSONToSet { it.toString() }, (0 until jsonArray.length()).mapTo(mutableSetOf()) { jsonArray.getString(it) }
},
authors = item.getJSONArray("author").let { jsonArray ->
(0 until jsonArray.length()).mapTo(mutableSetOf()) { jsonArray.getString(it) }
},
tags = item.optJSONArray("category").mapJSONToSet { jo -> tags = item.optJSONArray("category").mapJSONToSet { jo ->
MangaTag( MangaTag(
title = jo.optString("name"), title = jo.optString("name"),

Loading…
Cancel
Save