mangadex another double fix (#332)

This commit is contained in:
Carlos 2018-05-25 09:11:52 -04:00 committed by GitHub
parent 5a5e11502c
commit 55eae75862
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 5 deletions

View File

@ -5,8 +5,8 @@ ext {
appName = 'Tachiyomi: MangaDex'
pkgNameSuffix = "all.mangadex"
extClass = '.MangadexFactory'
extVersionCode = 24
extVersionSuffix = 24
extVersionCode = 25
extVersionSuffix = 25
libVersion = '1.2'
}

View File

@ -224,8 +224,8 @@ open class Mangadex(override val lang: String, private val internalLang: String,
manga.description = cleanString(mangaJson.get("description").string)
manga.author = mangaJson.get("author").string
manga.artist = mangaJson.get("artist").string
val finalChapterNumber = mangaJson.get("last_chapter").int
if (finalChapterNumber != 0) {
val finalChapterNumber = getFinalChapter(mangaJson)
if (finalChapterNumber != 0.00) {
manga.status = SManga.COMPLETED
} else {
manga.status = parseStatus(mangaJson.get("status").int)
@ -260,13 +260,23 @@ open class Mangadex(override val lang: String, private val internalLang: String,
}
}
private fun getFinalChapter(jsonObj: JsonObject): Double {
var finalChapterNumber = 0.00
if (jsonObj.get("last_chapter").string.isNotBlank()) {
finalChapterNumber = jsonObj.get("last_chapter").double
}
return finalChapterNumber
}
override fun chapterListParse(response: Response): List<SChapter> {
val now = Date().time
var jsonData = response.body()!!.string()
val json = JsonParser().parse(jsonData).asJsonObject
val mangaJson = json.getAsJsonObject("manga")
val finalChapterNumber = mangaJson.get("last_chapter").double
var finalChapterNumber = getFinalChapter(mangaJson)
val chapterJson = json.getAsJsonObject("chapter")
val chapters = mutableListOf<SChapter>()