Fix PoseidonScans missing premium chapters and volume detection (#10389)

* feat(PoseidonScans): enhance chapter filtering logic for premium chapters & add Volume parsing

* Correct indentation

* refactor(PoseidonScans): fix reviews
This commit is contained in:
Aurel 2025-09-05 16:21:56 +02:00 committed by Draff
parent a999e665de
commit b9dd8b2de4
Signed by: Draff
GPG Key ID: E8A89F3211677653
3 changed files with 29 additions and 3 deletions

View File

@ -1,7 +1,7 @@
ext {
extName = 'Poseidon Scans'
extClass = '.PoseidonScans'
extVersionCode = 45
extVersionCode = 46
isNsfw = false
}

View File

@ -388,11 +388,35 @@ class PoseidonScans : HttpSource() {
}
return mangaDto.chapters
?.filter { it.isPremium != true }
?.mapNotNull { ch ->
// If chapter is premium, check if premium period has expired
if (ch.isPremium == true) {
ch.premiumUntil?.let { premiumUntilString ->
val premiumUntilDate = parseIsoDate(premiumUntilString)
if (premiumUntilDate > 0) {
// Exclude if premium period is still active
if (System.currentTimeMillis() <= premiumUntilDate) {
return@mapNotNull null
}
} else {
// If we can't parse the premium until date, exclude the chapter for safety
return@mapNotNull null
}
} ?: return@mapNotNull null // If premiumUntil is null but isPremium is true, exclude
}
val chapterNumberString = ch.number.toString().removeSuffix(".0")
SChapter.create().apply {
val baseName = "Chapitre $chapterNumberString"
val isVolume = ch.isVolume == true || (
ch.number == ch.number.toInt().toFloat() &&
ch.title?.lowercase()?.contains("volume") == true
)
val baseName = if (isVolume) {
"Volume $chapterNumberString"
} else {
"Chapitre $chapterNumberString"
}
name = ch.title?.trim()?.takeIf { it.isNotBlank() }
?.let { title -> "$baseName - $title" }
?: baseName

View File

@ -41,6 +41,8 @@ class ChapterData(
val title: String? = null,
val createdAt: String,
val isPremium: Boolean? = false,
val premiumUntil: String? = null,
val isVolume: Boolean? = false,
)
@Serializable