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'
|
extName = 'Naver Comic'
|
||||||
pkgNameSuffix = 'ko.navercomic'
|
pkgNameSuffix = 'ko.navercomic'
|
||||||
extClass = '.NaverComicFactory'
|
extClass = '.NaverComicFactory'
|
||||||
extVersionCode = 3
|
extVersionCode = 4
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: "$rootDir/common.gradle"
|
apply from: "$rootDir/common.gradle"
|
||||||
|
|
|
@ -108,16 +108,18 @@ abstract class NaverComicBase(protected val mType: String) : ParsedHttpSource()
|
||||||
|
|
||||||
override fun mangaDetailsParse(response: Response): SManga {
|
override fun mangaDetailsParse(response: Response): SManga {
|
||||||
val manga = json.decodeFromString<Manga>(response.body.string())
|
val manga = json.decodeFromString<Manga>(response.body.string())
|
||||||
val authors = manga.author.run {
|
val authors = manga.communityArtists.joinToString { it.name }
|
||||||
setOf(writers, painters, originAuthors).flatten().map { it.name }
|
|
||||||
}.joinToString()
|
|
||||||
|
|
||||||
return SManga.create().apply {
|
return SManga.create().apply {
|
||||||
title = manga.titleName
|
title = manga.titleName
|
||||||
author = authors
|
author = authors
|
||||||
description = manga.synopsis
|
description = manga.synopsis
|
||||||
thumbnail_url = manga.thumbnailUrl
|
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 titleName: String,
|
||||||
val titleId: Int,
|
val titleId: Int,
|
||||||
val finished: Boolean,
|
val finished: Boolean,
|
||||||
val author: AuthorList,
|
val rest: Boolean,
|
||||||
|
val communityArtists: List<Author>,
|
||||||
val synopsis: String,
|
val synopsis: String,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -228,15 +231,8 @@ data class MangaChallenge(
|
||||||
val author: String,
|
val author: String,
|
||||||
)
|
)
|
||||||
|
|
||||||
@Serializable
|
|
||||||
data class AuthorList(
|
|
||||||
val writers: List<Author>,
|
|
||||||
val painters: List<Author>,
|
|
||||||
val originAuthors: List<Author>,
|
|
||||||
)
|
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class Author(
|
data class Author(
|
||||||
val id: Int,
|
val artistId: Int,
|
||||||
val name: String,
|
val name: String,
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue