mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-11 23:04:33 -05:00
Decouple Cache and Download behaviour (#493)
* Separate cache dir from download dir * Move downloader logic outside of caching/image download logic * remove unnecessary method duplication * moved download logic inside download provider * optimize and handle partial downloads * made code review changes
This commit is contained in:
@@ -15,7 +15,6 @@ import org.jetbrains.exposed.sql.and
|
||||
import org.jetbrains.exposed.sql.select
|
||||
import org.jetbrains.exposed.sql.transactions.transaction
|
||||
import org.jetbrains.exposed.sql.update
|
||||
import suwayomi.tachidesk.manga.impl.util.getChapterDir
|
||||
import suwayomi.tachidesk.manga.impl.util.lang.awaitSingle
|
||||
import suwayomi.tachidesk.manga.impl.util.source.GetCatalogueSource.getCatalogueSourceOrStub
|
||||
import suwayomi.tachidesk.manga.impl.util.storage.ImageResponse.getImageResponse
|
||||
@@ -82,11 +81,13 @@ object Page {
|
||||
}
|
||||
}
|
||||
|
||||
val chapterDir = getChapterDir(mangaId, chapterId)
|
||||
File(chapterDir).mkdirs()
|
||||
val fileName = getPageName(index)
|
||||
|
||||
return getImageResponse(chapterDir, fileName, useCache) {
|
||||
if (chapterEntry[ChapterTable.isDownloaded]) {
|
||||
return ChapterDownloadHelper.getImage(mangaId, chapterId, index)
|
||||
}
|
||||
|
||||
return getImageResponse(mangaId, chapterId, fileName, useCache) {
|
||||
source.fetchImage(tachiyomiPage).awaitSingle()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user