mirror of
https://github.com/mihonapp/mihon.git
synced 2025-10-28 04:47:56 +01:00
Make metadata updating optional
This commit is contained in:
@@ -334,16 +334,18 @@ class LibraryUpdateService(
|
||||
val source = sourceManager.get(manga.source) ?: return Observable.empty()
|
||||
|
||||
// Update manga details metadata in the background
|
||||
source.fetchMangaDetails(manga)
|
||||
.map { networkManga ->
|
||||
manga.prepUpdateCover(coverCache, networkManga, false)
|
||||
manga.copyFrom(networkManga)
|
||||
db.insertManga(manga).executeAsBlocking()
|
||||
manga
|
||||
}
|
||||
.onErrorResumeNext { Observable.just(manga) }
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe()
|
||||
if (preferences.autoUpdateMetadata()) {
|
||||
source.fetchMangaDetails(manga)
|
||||
.map { networkManga ->
|
||||
manga.prepUpdateCover(coverCache, networkManga, false)
|
||||
manga.copyFrom(networkManga)
|
||||
db.insertManga(manga).executeAsBlocking()
|
||||
manga
|
||||
}
|
||||
.onErrorResumeNext { Observable.just(manga) }
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe()
|
||||
}
|
||||
|
||||
return source.fetchChapterList(manga)
|
||||
.map { syncChaptersWithSource(db, it, manga, source) }
|
||||
|
||||
@@ -123,6 +123,8 @@ object PreferenceKeys {
|
||||
|
||||
const val hideNotificationContent = "hide_notification_content"
|
||||
|
||||
const val autoUpdateMetadata = "auto_update_metadata"
|
||||
|
||||
const val showLibraryUpdateErrors = "show_library_update_errors"
|
||||
|
||||
const val downloadNew = "download_new"
|
||||
|
||||
@@ -67,6 +67,8 @@ class PreferencesHelper(val context: Context) {
|
||||
|
||||
fun hideNotificationContent() = prefs.getBoolean(Keys.hideNotificationContent, false)
|
||||
|
||||
fun autoUpdateMetadata() = prefs.getBoolean(Keys.autoUpdateMetadata, false)
|
||||
|
||||
fun showLibraryUpdateErrors() = prefs.getBoolean(Keys.showLibraryUpdateErrors, false)
|
||||
|
||||
fun clear() = prefs.edit().clear().apply()
|
||||
|
||||
Reference in New Issue
Block a user