Merge pull request #5 from Zehkul/merged-chapters
Handle updates through merged chapters
This commit is contained in:
@@ -6,7 +6,7 @@ ext {
|
||||
extName = 'Kavita'
|
||||
pkgNameSuffix = 'all.kavita'
|
||||
extClass = '.KavitaFactory'
|
||||
extVersionCode = 15
|
||||
extVersionCode = 16
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
@@ -513,11 +513,14 @@ class Kavita(private val suffix: String = "") : ConfigurableSource, UnmeteredSou
|
||||
* Fetches the "url" of each page from the chapter
|
||||
* **/
|
||||
override fun pageListRequest(chapter: SChapter): Request {
|
||||
return GET("$apiUrl/${chapter.url}", headersBuilder().build())
|
||||
// remove potential _<part> chapter salt
|
||||
val chapterId = chapter.url.substringBefore("_")
|
||||
return GET("$apiUrl/$chapterId", headersBuilder().build())
|
||||
}
|
||||
|
||||
override fun fetchPageList(chapter: SChapter): Observable<List<Page>> {
|
||||
val chapterId = chapter.url
|
||||
// remove potential _<part> chapter salt
|
||||
val chapterId = chapter.url.substringBefore("_")
|
||||
val numPages = chapter.scanlator?.replace(" pages", "")?.toInt()
|
||||
val numPages2 = "$numPages".toInt() - 1
|
||||
val pages = mutableListOf<Page>()
|
||||
|
||||
@@ -98,6 +98,13 @@ class KavitaHelper {
|
||||
}
|
||||
|
||||
url = chapter.id.toString()
|
||||
|
||||
if (chapter.fileCount > 1) {
|
||||
// salt/offset to recognize chapters with new merged part-chapters as new and hence unread
|
||||
chapter_number += 0.001f * chapter.fileCount
|
||||
url = "${url}_${chapter.fileCount}"
|
||||
}
|
||||
|
||||
date_upload = parseDate(chapter.created)
|
||||
scanlator = "${chapter.pages} pages"
|
||||
}
|
||||
|
||||
@@ -123,4 +123,13 @@ data class ChapterDto(
|
||||
val coverImageLocked: Boolean,
|
||||
val volumeId: Int,
|
||||
val created: String,
|
||||
val files: List<FileDto>? = null,
|
||||
) {
|
||||
val fileCount: Int
|
||||
get() = files?.size ?: 0
|
||||
}
|
||||
|
||||
@Serializable
|
||||
data class FileDto(
|
||||
val id: Int,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user