Nicovideo: Adding early access prefix to chapters (#5196)

Adding prefix on early access
This commit is contained in:
ringosham 2024-09-25 14:51:31 +01:00 committed by Draff
parent dd882e091b
commit cddbfcfc1a
No known key found for this signature in database
GPG Key ID: E8A89F3211677653
2 changed files with 7 additions and 3 deletions

View File

@ -1,7 +1,7 @@
ext {
extName = 'Nicovideo Seiga'
extClass = '.NicovideoSeiga'
extVersionCode = 4
extVersionCode = 5
}
apply from: "$rootDir/common.gradle"

View File

@ -114,8 +114,12 @@ class NicovideoSeiga : HttpSource() {
.filter { it.ownership.sellStatus != "publication_finished" }
.map { chapter ->
SChapter.create().apply {
val isPaid = chapter.ownership.sellStatus == "selling"
name = (if (isPaid) "\uD83D\uDCB4 " else "") + chapter.meta.title
val prefix = when (chapter.ownership.sellStatus) {
"selling" -> "\uD83D\uDCB4 "
"pre_selling" -> "\u23F3\uD83D\uDCB4 "
else -> ""
}
name = prefix + chapter.meta.title
// Timestamp is in seconds, convert to milliseconds
date_upload = chapter.meta.createdAt * 1000
// While chapters are properly sorted, authors often add promotional material as "chapters" which breaks trackers