From 0a00d342ee4a661ce794fce5e6572b07959a1196 Mon Sep 17 00:00:00 2001 From: "Cuong M. Tran" Date: Mon, 8 Apr 2024 13:45:17 +0700 Subject: [PATCH] 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 --- lib-multisrc/gmanga/build.gradle.kts | 2 +- .../gmanga/src/eu/kanade/tachiyomi/multisrc/gmanga/Dto.kt | 5 +++-- .../gmanga/src/eu/kanade/tachiyomi/multisrc/gmanga/Gmanga.kt | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib-multisrc/gmanga/build.gradle.kts b/lib-multisrc/gmanga/build.gradle.kts index 9dce2478c..e2f11e9c1 100644 --- a/lib-multisrc/gmanga/build.gradle.kts +++ b/lib-multisrc/gmanga/build.gradle.kts @@ -2,4 +2,4 @@ plugins { id("lib-multisrc") } -baseVersionCode = 2 +baseVersionCode = 3 diff --git a/lib-multisrc/gmanga/src/eu/kanade/tachiyomi/multisrc/gmanga/Dto.kt b/lib-multisrc/gmanga/src/eu/kanade/tachiyomi/multisrc/gmanga/Dto.kt index f0822db3d..0b770b1bd 100644 --- a/lib-multisrc/gmanga/src/eu/kanade/tachiyomi/multisrc/gmanga/Dto.kt +++ b/lib-multisrc/gmanga/src/eu/kanade/tachiyomi/multisrc/gmanga/Dto.kt @@ -30,6 +30,7 @@ class BrowseManga( private val id: Int, private val title: String, private val cover: String? = null, + @SerialName("is_novel") val isNovel: Boolean, ) { fun toSManga(createThumbnail: (String, String) -> String) = SManga.create().apply { url = "/mangas/$id" @@ -83,7 +84,7 @@ class Manga( else -> SManga.UNKNOWN } genre = buildList { - add(type.title) + type.title?.let { add(it) } add(type.name) categories.forEach { add(it.name) } }.joinToString() @@ -123,7 +124,7 @@ class NameDto(val name: String) @Serializable class TypeDto( val name: String, - val title: String, + val title: String?, ) @Serializable diff --git a/lib-multisrc/gmanga/src/eu/kanade/tachiyomi/multisrc/gmanga/Gmanga.kt b/lib-multisrc/gmanga/src/eu/kanade/tachiyomi/multisrc/gmanga/Gmanga.kt index 8ed63ebd6..13064d121 100644 --- a/lib-multisrc/gmanga/src/eu/kanade/tachiyomi/multisrc/gmanga/Gmanga.kt +++ b/lib-multisrc/gmanga/src/eu/kanade/tachiyomi/multisrc/gmanga/Gmanga.kt @@ -49,6 +49,7 @@ abstract class Gmanga( override fun latestUpdatesParse(response: Response): MangasPage { val releases = response.parseAs().releases + .filterNot { it.manga.isNovel } val entries = releases.map { it.manga.toSManga(::createThumbnail) } .distinctBy { it.url }