Filter out tmp directories for download badge

This commit is contained in:
arkon 2020-02-02 18:01:08 -05:00
parent 9588a582ce
commit 6f84815801
2 changed files with 8 additions and 2 deletions

View File

@ -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

View File

@ -246,7 +246,7 @@ class Downloader(
private fun downloadChapter(download: Download): Observable<Download> = 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"
}
}