mirror of
https://git.mihon.tech/mihonapp/mihon
synced 2024-11-27 09:44:55 +03:00
Fix tmp cbzs are counted towards manga download count (#7909)
* Fix tmp cbzs are counted towards manga download count * Review Changes * Review Changes 2
This commit is contained in:
parent
8ef200861c
commit
a43754e1a6
2 changed files with 7 additions and 5 deletions
|
@ -107,9 +107,7 @@ class DownloadCache(
|
|||
if (sourceDir != null) {
|
||||
val mangaDir = sourceDir.files[provider.getMangaDirName(manga.title)]
|
||||
if (mangaDir != null) {
|
||||
return mangaDir.files
|
||||
.filter { !it.endsWith(Downloader.TMP_DIR_SUFFIX) }
|
||||
.size
|
||||
return mangaDir.files.size
|
||||
}
|
||||
}
|
||||
return 0
|
||||
|
@ -155,7 +153,11 @@ class DownloadCache(
|
|||
mangaDirs.values.forEach { mangaDir ->
|
||||
val chapterDirs = mangaDir.dir.listFiles()
|
||||
.orEmpty()
|
||||
.mapNotNull { it.name?.replace(".cbz", "") }
|
||||
.mapNotNull { chapterDir ->
|
||||
chapterDir.name
|
||||
?.replace(".cbz", "")
|
||||
?.takeUnless { it.endsWith(Downloader.TMP_DIR_SUFFIX) }
|
||||
}
|
||||
.toHashSet()
|
||||
|
||||
mangaDir.files = chapterDirs
|
||||
|
|
|
@ -541,7 +541,7 @@ class Downloader(
|
|||
dirname: String,
|
||||
tmpDir: UniFile,
|
||||
) {
|
||||
val zip = mangaDir.createFile("$dirname.cbz.tmp")
|
||||
val zip = mangaDir.createFile("$dirname.cbz$TMP_DIR_SUFFIX")
|
||||
ZipOutputStream(BufferedOutputStream(zip.openOutputStream())).use { zipOut ->
|
||||
zipOut.setMethod(ZipEntry.STORED)
|
||||
|
||||
|
|
Loading…
Reference in a new issue