MangAdventure: support custom chapter titles (#2282)

This commit is contained in:
ObserverOfTime 2020-02-23 04:20:16 +02:00 committed by GitHub
parent 53d6cbf97d
commit b1f787e5b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 7 deletions

View File

@ -5,7 +5,7 @@ ext {
appName = 'Tachiyomi: MangAdventure'
pkgNameSuffix = 'all.mangadventure'
extClass = '.MangAdventureFactory'
extVersionCode = 5
extVersionCode = 6
libVersion = '1.2'
}

View File

@ -122,7 +122,7 @@ abstract class MangAdventure(
}
)
}
}.sortedByDescending(SChapter::name).toList()
}.toList().reversed()
}
override fun mangaDetailsParse(response: Response) =
@ -131,7 +131,9 @@ abstract class MangAdventure(
override fun pageListParse(response: Response) =
JSONObject(response.asString()).run {
val url = getString("url")
// Workaround for a bug in MangAdventure < 0.6.3
val root = getString("pages_root")
.replace("://media/series", "://reader")
val arr = getJSONArray("pages_list")
(0 until arr.length()).map {
Page(it, "$url${it + 1}", "$root${arr.getString(it)}")

View File

@ -72,10 +72,10 @@ fun SChapter.fromJSON(obj: JSONObject) = apply {
chapter_number = obj.optString("chapter", "0").toFloat()
date_upload = MangAdventure.httpDateToTimestamp(obj.getString("date"))
scanlator = obj.getJSONArray("groups")?.joinField("name", " & ")
name = buildString {
obj.optInt("volume").let { if (it != 0) append("Vol.$it ") }
append("Ch.${DecimalFormat("#.#").format(chapter_number)} - ")
name = obj.optString("full_title", buildString {
obj.optInt("volume").let { if (it != 0) append("Vol. $it, ") }
append("Ch. ${DecimalFormat("#.#").format(chapter_number)}: ")
append(obj.getString("title"))
if (obj.getBoolean("final")) append(" [END]")
}
})
if (obj.getBoolean("final")) name += " [END]"
}