Atsumaru: Fix covers (#11046)

fix covers
This commit is contained in:
bapeey 2025-10-13 08:06:37 -05:00 committed by Draff
parent 9f9cf36a20
commit 4007461062
Signed by: Draff
GPG Key ID: E8A89F3211677653
2 changed files with 9 additions and 6 deletions

View File

@ -1,7 +1,7 @@
ext { ext {
extName = 'Atsumaru' extName = 'Atsumaru'
extClass = '.Atsumaru' extClass = '.Atsumaru'
extVersionCode = 4 extVersionCode = 5
isNsfw = true isNsfw = true
} }

View File

@ -63,16 +63,19 @@ class MangaDto(
// Chapters // Chapters
val chapters: List<ChapterDto>? = null, val chapters: List<ChapterDto>? = null,
) { ) {
private fun getImagePath(): String? = when (imagePath) { private fun getImagePath(): String? {
is JsonPrimitive -> imagePath.content val url = when (imagePath) {
is JsonObject -> imagePath["image"]?.jsonPrimitive?.content is JsonPrimitive -> imagePath.content
else -> null is JsonObject -> imagePath["image"]?.jsonPrimitive?.content
else -> null
}
return url?.removePrefix("/")?.removePrefix("static/")
} }
fun toSManga(baseUrl: String): SManga = SManga.create().apply { fun toSManga(baseUrl: String): SManga = SManga.create().apply {
url = id url = id
title = this@MangaDto.title title = this@MangaDto.title
thumbnail_url = getImagePath().let { it -> baseUrl + it } thumbnail_url = getImagePath().let { it -> "$baseUrl/static/$it" }
description = synopsis description = synopsis
genre = buildList { genre = buildList {
type?.let { add(it) } type?.let { add(it) }