Isolate EH and EXH manga redirects

This commit is contained in:
NerdNumber9
2019-08-08 14:45:40 -04:00
parent dce08d4922
commit 14879c4466
3 changed files with 6 additions and 4 deletions

View File

@ -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()