Bakkin: parse chapter numbers (#12708)

This commit is contained in:
ObserverOfTime 2022-07-24 16:36:45 +03:00 committed by GitHub
parent 680dd09892
commit 08a5a14915
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 4 deletions

View File

@ -8,7 +8,7 @@ class BakkinGenerator : ThemeSourceGenerator {
override val themeClass = "BakkinReaderX"
override val baseVersionCode = 4
override val baseVersionCode = 5
override val sources = listOf(
SingleLang("Bakkin", "https://bakkin.moe/reader/", "en"),

View File

@ -10,7 +10,12 @@ internal data class Series(
val volumes: List<Volume>
) : Iterable<Chapter> {
override fun iterator() = volumes.flatMap { vol ->
vol.map { it.copy("$dir/${vol.dir}/${it.dir}", "$vol - $it") }
vol.map {
it.copy(
name = "$vol - $it",
dir = "$dir/${vol.dir}/${it.dir}"
)
}
}.iterator()
val cover: String
@ -34,5 +39,8 @@ internal data class Chapter(
val name: String,
val pages: List<String>
) : Iterable<String> by pages {
val number: Float
get() = dir.substringAfterLast('c').toFloatOrNull() ?: -1f
override fun toString() = name.ifEmpty { dir }
}

View File

@ -99,11 +99,11 @@ abstract class BakkinReaderX(
override fun fetchChapterList(manga: SManga) =
observableSeries { series ->
series.first { it.dir == manga.url }.mapIndexed { idx, chapter ->
series.first { it.dir == manga.url }.map { chapter ->
SChapter.create().apply {
url = chapter.dir
name = chapter.toString()
chapter_number = idx.toFloat()
chapter_number = chapter.number
date_upload = 0L
}
}.reversed()