mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-11 23:04:33 -05:00
Feature/decouple thumbnail downloads and cache (#581)
* Rename "DownloadedFilesProvider" to "ChaptersFilesProvider" * Move files into sub packages * Further abstract "DownloadedFilesProvider" * Rename "getCachedImageResponse" to "getImageResponse" * Extract getting cached image response into new function * Decouple thumbnail cache and download * Download and delete permanent thumbnails When adding/removing manga from/to the library make sure the permanent thumbnail files will get handled properly * Move thumbnail cache to actual temp folder * Rename "mangaDownloadsRoot" to "downloadRoot" * Move manga downloads into "mangas" subfolder * Clear downloaded thumbnail
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
package suwayomi.tachidesk.manga.impl
|
||||
|
||||
import suwayomi.tachidesk.manga.impl.download.fileProvider.impl.ThumbnailFileProvider
|
||||
import java.io.InputStream
|
||||
|
||||
object ThumbnailDownloadHelper {
|
||||
fun getImage(mangaId: Int): Pair<InputStream, String> {
|
||||
return provider(mangaId).getImage().execute()
|
||||
}
|
||||
|
||||
fun delete(mangaId: Int): Boolean {
|
||||
return provider(mangaId).delete()
|
||||
}
|
||||
|
||||
suspend fun download(mangaId: Int): Boolean {
|
||||
return provider(mangaId).download().execute()
|
||||
}
|
||||
|
||||
// return the appropriate provider based on how the download was saved. For the logic is simple but will evolve when new types of downloads are available
|
||||
private fun provider(mangaId: Int): ThumbnailFileProvider {
|
||||
return ThumbnailFileProvider(mangaId)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user