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>
This commit is contained in:
Smol Ame 2024-09-15 00:42:01 -07:00 committed by GitHub
parent 7ce0bb0fee
commit f7f3b0e30c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 5 deletions

View File

@ -2,4 +2,4 @@ plugins {
id("lib-multisrc")
}
baseVersionCode = 3
baseVersionCode = 4

View File

@ -83,8 +83,8 @@ class Post<T>(val post: T)
@Serializable
class ChapterListResponse(
val isNovel: Boolean,
val slug: String,
val isNovel: Boolean = false,
val slug: String? = null,
val chapters: List<Chapter>,
)
@ -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)