diff --git a/src/ar/gmanga/build.gradle b/src/ar/gmanga/build.gradle index 36fbab51f..23005cdb2 100644 --- a/src/ar/gmanga/build.gradle +++ b/src/ar/gmanga/build.gradle @@ -6,7 +6,7 @@ ext { extName = 'GMANGA' pkgNameSuffix = 'ar.gmanga' extClass = '.Gmanga' - extVersionCode = 12 + extVersionCode = 13 } apply from: "$rootDir/common.gradle" diff --git a/src/ar/gmanga/src/eu/kanade/tachiyomi/extension/ar/gmanga/Gmanga.kt b/src/ar/gmanga/src/eu/kanade/tachiyomi/extension/ar/gmanga/Gmanga.kt index 368c4d9bb..5d56b4804 100644 --- a/src/ar/gmanga/src/eu/kanade/tachiyomi/extension/ar/gmanga/Gmanga.kt +++ b/src/ar/gmanga/src/eu/kanade/tachiyomi/extension/ar/gmanga/Gmanga.kt @@ -248,6 +248,7 @@ class Gmanga : ConfigurableSource, HttpSource() { val hasWebP = releaseData["webp_pages"]!!.jsonArray.size > 0 return releaseData[if (hasWebP) "webp_pages" else "pages"]!!.jsonArray.map { it.jsonPrimitive.content } + .sortedWith(pageSort) .mapIndexed { index, pageUri -> Page( index, @@ -257,6 +258,12 @@ class Gmanga : ConfigurableSource, HttpSource() { } } + private val pageSort = + compareBy({ parseNumber(0, it) ?: Double.MAX_VALUE }, { parseNumber(1, it) }, { parseNumber(2, it) }) + + private fun parseNumber(index: Int, string: String): Double? = + Regex("\\d+").findAll(string).map { it.value }.toList().getOrNull(index)?.toDoubleOrNull() + override fun popularMangaParse(response: Response) = searchMangaParse(response) override fun popularMangaRequest(page: Int) = searchMangaRequest(page, "", getFilterList())