From f8373acc61257cc5a8e9a8c4597944baaf83c95b Mon Sep 17 00:00:00 2001 From: metonym <127705169+metonyms@users.noreply.github.com> Date: Sat, 30 Sep 2023 07:32:43 -0700 Subject: [PATCH] naver: fix author parsing and handle on hiatus status (#18188) * naver: fix author parsing * simplify joinToString * handle on hiatus status * use when expression * adjust order of checks for status i have found a couple entries that have both rest and finished set to true. those entires are all definitely on hiatus so let's give the rest flag prio --- src/ko/navercomic/build.gradle | 2 +- .../extension/ko/navercomic/NaverComicBase.kt | 22 ++++++++----------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/ko/navercomic/build.gradle b/src/ko/navercomic/build.gradle index e11b5d4bb..4f89e3d45 100644 --- a/src/ko/navercomic/build.gradle +++ b/src/ko/navercomic/build.gradle @@ -6,7 +6,7 @@ ext { extName = 'Naver Comic' pkgNameSuffix = 'ko.navercomic' extClass = '.NaverComicFactory' - extVersionCode = 3 + extVersionCode = 4 } apply from: "$rootDir/common.gradle" diff --git a/src/ko/navercomic/src/eu/kanade/tachiyomi/extension/ko/navercomic/NaverComicBase.kt b/src/ko/navercomic/src/eu/kanade/tachiyomi/extension/ko/navercomic/NaverComicBase.kt index 2614218aa..57bd6e529 100644 --- a/src/ko/navercomic/src/eu/kanade/tachiyomi/extension/ko/navercomic/NaverComicBase.kt +++ b/src/ko/navercomic/src/eu/kanade/tachiyomi/extension/ko/navercomic/NaverComicBase.kt @@ -108,16 +108,18 @@ abstract class NaverComicBase(protected val mType: String) : ParsedHttpSource() override fun mangaDetailsParse(response: Response): SManga { val manga = json.decodeFromString(response.body.string()) - val authors = manga.author.run { - setOf(writers, painters, originAuthors).flatten().map { it.name } - }.joinToString() + val authors = manga.communityArtists.joinToString { it.name } return SManga.create().apply { title = manga.titleName author = authors description = manga.synopsis thumbnail_url = manga.thumbnailUrl - status = if (manga.finished) SManga.COMPLETED else SManga.ONGOING + status = when { + manga.rest -> SManga.ON_HIATUS + manga.finished -> SManga.COMPLETED + else -> SManga.ONGOING + } } } @@ -215,7 +217,8 @@ data class Manga( val titleName: String, val titleId: Int, val finished: Boolean, - val author: AuthorList, + val rest: Boolean, + val communityArtists: List, val synopsis: String, ) @@ -228,15 +231,8 @@ data class MangaChallenge( val author: String, ) -@Serializable -data class AuthorList( - val writers: List, - val painters: List, - val originAuthors: List, -) - @Serializable data class Author( - val id: Int, + val artistId: Int, val name: String, )