Isolate EH and EXH manga redirects
This commit is contained in:
parent
dce08d4922
commit
14879c4466
@ -120,7 +120,7 @@ class ChaptersPresenter(
|
||||
&& DebugToggles.ENABLE_EXH_ROOT_REDIRECT.enabled) {
|
||||
// Check for gallery in library and accept manga with lowest id
|
||||
// Find chapters sharing same root
|
||||
add(updateHelper.findAcceptedRootAndDiscardOthers(chapters)
|
||||
add(updateHelper.findAcceptedRootAndDiscardOthers(manga.source, chapters)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe { (acceptedChain, _) ->
|
||||
// Redirect if we are not the accepted root
|
||||
|
@ -28,7 +28,7 @@ class EHentaiUpdateHelper(context: Context) {
|
||||
*
|
||||
* @return Pair<Accepted, Discarded>
|
||||
*/
|
||||
fun findAcceptedRootAndDiscardOthers(chapters: List<Chapter>): Single<Pair<ChapterChain, List<ChapterChain>>> {
|
||||
fun findAcceptedRootAndDiscardOthers(sourceId: Long, chapters: List<Chapter>): Single<Pair<ChapterChain, List<ChapterChain>>> {
|
||||
// Find other chains
|
||||
val chainsObservable = Observable.merge(chapters.map { chapter ->
|
||||
db.getChapters(chapter.url).asRxSingle().toObservable()
|
||||
@ -42,7 +42,9 @@ class EHentaiUpdateHelper(context: Context) {
|
||||
db.getChaptersByMangaId(mangaId).asRxSingle()
|
||||
) { manga, chapters ->
|
||||
ChapterChain(manga, chapters)
|
||||
}.toObservable()
|
||||
}.toObservable().filter {
|
||||
it.manga.source == sourceId
|
||||
}
|
||||
}
|
||||
)
|
||||
}.toList()
|
||||
|
@ -206,7 +206,7 @@ class EHentaiUpdateWorker: JobService(), CoroutineScope {
|
||||
|
||||
// Find accepted root and discard others
|
||||
val (acceptedRoot, discardedRoots) =
|
||||
updateHelper.findAcceptedRootAndDiscardOthers(chapters).await()
|
||||
updateHelper.findAcceptedRootAndDiscardOthers(manga.source, chapters).await()
|
||||
|
||||
modifiedThisIteration += acceptedRoot.manga.id!!
|
||||
modifiedThisIteration += discardedRoots.map { it.manga.id!! }
|
||||
|
Loading…
x
Reference in New Issue
Block a user