|
|
|
@ -308,9 +308,13 @@ class LibraryUpdateService(
|
|
|
|
|
|
|
|
|
|
// Emit each manga and update it sequentially.
|
|
|
|
|
return Observable.from(mangaToUpdate)
|
|
|
|
|
// Update the chapters of the manga concurrently from 5 different sources
|
|
|
|
|
.groupBy { it.source }
|
|
|
|
|
.flatMap(
|
|
|
|
|
{ bySource ->
|
|
|
|
|
bySource
|
|
|
|
|
// Notify manga that will update.
|
|
|
|
|
.doOnNext { showProgressNotification(it, count.andIncrement, mangaToUpdate.size) }
|
|
|
|
|
// Update the chapters of the manga.
|
|
|
|
|
.concatMap { manga ->
|
|
|
|
|
updateManga(manga)
|
|
|
|
|
// If there's any error, return empty update and continue.
|
|
|
|
@ -334,10 +338,16 @@ class LibraryUpdateService(
|
|
|
|
|
.map {
|
|
|
|
|
Pair(
|
|
|
|
|
manga,
|
|
|
|
|
(it.first.sortedByDescending { ch -> ch.source_order }.toTypedArray())
|
|
|
|
|
(
|
|
|
|
|
it.first.sortedByDescending { ch -> ch.source_order }
|
|
|
|
|
.toTypedArray()
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
5
|
|
|
|
|
)
|
|
|
|
|
// Add manga with new chapters to the list.
|
|
|
|
|
.doOnNext { manga ->
|
|
|
|
|
// Add to the list
|
|
|
|
@ -397,9 +407,13 @@ class LibraryUpdateService(
|
|
|
|
|
|
|
|
|
|
// Emit each manga and update it sequentially.
|
|
|
|
|
return Observable.from(mangaToUpdate)
|
|
|
|
|
// Update the details of the manga concurrently from 5 different sources
|
|
|
|
|
.groupBy { it.source }
|
|
|
|
|
.flatMap(
|
|
|
|
|
{ bySource ->
|
|
|
|
|
bySource
|
|
|
|
|
// Notify manga that will update.
|
|
|
|
|
.doOnNext { showProgressNotification(it, count.andIncrement, mangaToUpdate.size) }
|
|
|
|
|
// Update the details of the manga.
|
|
|
|
|
.concatMap { manga ->
|
|
|
|
|
val source = sourceManager.get(manga.source) as? HttpSource
|
|
|
|
|
?: return@concatMap Observable.empty<LibraryManga>()
|
|
|
|
@ -412,6 +426,9 @@ class LibraryUpdateService(
|
|
|
|
|
}
|
|
|
|
|
.onErrorReturn { manga }
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
5
|
|
|
|
|
)
|
|
|
|
|
.doOnCompleted {
|
|
|
|
|
cancelProgressNotification()
|
|
|
|
|
}
|
|
|
|
|