From 7e37c68ba18f344f8ea208675d547bba60c79054 Mon Sep 17 00:00:00 2001 From: mobi2002 <48650614+mobi2002@users.noreply.github.com> Date: Mon, 24 Apr 2023 04:09:15 +0500 Subject: [PATCH] Comick: thumbnails (#16135) --- src/all/comickfun/build.gradle | 2 +- .../extension/all/comickfun/ComickFun.kt | 16 ++++++---------- .../extension/all/comickfun/ComickFunDto.kt | 2 +- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/all/comickfun/build.gradle b/src/all/comickfun/build.gradle index 06929275e..f209db00b 100644 --- a/src/all/comickfun/build.gradle +++ b/src/all/comickfun/build.gradle @@ -6,7 +6,7 @@ ext { extName = 'Comick' pkgNameSuffix = 'all.comickfun' extClass = '.ComickFunFactory' - extVersionCode = 24 + extVersionCode = 25 isNsfw = true } diff --git a/src/all/comickfun/src/eu/kanade/tachiyomi/extension/all/comickfun/ComickFun.kt b/src/all/comickfun/src/eu/kanade/tachiyomi/extension/all/comickfun/ComickFun.kt index 6eec1480f..a046f8ff0 100644 --- a/src/all/comickfun/src/eu/kanade/tachiyomi/extension/all/comickfun/ComickFun.kt +++ b/src/all/comickfun/src/eu/kanade/tachiyomi/extension/all/comickfun/ComickFun.kt @@ -177,11 +177,9 @@ abstract class ComickFun(override val lang: String, private val comickFunLang: S // appennding # at end as part of migration from slug to hid url = "/comic/${data.hid}#" title = data.title - thumbnail_url = if (data.md_covers.isNotEmpty()) { - "$cdnUrl/${data.md_covers[0].b2key}" - } else { - "$baseUrl/static/failed_to_load.png" - } + thumbnail_url = runCatching { + "$cdnUrl/${data.md_covers.first().b2key}" + }.getOrNull() } }, /* @@ -216,11 +214,9 @@ abstract class ComickFun(override val lang: String, private val comickFunLang: S description = beautifyDescription(mangaData.comic.desc) genre = mangaData.genres.joinToString { it.name.trim() } status = parseStatus(mangaData.comic.status) - thumbnail_url = if (mangaData.comic.md_covers.isNotEmpty()) { - "$cdnUrl/${mangaData.comic.md_covers[0].b2key}" - } else { - "$baseUrl/static/failed_to_load.png" - } + thumbnail_url = runCatching { + "$cdnUrl/${mangaData.comic.md_covers.first().b2key}" + }.getOrNull() } } diff --git a/src/all/comickfun/src/eu/kanade/tachiyomi/extension/all/comickfun/ComickFunDto.kt b/src/all/comickfun/src/eu/kanade/tachiyomi/extension/all/comickfun/ComickFunDto.kt index 423c8806f..528d47c1f 100644 --- a/src/all/comickfun/src/eu/kanade/tachiyomi/extension/all/comickfun/ComickFunDto.kt +++ b/src/all/comickfun/src/eu/kanade/tachiyomi/extension/all/comickfun/ComickFunDto.kt @@ -11,7 +11,7 @@ data class Manga( @Serializable data class MDcovers( - val b2key: String, + val b2key: String?, ) @Serializable