Manga mutiny: chapter number fix + closing responses (#6159)

* MangaMutiny: Chapter tracking fix

- Chapter numbers were previously incorrectly determined, leading to incorrect tracking information. Fixed with the changes of this commit.

* MangaMutiny: closing some response bodies

Closing the bodies of some responses.
This commit is contained in:
E3FxGaming 2021-03-12 12:49:16 +01:00 committed by GitHub
parent d265dbf33c
commit 6d0724a150
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 3 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'Manga Mutiny'
pkgNameSuffix = "en.mangamutiny"
extClass = '.MangaMutiny'
extVersionCode = 5
extVersionCode = 6
libVersion = '1.2'
containsNsfw = true
}

View File

@ -75,7 +75,7 @@ class MangaMutiny : HttpSource() {
mangaDetailsRequestCommon(manga, false)
override fun chapterListParse(response: Response): List<SChapter> {
val chapterList = ArrayList<SChapter>()
val chapterList = mutableListOf<SChapter>()
val responseBody = response.body()
if (responseBody != null) {
@ -89,18 +89,27 @@ class MangaMutiny : HttpSource() {
name = chapterTitleBuilder(singleChapterJsonObject)
url = singleChapterJsonObject.get("slug").asString
date_upload = parseDate(singleChapterJsonObject.get("releasedAt").asString)
chapterNumberBuilder(singleChapterJsonObject)?.let { chapterNumber ->
chapter_number = chapterNumber
}
}
)
}
responseBody.close()
}
return chapterList
}
private fun chapterNumberBuilder(rootNode: JsonObject): Float? =
rootNode.getNullable("chapter")?.asFloat
private fun chapterTitleBuilder(rootNode: JsonObject): String {
val volume = rootNode.getNullable("volume")?.asInt
val chapter = rootNode.getNullable("chapter")?.asInt
val chapter = rootNode.getNullable("chapter")?.asFloat
val textTitle = rootNode.getNullable("title")?.asString
@ -172,6 +181,8 @@ class MangaMutiny : HttpSource() {
genre = rootNode.get("tags").asJsonArray
.joinToString { singleGenre -> singleGenre.asString }
}
responseBody.close()
}
return manga
@ -206,6 +217,8 @@ class MangaMutiny : HttpSource() {
for (i in 0 until images.size()) {
pageList.add(Page(i, "", chapterUrl + images[i].asString))
}
responseBody.close()
}
return pageList