Add aggressive page loading
This commit is contained in:
parent
ea7ff432b2
commit
2a60c828d7
@ -192,4 +192,6 @@ object PreferenceKeys {
|
||||
const val eh_autoUpdateRestrictions = "eh_auto_update_restrictions"
|
||||
|
||||
const val eh_autoUpdateStats = "eh_auto_update_stats"
|
||||
|
||||
const val eh_aggressivePageLoading = "eh_aggressive_page_loading"
|
||||
}
|
||||
|
@ -265,4 +265,6 @@ class PreferencesHelper(val context: Context) {
|
||||
fun eh_autoUpdateRequirements() = prefs.getStringSet(Keys.eh_autoUpdateRestrictions, emptySet())
|
||||
|
||||
fun eh_autoUpdateStats() = rxPrefs.getString(Keys.eh_autoUpdateStats, "")
|
||||
|
||||
fun eh_aggressivePageLoading() = rxPrefs.getBoolean(Keys.eh_aggressivePageLoading, false)
|
||||
}
|
||||
|
@ -52,7 +52,11 @@ class HttpPageLoader(
|
||||
// EXH <--
|
||||
subscriptions += Observable.defer { Observable.just(queue.take().page) }
|
||||
.filter { it.status == Page.QUEUE }
|
||||
.concatMap { source.fetchImageFromCacheThenNet(it) }
|
||||
.concatMap {
|
||||
source.fetchImageFromCacheThenNet(it).doOnNext {
|
||||
XLog.d("Downloaded page: ${it.number}!")
|
||||
}
|
||||
}
|
||||
.repeat()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe({
|
||||
@ -98,9 +102,17 @@ class HttpPageLoader(
|
||||
.getPageListFromCache(chapter.chapter)
|
||||
.onErrorResumeNext { source.fetchPageList(chapter.chapter) }
|
||||
.map { pages ->
|
||||
pages.mapIndexed { index, page -> // Don't trust sources and use our own indexing
|
||||
val rp = pages.mapIndexed { index, page -> // Don't trust sources and use our own indexing
|
||||
ReaderPage(index, page.url, page.imageUrl)
|
||||
}
|
||||
if(prefs.eh_aggressivePageLoading().getOrDefault()) {
|
||||
rp.mapNotNull {
|
||||
if (it.status == Page.QUEUE) {
|
||||
PriorityPage(it, 0)
|
||||
} else null
|
||||
}.forEach { queue.offer(it) }
|
||||
}
|
||||
rp
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -100,6 +100,12 @@ class SettingsReaderController : SettingsController() {
|
||||
defaultValue = "2"
|
||||
summary = "Higher values can speed up image downloading significantly, but can also trigger bans. Recommended value is 2 or 3. Current value is: %s"
|
||||
}
|
||||
switchPreference {
|
||||
key = Keys.eh_aggressivePageLoading
|
||||
title = "Aggressively load pages"
|
||||
summary = "Slowly download the entire gallery while reading instead of just loading the pages you are viewing."
|
||||
defaultValue = true
|
||||
}
|
||||
switchPreference {
|
||||
key = Keys.eh_readerInstantRetry
|
||||
title = "Skip queue on retry"
|
||||
|
Loading…
x
Reference in New Issue
Block a user