Feature/Improve chapter download with valid existing download handling (#1553)

* Fix early exit on download for existing download for FolderProvider

The current check only worked for the "ArchiveProvider". The "FolderProvider" never moved the existing download to the cache folder.

In case the existing download is considered to be reusable, there is no need to proceed with the download logic.

* Fix "ArchiveProvider#extractExistingDownload"

The "ChaptersFilesProvider#extractExistingDownload" expects the download to be extracted into the final download folder.
However, the "ArchiveProvider" extracted the download into the chapter download cache folder.

* Add chapter download function call requirements
This commit is contained in:
schroda
2025-08-01 01:55:09 +02:00
committed by GitHub
parent 87aae46a1f
commit 1d9991e562
4 changed files with 69 additions and 58 deletions

View File

@@ -2,6 +2,7 @@ package suwayomi.tachidesk.manga.impl
import kotlinx.coroutines.CoroutineScope
import org.jetbrains.exposed.sql.transactions.transaction
import suwayomi.tachidesk.manga.impl.chapter.getChapterDownloadReady
import suwayomi.tachidesk.manga.impl.download.fileProvider.ChaptersFilesProvider
import suwayomi.tachidesk.manga.impl.download.fileProvider.impl.ArchiveProvider
import suwayomi.tachidesk.manga.impl.download.fileProvider.impl.FolderProvider
@@ -32,6 +33,9 @@ object ChapterDownloadHelper {
chapterId: Int,
): Boolean = provider(mangaId, chapterId).delete()
/**
* This function should never be called without calling [getChapterDownloadReady] beforehand.
*/
suspend fun download(
mangaId: Int,
chapterId: Int,