From 0d15cbe334de7f62cb3a5e1fc67bebb5261df86b Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 1 Aug 2020 16:35:52 -0400 Subject: [PATCH] Filter out chapter entries with duplicate URLs (fixes #3552) --- .../tachiyomi/util/chapter/ChapterSourceSync.kt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/chapter/ChapterSourceSync.kt b/app/src/main/java/eu/kanade/tachiyomi/util/chapter/ChapterSourceSync.kt index 34aca30de1..be4a87dc8b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/chapter/ChapterSourceSync.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/chapter/ChapterSourceSync.kt @@ -36,13 +36,15 @@ fun syncChaptersWithSource( // Chapters from db. val dbChapters = db.getChapters(manga).executeAsBlocking() - val sourceChapters = rawSourceChapters.mapIndexed { i, sChapter -> - Chapter.create().apply { - copyFrom(sChapter) - manga_id = manga.id - source_order = i + val sourceChapters = rawSourceChapters + .distinctBy { it.url } + .mapIndexed { i, sChapter -> + Chapter.create().apply { + copyFrom(sChapter) + manga_id = manga.id + source_order = i + } } - } // Chapters from the source not in db. val toAdd = mutableListOf()