Webtoons: Option to use sequential chapter numbers + french regex fix (#10451)

* fix(Webtoons): update chapter number handling

* update extVersionCode to 52

* revert to old ver to add 2 options

* Update src/all/webtoons/src/eu/kanade/tachiyomi/extension/all/webtoons/Webtoons.kt
This commit is contained in:
Aurel 2025-09-16 03:30:30 +02:00 committed by Draff
parent 8ad92cc053
commit 901630551a
Signed by: Draff
GPG Key ID: E8A89F3211677653
2 changed files with 12 additions and 3 deletions

View File

@ -1,7 +1,7 @@
ext {
extName = 'Webtoons.com'
extClass = '.WebtoonsFactory'
extVersionCode = 51
extVersionCode = 52
isNsfw = false
}

View File

@ -298,7 +298,7 @@ open class Webtoons(
}
}
if (unrecognized > recognized) {
if (useSequentialNumberingPref() || unrecognized > recognized) {
chapters.onEachIndexed { index, chapter ->
chapter.chapterNumber = (index + 1).toFloat()
}
@ -353,7 +353,7 @@ open class Webtoons(
// possible bonus/mini/special episode - 6 capture group
// episode number - 11 capture group
private val episodeNoRegex = Regex(
"""(?:(s(eason)?|part|vol(ume)?)\s*\.?\s*(\d+).*?)?(.*?(mini|bonus|special).*?)?(e(p(isode)?)?|ch(apter)?)\s*\.?\s*(\d+(\.\d+)?)""",
"""(?:(s(eason)?|saison|part|vol(ume)?)\s*\.?\s*(\d+).*?)?(.*?(mini|bonus|special).*?)?(e(p(isode)?)?|ch(apter)?)\s*\.?\s*(\d+(\.\d+)?)""",
RegexOption.IGNORE_CASE,
)
@ -416,6 +416,7 @@ open class Webtoons(
private fun showAuthorsNotesPref() = preferences.getBoolean(SHOW_AUTHORS_NOTES_KEY, false)
private fun useMaxQualityPref() = preferences.getBoolean(USE_MAX_QUALITY_KEY, false)
private fun useSequentialNumberingPref() = preferences.getBoolean(USE_SEQUENTIAL_NUMBERING_KEY, false)
override fun setupPreferenceScreen(screen: PreferenceScreen) {
SwitchPreferenceCompat(screen.context).apply {
@ -431,6 +432,13 @@ open class Webtoons(
summary = "Enable to load images in maximum quality."
setDefaultValue(false)
}.also(screen::addPreference)
SwitchPreferenceCompat(screen.context).apply {
key = USE_SEQUENTIAL_NUMBERING_KEY
title = "Use sequential chapter numbering"
summary = "Enable to use sequential numbering instead of official episode numbers."
setDefaultValue(false)
}.also(screen::addPreference)
}
override fun imageUrlParse(response: Response): String {
@ -440,4 +448,5 @@ open class Webtoons(
private const val SHOW_AUTHORS_NOTES_KEY = "showAuthorsNotes"
private const val USE_MAX_QUALITY_KEY = "useMaxQuality"
private const val USE_SEQUENTIAL_NUMBERING_KEY = "useSequentialNumbering"
const val ID_SEARCH_PREFIX = "id:"