Index a finished download found on disk instead of downloading it again

This commit is contained in:
AntsyLich
2026-10-10 20:19:06 +06:00
parent f921ec07a6
commit 611578313e
@@ -393,6 +393,16 @@ class Downloader(
download.chapter.scanlator,
download.chapter.url,
)
// Being stopped after the download is moved into place but before it's indexed leaves a finished download
// on disk that is still queued, and downloading it again would save a second copy next to it
if (mangaDir.findFile("$chapterDirname.cbz") != null || mangaDir.findFile(chapterDirname) != null) {
mangaDir.findFile(chapterDirname + TMP_DIR_SUFFIX)?.delete()
cache.addChapter(chapterDirname, mangaDir, download.manga)
download.status = Download.State.DOWNLOADED
return
}
val tmpDir = mangaDir.createDirectory(chapterDirname + TMP_DIR_SUFFIX)!!
try {