Update metadata in same scope as the rest of library update (fixes #5702, probably)
(cherry picked from commit 7c1e55eb7fa7568f99577ae3534a61876842b362)
This commit is contained in:
parent
c04550fe15
commit
4d3e4bbea8
@ -58,7 +58,6 @@ import exh.util.nullIfBlank
|
|||||||
import kotlinx.coroutines.CoroutineExceptionHandler
|
import kotlinx.coroutines.CoroutineExceptionHandler
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.GlobalScope
|
|
||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
import kotlinx.coroutines.SupervisorJob
|
import kotlinx.coroutines.SupervisorJob
|
||||||
import kotlinx.coroutines.async
|
import kotlinx.coroutines.async
|
||||||
@ -471,12 +470,8 @@ class LibraryUpdateService(
|
|||||||
suspend fun updateManga(manga: Manga, loggedServices: List<TrackService>): Pair<List<Chapter>, List<Chapter>> {
|
suspend fun updateManga(manga: Manga, loggedServices: List<TrackService>): Pair<List<Chapter>, List<Chapter>> {
|
||||||
val source = sourceManager.getOrStub(manga.source).getMainSource()
|
val source = sourceManager.getOrStub(manga.source).getMainSource()
|
||||||
|
|
||||||
// Update manga details metadata in the background
|
// Update manga details metadata
|
||||||
if (preferences.autoUpdateMetadata()) {
|
if (preferences.autoUpdateMetadata()) {
|
||||||
val handler = CoroutineExceptionHandler { _, exception ->
|
|
||||||
logcat(LogPriority.ERROR, exception)
|
|
||||||
}
|
|
||||||
GlobalScope.launch(Dispatchers.IO + handler) {
|
|
||||||
val updatedManga = source.getMangaDetails(manga.toMangaInfo())
|
val updatedManga = source.getMangaDetails(manga.toMangaInfo())
|
||||||
val sManga = updatedManga.toSManga()
|
val sManga = updatedManga.toSManga()
|
||||||
// Avoid "losing" existing cover
|
// Avoid "losing" existing cover
|
||||||
@ -489,7 +484,6 @@ class LibraryUpdateService(
|
|||||||
manga.copyFrom(sManga)
|
manga.copyFrom(sManga)
|
||||||
db.insertManga(manga).executeAsBlocking()
|
db.insertManga(manga).executeAsBlocking()
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// SY -->
|
// SY -->
|
||||||
if (source.isMdBasedSource() && trackManager.mdList in loggedServices) {
|
if (source.isMdBasedSource() && trackManager.mdList in loggedServices) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user