From 2802de7b623f155adaeba0be47694953190c82aa Mon Sep 17 00:00:00 2001 From: Smol Ame <155411819+Smol-Ame@users.noreply.github.com> Date: Sun, 15 Sep 2024 00:42:01 -0700 Subject: [PATCH] Iken: Adjust DTO to handle 'isNovel' & 'mangaSlug' (#5071) * Iken: Bump versionCode * Iken: Adjust IkenDTO to handle isNovel, slug fields with ChapterPostDetails slug (courtesy of bapeey) --------- Co-authored-by: bapeey <90949336+bapeey@users.noreply.github.com> --- lib-multisrc/iken/build.gradle.kts | 2 +- .../src/eu/kanade/tachiyomi/multisrc/iken/Dto.kt | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/lib-multisrc/iken/build.gradle.kts b/lib-multisrc/iken/build.gradle.kts index e2f11e9c1..6e70fd158 100644 --- a/lib-multisrc/iken/build.gradle.kts +++ b/lib-multisrc/iken/build.gradle.kts @@ -2,4 +2,4 @@ plugins { id("lib-multisrc") } -baseVersionCode = 3 +baseVersionCode = 4 diff --git a/lib-multisrc/iken/src/eu/kanade/tachiyomi/multisrc/iken/Dto.kt b/lib-multisrc/iken/src/eu/kanade/tachiyomi/multisrc/iken/Dto.kt index e16a6d86c..84142f8a9 100644 --- a/lib-multisrc/iken/src/eu/kanade/tachiyomi/multisrc/iken/Dto.kt +++ b/lib-multisrc/iken/src/eu/kanade/tachiyomi/multisrc/iken/Dto.kt @@ -83,8 +83,8 @@ class Post(val post: T) @Serializable class ChapterListResponse( - val isNovel: Boolean, - val slug: String, + val isNovel: Boolean = false, + val slug: String? = null, val chapters: List, ) @@ -96,11 +96,13 @@ class Chapter( private val createdBy: Name, private val createdAt: String, private val chapterStatus: String, + private val mangaPost: ChapterPostDetails, ) { fun isPublic() = chapterStatus == "PUBLIC" - fun toSChapter(mangaSlug: String) = SChapter.create().apply { - url = "/series/$mangaSlug/$slug#$id" + fun toSChapter(mangaSlug: String?) = SChapter.create().apply { + val seriesSlug = mangaSlug ?: mangaPost.slug + url = "/series/$seriesSlug/$slug#$id" name = "Chapter $number" scanlator = createdBy.name date_upload = try { @@ -111,4 +113,9 @@ class Chapter( } } +@Serializable +class ChapterPostDetails( + val slug: String, +) + private val dateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.ENGLISH)