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
This commit is contained in:
parent
ca0b8788dd
commit
f8373acc61
|
@ -6,7 +6,7 @@ ext {
|
|||
extName = 'Naver Comic'
|
||||
pkgNameSuffix = 'ko.navercomic'
|
||||
extClass = '.NaverComicFactory'
|
||||
extVersionCode = 3
|
||||
extVersionCode = 4
|
||||
}
|
||||
|
||||
apply from: "$rootDir/common.gradle"
|
||||
|
|
|
@ -108,16 +108,18 @@ abstract class NaverComicBase(protected val mType: String) : ParsedHttpSource()
|
|||
|
||||
override fun mangaDetailsParse(response: Response): SManga {
|
||||
val manga = json.decodeFromString<Manga>(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<Author>,
|
||||
val synopsis: String,
|
||||
)
|
||||
|
||||
|
@ -228,15 +231,8 @@ data class MangaChallenge(
|
|||
val author: String,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class AuthorList(
|
||||
val writers: List<Author>,
|
||||
val painters: List<Author>,
|
||||
val originAuthors: List<Author>,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class Author(
|
||||
val id: Int,
|
||||
val artistId: Int,
|
||||
val name: String,
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue