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:
parent
a999e665de
commit
b9dd8b2de4
@ -1,7 +1,7 @@
|
||||
ext {
|
||||
extName = 'Poseidon Scans'
|
||||
extClass = '.PoseidonScans'
|
||||
extVersionCode = 45
|
||||
extVersionCode = 46
|
||||
isNsfw = false
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user