Feature/graphql chapter pages mutation handle downloaded chapters (#665)

* Update chapter page refresh logic with logic from "ChapterMutation"

* Rename function to "getChapterDownloadReadyByIndex"

* Update "ChapterForDownload" to work with only "chapterId" being passed

* Return database chapter page list in case chapter is downloaded

In case the chapter is downloaded, fetching the chapter pages info should not be needed.
It should also currently break reading downloaded chapters while being offline, since the page request will always fail, since there is no internet connection
This commit is contained in:
schroda
2023-08-28 04:38:33 +02:00
committed by GitHub
parent 3343007cf8
commit 9ee3f46ff0
4 changed files with 54 additions and 77 deletions

View File

@@ -20,7 +20,7 @@ import org.jetbrains.exposed.sql.and
import org.jetbrains.exposed.sql.transactions.transaction
import org.jetbrains.exposed.sql.update
import suwayomi.tachidesk.manga.impl.ChapterDownloadHelper
import suwayomi.tachidesk.manga.impl.chapter.getChapterDownloadReady
import suwayomi.tachidesk.manga.impl.chapter.getChapterDownloadReadyByIndex
import suwayomi.tachidesk.manga.impl.download.model.DownloadChapter
import suwayomi.tachidesk.manga.impl.download.model.DownloadState.Downloading
import suwayomi.tachidesk.manga.impl.download.model.DownloadState.Error
@@ -98,7 +98,7 @@ class Downloader(
download.state = Downloading
step(download, true)
download.chapter = getChapterDownloadReady(download.chapterIndex, download.mangaId)
download.chapter = getChapterDownloadReadyByIndex(download.chapterIndex, download.mangaId)
step(download, false)
ChapterDownloadHelper.download(download.mangaId, download.chapter.id, download, scope, this::step)