mirror of
https://github.com/mihonapp/mihon.git
synced 2024-12-27 19:38:23 +01: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
@ -107,9 +107,7 @@ class DownloadCache(
|
|||||||
if (sourceDir != null) {
|
if (sourceDir != null) {
|
||||||
val mangaDir = sourceDir.files[provider.getMangaDirName(manga.title)]
|
val mangaDir = sourceDir.files[provider.getMangaDirName(manga.title)]
|
||||||
if (mangaDir != null) {
|
if (mangaDir != null) {
|
||||||
return mangaDir.files
|
return mangaDir.files.size
|
||||||
.filter { !it.endsWith(Downloader.TMP_DIR_SUFFIX) }
|
|
||||||
.size
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0
|
return 0
|
||||||
@ -155,7 +153,11 @@ class DownloadCache(
|
|||||||
mangaDirs.values.forEach { mangaDir ->
|
mangaDirs.values.forEach { mangaDir ->
|
||||||
val chapterDirs = mangaDir.dir.listFiles()
|
val chapterDirs = mangaDir.dir.listFiles()
|
||||||
.orEmpty()
|
.orEmpty()
|
||||||
.mapNotNull { it.name?.replace(".cbz", "") }
|
.mapNotNull { chapterDir ->
|
||||||
|
chapterDir.name
|
||||||
|
?.replace(".cbz", "")
|
||||||
|
?.takeUnless { it.endsWith(Downloader.TMP_DIR_SUFFIX) }
|
||||||
|
}
|
||||||
.toHashSet()
|
.toHashSet()
|
||||||
|
|
||||||
mangaDir.files = chapterDirs
|
mangaDir.files = chapterDirs
|
||||||
|
@ -541,7 +541,7 @@ class Downloader(
|
|||||||
dirname: String,
|
dirname: String,
|
||||||
tmpDir: UniFile,
|
tmpDir: UniFile,
|
||||||
) {
|
) {
|
||||||
val zip = mangaDir.createFile("$dirname.cbz.tmp")
|
val zip = mangaDir.createFile("$dirname.cbz$TMP_DIR_SUFFIX")
|
||||||
ZipOutputStream(BufferedOutputStream(zip.openOutputStream())).use { zipOut ->
|
ZipOutputStream(BufferedOutputStream(zip.openOutputStream())).use { zipOut ->
|
||||||
zipOut.setMethod(ZipEntry.STORED)
|
zipOut.setMethod(ZipEntry.STORED)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user