MangaDex - MangaPlus message (#3489)

* MangaDex - MangaPlus message

* Update MangaDex.kt
This commit is contained in:
Mike 2020-06-11 17:40:22 -04:00 committed by GitHub
parent d6c6c65f01
commit 0dc21c1b38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View File

@ -5,7 +5,7 @@ ext {
appName = 'Tachiyomi: MangaDex' appName = 'Tachiyomi: MangaDex'
pkgNameSuffix = 'all.mangadex' pkgNameSuffix = 'all.mangadex'
extClass = '.MangaDexFactory' extClass = '.MangaDexFactory'
extVersionCode = 92 extVersionCode = 93
libVersion = '1.2' libVersion = '1.2'
} }

View File

@ -464,6 +464,7 @@ abstract class MangaDex(
private fun doesFinalChapterExist(finalChapterNumber: String, chapterJson: JsonElement) = finalChapterNumber.isNotEmpty() && finalChapterNumber == chapterJson["chapter"].string.trim() private fun doesFinalChapterExist(finalChapterNumber: String, chapterJson: JsonElement) = finalChapterNumber.isNotEmpty() && finalChapterNumber == chapterJson["chapter"].string.trim()
override fun chapterListParse(response: Response): List<SChapter> { override fun chapterListParse(response: Response): List<SChapter> {
hasMangaPlus = false
val now = Date().time val now = Date().time
val jsonData = response.body()!!.string() val jsonData = response.body()!!.string()
val json = JsonParser().parse(jsonData).asJsonObject val json = JsonParser().parse(jsonData).asJsonObject
@ -481,7 +482,7 @@ abstract class MangaDex(
chapters.add(chapterFromJson(key, chapterElement, finalChapterNumber, status)) chapters.add(chapterFromJson(key, chapterElement, finalChapterNumber, status))
} }
} }
return chapters return chapters.also { if (it.isEmpty() && hasMangaPlus) throw Exception("This only has MangaPlus chapters, use the MangaPlus extension") }
} }
/** /**
@ -494,7 +495,10 @@ abstract class MangaDex(
return when { return when {
chapterJson.get("lang_code").string != internalLang -> false chapterJson.get("lang_code").string != internalLang -> false
(chapterJson.get("timestamp").asLong * 1000) > now -> false (chapterJson.get("timestamp").asLong * 1000) > now -> false
chapterJson.get("group_id").string == "9097" -> false chapterJson.get("group_id").string == "9097" -> {
hasMangaPlus = true
false
}
else -> true else -> true
} }
} }
@ -938,5 +942,7 @@ abstract class MangaDex(
Pair("Spanish (LATAM)", "29"), Pair("Spanish (LATAM)", "29"),
Pair("Thai", "32"), Pair("Thai", "32"),
Pair("Filipino", "34")) Pair("Filipino", "34"))
private var hasMangaPlus = false
} }
} }