Komga: Improve status parsing (#12728)

* Komga: Improve status parsing

* Set null as default value for totalBookCount

* Apply suggestion

* Update changelog
This commit is contained in:
Aiman 2022-07-28 01:12:08 +08:00 committed by GitHub
parent b35194d42c
commit 5d6e61eb2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 5 deletions

View File

@ -1,3 +1,11 @@
## 1.3.41
Minimum Komga version required: `0.151.0`
### Features
* Improve how the status is displayed
## 1.3.40
Minimum Komga version required: `0.151.0`

View File

@ -6,7 +6,7 @@ ext {
extName = 'Komga'
pkgNameSuffix = 'all.komga'
extClass = '.KomgaFactory'
extVersionCode = 40
extVersionCode = 41
}
dependencies {

View File

@ -268,9 +268,12 @@ open class Komga(suffix: String = "") : ConfigurableSource, UnmeteredSource, Htt
title = metadata.title
url = "$baseUrl/api/v1/series/$id"
thumbnail_url = "$url/thumbnail"
status = when (metadata.status) {
"ONGOING" -> SManga.ONGOING
"ENDED" -> SManga.COMPLETED
status = when {
metadata.status == "ENDED" && metadata.totalBookCount != null && booksCount < metadata.totalBookCount -> SManga.PUBLISHING_FINISHED
metadata.status == "ENDED" -> SManga.COMPLETED
metadata.status == "ONGOING" -> SManga.ONGOING
metadata.status == "ABANDONED" -> SManga.CANCELLED
metadata.status == "HIATUS" -> SManga.ON_HIATUS
else -> SManga.UNKNOWN
}
genre = (metadata.genres + metadata.tags + booksMetadata.tags).distinct().joinToString(", ")

View File

@ -41,7 +41,8 @@ data class SeriesMetadataDto(
val genres: Set<String>,
val genresLock: Boolean,
val tags: Set<String>,
val tagsLock: Boolean
val tagsLock: Boolean,
val totalBookCount: Int? = null
)
@Serializable