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'
|
extName = 'MangaDex'
|
||||||
pkgNameSuffix = 'all.mangadex'
|
pkgNameSuffix = 'all.mangadex'
|
||||||
extClass = '.MangaDexFactory'
|
extClass = '.MangaDexFactory'
|
||||||
extVersionCode = 162
|
extVersionCode = 163
|
||||||
isNsfw = true
|
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 {
|
fun getPublicationStatus(attr: MangaAttributesDto, chapters: List<String>): Int {
|
||||||
return when (attr.status) {
|
val tempStatus = when (attr.status) {
|
||||||
null -> SManga.UNKNOWN
|
|
||||||
"ongoing" -> SManga.ONGOING
|
"ongoing" -> SManga.ONGOING
|
||||||
"completed", "cancelled" -> doubleCheckChapters(attr, chapters)
|
"cancelled" -> SManga.CANCELLED
|
||||||
"hiatus" -> SManga.ONGOING
|
"completed" -> SManga.PUBLISHING_FINISHED
|
||||||
|
"hiatus" -> SManga.ON_HIATUS
|
||||||
else -> SManga.UNKNOWN
|
else -> SManga.UNKNOWN
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
val publishedOrCancelled = tempStatus == SManga.PUBLISHING_FINISHED ||
|
||||||
* if the manga is 'completed' or 'cancelled' then it'll have a lastChapter in the manga obj.
|
tempStatus == SManga.CANCELLED
|
||||||
* if the simple list of chapters contains that lastChapter, then we can consider it completed.
|
|
||||||
*/
|
return if (chapters.contains(attr.lastChapter) && publishedOrCancelled) {
|
||||||
private fun doubleCheckChapters(attr: MangaAttributesDto, chapters: List<String>): Int {
|
|
||||||
return if (chapters.contains(attr.lastChapter))
|
|
||||||
SManga.COMPLETED
|
SManga.COMPLETED
|
||||||
else
|
} else {
|
||||||
SManga.UNKNOWN
|
tempStatus
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun parseDate(dateAsString: String): Long =
|
fun parseDate(dateAsString: String): Long =
|
||||||
|
|
Loading…
Reference in New Issue