Distinguish between novel and manga in Tsuki (closes #8171). (#8172)

This commit is contained in:
Alessandro Jean 2021-07-19 07:27:23 -03:00 committed by GitHub
parent 628fceecd7
commit b153c3cf22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 5 deletions

View File

@ -6,7 +6,7 @@ ext {
extName = 'Tsuki Mangás'
pkgNameSuffix = 'pt.tsukimangas'
extClass = '.TsukiMangas'
extVersionCode = 21
extVersionCode = 22
libVersion = '1.2'
containsNsfw = true
}

View File

@ -95,7 +95,7 @@ class TsukiMangas : HttpSource(), ConfigurableSource {
private fun popularMangaItemParse(manga: TsukiMangaDto) = SManga.create().apply {
val poster = manga.poster?.substringBefore("?")
title = manga.title
title = manga.title + (if (manga.format == NOVEL_FORMAT_ID) " (Novel)" else "")
thumbnail_url = baseUrl + (if (poster.isNullOrEmpty()) EMPTY_COVER else "/imgs/$poster")
url = "/obra/${manga.id}/${manga.url}"
}
@ -117,7 +117,7 @@ class TsukiMangas : HttpSource(), ConfigurableSource {
private fun latestMangaItemParse(manga: TsukiMangaDto) = SManga.create().apply {
val poster = manga.poster?.substringBefore("?")
title = manga.title
title = manga.title + (if (manga.format == NOVEL_FORMAT_ID) " (Novel)" else "")
thumbnail_url = baseUrl + (if (poster.isNullOrEmpty()) EMPTY_COVER else "/imgs/$poster")
url = "/obra/${manga.id}/${manga.url}"
}
@ -203,7 +203,7 @@ class TsukiMangas : HttpSource(), ConfigurableSource {
private fun searchMangaItemParse(manga: TsukiMangaDto) = SManga.create().apply {
val poster = manga.poster?.substringBefore("?")
title = manga.title
title = manga.title + (if (manga.format == NOVEL_FORMAT_ID) " (Novel)" else "")
thumbnail_url = baseUrl + (if (poster.isNullOrEmpty()) EMPTY_COVER else "/imgs/$poster")
url = "/obra/${manga.id}/${manga.url}"
}
@ -235,7 +235,7 @@ class TsukiMangas : HttpSource(), ConfigurableSource {
val mangaDto = json.decodeFromString<TsukiMangaDto>(response.body!!.string())
val poster = mangaDto.poster?.substringBefore("?")
title = mangaDto.title
title = mangaDto.title + (if (mangaDto.format == NOVEL_FORMAT_ID) " (Novel)" else "")
thumbnail_url = baseUrl + (if (poster.isNullOrEmpty()) EMPTY_COVER else "/imgs/$poster")
description = mangaDto.synopsis.orEmpty()
status = mangaDto.status.orEmpty().toStatus()
@ -572,6 +572,8 @@ class TsukiMangas : HttpSource(), ConfigurableSource {
private const val EMPTY_COVER = "/ext/errorcapa.jpg"
private const val NOVEL_FORMAT_ID = 4
private val DATE_FORMATTER by lazy { SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH) }
const val PREFIX_ID_SEARCH = "id:"

View File

@ -27,6 +27,7 @@ data class TsukiPaginatedDto(
data class TsukiMangaDto(
val artist: String? = "",
val author: String? = "",
val format: Int? = 1,
val genres: List<TsukiGenreDto> = emptyList(),
val id: Int,
val poster: String? = "",