Tweak MangaDex status handling to match Neko and SY behavior. (#12123)
This commit is contained in:
parent
1de4b7e286
commit
b197d624f9
|
@ -6,7 +6,7 @@ ext {
|
|||
extName = 'MangaDex'
|
||||
pkgNameSuffix = 'all.mangadex'
|
||||
extClass = '.MangaDexFactory'
|
||||
extVersionCode = 162
|
||||
extVersionCode = 163
|
||||
isNsfw = true
|
||||
}
|
||||
|
||||
|
|
|
@ -86,27 +86,26 @@ class MangaDexHelper(private val lang: String) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Maps dex status to tachi status
|
||||
* Maps dex status to Tachi status.
|
||||
* Adapted from the MangaDex handler from TachiyomiSY.
|
||||
*/
|
||||
fun getPublicationStatus(attr: MangaAttributesDto, chapters: List<String>): Int {
|
||||
return when (attr.status) {
|
||||
null -> SManga.UNKNOWN
|
||||
val tempStatus = when (attr.status) {
|
||||
"ongoing" -> SManga.ONGOING
|
||||
"completed", "cancelled" -> doubleCheckChapters(attr, chapters)
|
||||
"hiatus" -> SManga.ONGOING
|
||||
"cancelled" -> SManga.CANCELLED
|
||||
"completed" -> SManga.PUBLISHING_FINISHED
|
||||
"hiatus" -> SManga.ON_HIATUS
|
||||
else -> SManga.UNKNOWN
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* if the manga is 'completed' or 'cancelled' then it'll have a lastChapter in the manga obj.
|
||||
* if the simple list of chapters contains that lastChapter, then we can consider it completed.
|
||||
*/
|
||||
private fun doubleCheckChapters(attr: MangaAttributesDto, chapters: List<String>): Int {
|
||||
return if (chapters.contains(attr.lastChapter))
|
||||
val publishedOrCancelled = tempStatus == SManga.PUBLISHING_FINISHED ||
|
||||
tempStatus == SManga.CANCELLED
|
||||
|
||||
return if (chapters.contains(attr.lastChapter) && publishedOrCancelled) {
|
||||
SManga.COMPLETED
|
||||
else
|
||||
SManga.UNKNOWN
|
||||
} else {
|
||||
tempStatus
|
||||
}
|
||||
}
|
||||
|
||||
fun parseDate(dateAsString: String): Long =
|
||||
|
|
Loading…
Reference in New Issue