diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadCache.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadCache.kt index b5c5d8c520..72c3f2a997 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadCache.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadCache.kt @@ -100,7 +100,9 @@ class DownloadCache( if (sourceDir != null) { val mangaDir = sourceDir.files[provider.getMangaDirName(manga)] if (mangaDir != null) { - return mangaDir.files.size + return mangaDir.files + .filter { !it.endsWith(Downloader.TMP_DIR_SUFFIX) } + .size } } return 0 diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt index 3da98fc0c2..82915d90fa 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt @@ -246,7 +246,7 @@ class Downloader( private fun downloadChapter(download: Download): Observable = Observable.defer { val chapterDirname = provider.getChapterDirName(download.chapter) val mangaDir = provider.getMangaDir(download.manga, download.source) - val tmpDir = mangaDir.createDirectory("${chapterDirname}_tmp") + val tmpDir = mangaDir.createDirectory(chapterDirname + TMP_DIR_SUFFIX) val pageListObservable = if (download.pages == null) { // Pull page list from network and add them to download object @@ -436,4 +436,8 @@ class Downloader( return queue.none { it.status <= Download.DOWNLOADING } } + companion object { + const val TMP_DIR_SUFFIX = "_tmp" + } + }