Webnovel updates (#16246)

Add On Hiatus status and update cycle to description
This commit is contained in:
AntsyLich 2023-05-01 03:29:40 +06:00 committed by GitHub
parent 2e68fc15f6
commit e55fb1a7fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 8 deletions

View File

@ -6,7 +6,7 @@ ext {
extName = 'Webnovel.com'
pkgNameSuffix = 'en.webnovel'
extClass = '.Webnovel'
extVersionCode = 7
extVersionCode = 8
}
apply from: "$rootDir/common.gradle"

View File

@ -22,6 +22,7 @@ import uy.kohesive.injekt.injectLazy
import java.io.IOException
import java.util.Calendar
import java.util.Date
import java.util.Locale
class Webnovel : HttpSource() {
@ -130,11 +131,18 @@ class Webnovel : HttpSource() {
url = comic.id
thumbnail_url = getCoverUrl(comic.id)
author = comic.authorName
description = comic.description
description = buildString {
append(comic.description)
if (comic.actionStatus == ComicDetailInfoDto.ONGOING && comic.updateCycle.isNotBlank()) {
append("\n\nInformation:")
append("\n${comic.updateCycle.replaceFirstChar { it.uppercase(Locale.ENGLISH) }}")
}
}
genre = comic.categoryName
status = when (comic.actionStatus) {
1 -> SManga.ONGOING
2 -> SManga.COMPLETED
ComicDetailInfoDto.ONGOING -> SManga.ONGOING
ComicDetailInfoDto.COMPLETED -> SManga.COMPLETED
ComicDetailInfoDto.ON_HIATUS -> SManga.ON_HIATUS
else -> SManga.UNKNOWN
}
}

View File

@ -41,7 +41,14 @@ data class ComicDetailInfoDto(
val authorName: String,
val categoryName: String,
val description: String,
)
val updateCycle: String,
) {
companion object {
const val ONGOING = 1
const val COMPLETED = 2
const val ON_HIATUS = 3
}
}
@Serializable
data class ComicChapterListDto(
@ -63,17 +70,17 @@ data class ComicChapterDto(
@Serializable
data class ChapterContentResponseDto(
@SerialName("chapterInfo") val chapterContent: ChapterContentDto
@SerialName("chapterInfo") val chapterContent: ChapterContentDto,
)
@Serializable
data class ChapterContentDto(
@SerialName("chapterId") val id: Long,
@SerialName("chapterPage") val pages: List<ChapterPageDto>
@SerialName("chapterPage") val pages: List<ChapterPageDto>,
)
@Serializable
data class ChapterPageDto(
@SerialName("pageId") val id: String,
val url: String
val url: String,
)