Albirew/tachiyomi
Archivé
1
0
Bifurcation 0

Downloading chapters now always add them from the beginning

Cette révision appartient à :
len 2016-05-27 20:11:37 +02:00
Parent 9aa6da0642
révision 46cc078e93

Voir le fichier

@ -111,11 +111,14 @@ class DownloadManager(private val context: Context, private val sourceManager: S
fun downloadChapters(manga: Manga, chapters: List<Chapter>) { fun downloadChapters(manga: Manga, chapters: List<Chapter>) {
val source = sourceManager.get(manga.source) as? OnlineSource ?: return val source = sourceManager.get(manga.source) as? OnlineSource ?: return
// Add chapters to queue from the start
val sortedChapters = chapters.sortedByDescending { it.source_order }
// Used to avoid downloading chapters with the same name // Used to avoid downloading chapters with the same name
val addedChapters = ArrayList<String>() val addedChapters = ArrayList<String>()
val pending = ArrayList<Download>() val pending = ArrayList<Download>()
for (chapter in chapters) { for (chapter in sortedChapters) {
if (addedChapters.contains(chapter.name)) if (addedChapters.contains(chapter.name))
continue continue