Gmanga multisrc: filter out novel & fix null (#2303)

* Gmanga: filter out novel & fix null

* avoid null string in genre

* Update lib-multisrc/gmanga/src/eu/kanade/tachiyomi/multisrc/gmanga/Dto.kt
This commit is contained in:
Cuong M. Tran 2024-04-08 13:45:17 +07:00 committed by GitHub
parent 5d95700faf
commit 0a00d342ee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 3 deletions

View File

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

View File

@ -30,6 +30,7 @@ class BrowseManga(
private val id: Int, private val id: Int,
private val title: String, private val title: String,
private val cover: String? = null, private val cover: String? = null,
@SerialName("is_novel") val isNovel: Boolean,
) { ) {
fun toSManga(createThumbnail: (String, String) -> String) = SManga.create().apply { fun toSManga(createThumbnail: (String, String) -> String) = SManga.create().apply {
url = "/mangas/$id" url = "/mangas/$id"
@ -83,7 +84,7 @@ class Manga(
else -> SManga.UNKNOWN else -> SManga.UNKNOWN
} }
genre = buildList { genre = buildList {
add(type.title) type.title?.let { add(it) }
add(type.name) add(type.name)
categories.forEach { add(it.name) } categories.forEach { add(it.name) }
}.joinToString() }.joinToString()
@ -123,7 +124,7 @@ class NameDto(val name: String)
@Serializable @Serializable
class TypeDto( class TypeDto(
val name: String, val name: String,
val title: String, val title: String?,
) )
@Serializable @Serializable

View File

@ -49,6 +49,7 @@ abstract class Gmanga(
override fun latestUpdatesParse(response: Response): MangasPage { override fun latestUpdatesParse(response: Response): MangasPage {
val releases = response.parseAs<LatestChaptersDto>().releases val releases = response.parseAs<LatestChaptersDto>().releases
.filterNot { it.manga.isNovel }
val entries = releases.map { it.manga.toSManga(::createThumbnail) } val entries = releases.map { it.manga.toSManga(::createThumbnail) }
.distinctBy { it.url } .distinctBy { it.url }