mirror of
https://github.com/Suwayomi/Tachidesk.git
synced 2025-12-10 06:42:07 +01:00
Fix/downloader not creating folder or cbz file (#676)
* Create manga download dir in case it's missing for cbz downloads The directory, in which the cbz file should have been saved in, was never created. * Correctly copy chapter download to final download location "renameTo" does not include the content of a directory. Thus, it just created an empty chapter folder int the final download directory
This commit is contained in:
@@ -11,6 +11,7 @@ import suwayomi.tachidesk.manga.impl.download.fileProvider.ChaptersFilesProvider
|
||||
import suwayomi.tachidesk.manga.impl.download.model.DownloadChapter
|
||||
import suwayomi.tachidesk.manga.impl.util.getChapterCachePath
|
||||
import suwayomi.tachidesk.manga.impl.util.getChapterCbzPath
|
||||
import suwayomi.tachidesk.manga.impl.util.getMangaDownloadDir
|
||||
import java.io.File
|
||||
import java.io.InputStream
|
||||
|
||||
@@ -29,6 +30,7 @@ class ArchiveProvider(mangaId: Int, chapterId: Int) : ChaptersFilesProvider(mang
|
||||
scope: CoroutineScope,
|
||||
step: suspend (DownloadChapter?, Boolean) -> Unit
|
||||
): Boolean {
|
||||
val mangaDownloadFolder = File(getMangaDownloadDir(mangaId))
|
||||
val outputFile = File(getChapterCbzPath(mangaId, chapterId))
|
||||
val chapterCacheFolder = File(getChapterCachePath(mangaId, chapterId))
|
||||
if (outputFile.exists()) handleExistingCbzFile(outputFile, chapterCacheFolder)
|
||||
@@ -36,6 +38,7 @@ class ArchiveProvider(mangaId: Int, chapterId: Int) : ChaptersFilesProvider(mang
|
||||
super.downloadImpl(download, scope, step)
|
||||
|
||||
withContext(Dispatchers.IO) {
|
||||
mangaDownloadFolder.mkdirs()
|
||||
outputFile.createNewFile()
|
||||
}
|
||||
|
||||
|
||||
@@ -40,9 +40,8 @@ class FolderProvider(mangaId: Int, chapterId: Int) : ChaptersFilesProvider(manga
|
||||
return false
|
||||
}
|
||||
|
||||
folder.mkdirs()
|
||||
val cacheChapterDir = getChapterCachePath(mangaId, chapterId)
|
||||
File(cacheChapterDir).renameTo(folder)
|
||||
File(cacheChapterDir).copyRecursively(folder, true)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -48,6 +48,10 @@ fun getThumbnailDownloadPath(mangaId: Int): String {
|
||||
return applicationDirs.thumbnailDownloadsRoot + "/$mangaId"
|
||||
}
|
||||
|
||||
fun getMangaDownloadDir(mangaId: Int): String {
|
||||
return applicationDirs.mangaDownloadsRoot + "/" + getMangaDir(mangaId)
|
||||
}
|
||||
|
||||
fun getChapterDownloadPath(mangaId: Int, chapterId: Int): String {
|
||||
return applicationDirs.mangaDownloadsRoot + "/" + getChapterDir(mangaId, chapterId)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user