mirror of
https://github.com/mihonapp/mihon.git
synced 2026-10-20 07:32:28 -07:00
Index a finished download found on disk instead of downloading it again
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user