Fix EHentai reading progress not carrying over
This commit is contained in:
parent
b64ecfb836
commit
141edac99b
@ -191,6 +191,8 @@ class EHentai(override val id: Long,
|
|||||||
}!!.nextElementSibling().text()).time
|
}!!.nextElementSibling().text()).time
|
||||||
}
|
}
|
||||||
// Build and append the rest of the galleries
|
// Build and append the rest of the galleries
|
||||||
|
if(DebugToggles.INCLUDE_ONLY_ROOT_WHEN_LOADING_EXH_VERSIONS.enabled) listOf(self)
|
||||||
|
else {
|
||||||
newDisplay.mapIndexed { index, newGallery ->
|
newDisplay.mapIndexed { index, newGallery ->
|
||||||
val link = newGallery.attr("href")
|
val link = newGallery.attr("href")
|
||||||
val name = newGallery.text()
|
val name = newGallery.text()
|
||||||
@ -202,6 +204,7 @@ class EHentai(override val id: Long,
|
|||||||
this.date_upload = EX_DATE_FORMAT.parse(posted).time
|
this.date_upload = EX_DATE_FORMAT.parse(posted).time
|
||||||
}
|
}
|
||||||
}.reversed() + self
|
}.reversed() + self
|
||||||
|
}
|
||||||
}.toObservable()
|
}.toObservable()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,8 @@ import eu.kanade.tachiyomi.data.database.models.Manga
|
|||||||
import eu.kanade.tachiyomi.source.Source
|
import eu.kanade.tachiyomi.source.Source
|
||||||
import eu.kanade.tachiyomi.source.model.SChapter
|
import eu.kanade.tachiyomi.source.model.SChapter
|
||||||
import eu.kanade.tachiyomi.source.online.HttpSource
|
import eu.kanade.tachiyomi.source.online.HttpSource
|
||||||
|
import exh.EH_SOURCE_ID
|
||||||
|
import exh.EXH_SOURCE_ID
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -118,6 +120,21 @@ fun syncChaptersWithSource(db: DatabaseHelper,
|
|||||||
readded.add(c)
|
readded.add(c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --> EXH (carry over reading progress)
|
||||||
|
if(manga.source == EH_SOURCE_ID || manga.source == EXH_SOURCE_ID) {
|
||||||
|
val finalAdded = toAdd.subtract(readded)
|
||||||
|
if(finalAdded.isNotEmpty()) {
|
||||||
|
val max = dbChapters.maxBy { it.last_page_read }
|
||||||
|
if (max != null && max.last_page_read > 0) {
|
||||||
|
for (chapter in finalAdded) {
|
||||||
|
chapter.last_page_read = max.last_page_read
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// <-- EXH
|
||||||
|
|
||||||
db.insertChapters(toAdd).executeAsBlocking()
|
db.insertChapters(toAdd).executeAsBlocking()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,10 +4,16 @@ import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
|||||||
import uy.kohesive.injekt.injectLazy
|
import uy.kohesive.injekt.injectLazy
|
||||||
|
|
||||||
enum class DebugToggles(val default: Boolean) {
|
enum class DebugToggles(val default: Boolean) {
|
||||||
|
// Redirect to master version of gallery when encountering a gallery that has a parent/child that is already in the library
|
||||||
ENABLE_EXH_ROOT_REDIRECT(true),
|
ENABLE_EXH_ROOT_REDIRECT(true),
|
||||||
|
// Enable debug overlay (only available in debug builds)
|
||||||
ENABLE_DEBUG_OVERLAY(true),
|
ENABLE_DEBUG_OVERLAY(true),
|
||||||
|
// Convert non-root galleries into root galleries when loading them
|
||||||
PULL_TO_ROOT_WHEN_LOADING_EXH_MANGA_DETAILS(true),
|
PULL_TO_ROOT_WHEN_LOADING_EXH_MANGA_DETAILS(true),
|
||||||
RESTRICT_EXH_GALLERY_UPDATE_CHECK_FREQUENCY(true);
|
// Do not update the same gallery too often
|
||||||
|
RESTRICT_EXH_GALLERY_UPDATE_CHECK_FREQUENCY(true),
|
||||||
|
// Pretend that all galleries only have a single version
|
||||||
|
INCLUDE_ONLY_ROOT_WHEN_LOADING_EXH_VERSIONS(false);
|
||||||
|
|
||||||
val prefKey = "eh_debug_toggle_${name.toLowerCase()}"
|
val prefKey = "eh_debug_toggle_${name.toLowerCase()}"
|
||||||
|
|
||||||
|
@ -87,9 +87,7 @@ class EHentaiUpdateHelper(context: Context) {
|
|||||||
.fold(accepted.chapters) { curChapters, chapter ->
|
.fold(accepted.chapters) { curChapters, chapter ->
|
||||||
val existing = curChapters.find { it.url == chapter.url }
|
val existing = curChapters.find { it.url == chapter.url }
|
||||||
|
|
||||||
val newLastPageRead = chainsAsChapters.filter { it.date_upload < chapter.date_upload }.maxBy {
|
val newLastPageRead = chainsAsChapters.maxBy { it.last_page_read }?.last_page_read
|
||||||
it.last_page_read
|
|
||||||
}?.last_page_read
|
|
||||||
|
|
||||||
if (existing != null) {
|
if (existing != null) {
|
||||||
existing.read = existing.read || chapter.read
|
existing.read = existing.read || chapter.read
|
||||||
|
Loading…
x
Reference in New Issue
Block a user