-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/decouple thumbnail downloads and cache #581
Feature/decouple thumbnail downloads and cache #581
Conversation
7e88930
to
8c682d4
Compare
server/src/main/kotlin/suwayomi/tachidesk/manga/impl/util/storage/ImageResponse.kt
Outdated
Show resolved
Hide resolved
@@ -331,13 +331,24 @@ object Chapter { | |||
} | |||
} | |||
|
|||
private fun deleteFilesOf(chapterIds: List<Int>, mangaId: Int) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
choose a better name for this function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renamed it to deleteDownloadsFor
.../main/kotlin/suwayomi/tachidesk/manga/impl/download/fileProvider/IDownloadedFilesProvider.kt
Outdated
Show resolved
Hide resolved
} | ||
|
||
@FunctionalInterface | ||
interface IFileDownload1<A> : IFileDownload { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make up better names instead of numbering
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tbh, no clue how to name this, I added "Args" as an suffix
I'm open for better names
fun getChapterDownloadPath(mangaId: Int, chapterId: Int): String { | ||
return applicationDirs.mangaDownloadsRoot + "/" + getChapterDir(mangaId, chapterId) | ||
return applicationDirs.downloadsRoot + "/mangas/" + getChapterDir(mangaId, chapterId) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bad abstraction here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added mangaDownloadsRoot
to app dirs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also we should use a sensible path joiner function instead of hand concatenating them
8c682d4
to
57d9aac
Compare
01d9723
to
789a6e8
Compare
789a6e8
to
31b1bca
Compare
31b1bca
to
4fdbc05
Compare
server/src/main/kotlin/suwayomi/tachidesk/graphql/mutations/MangaMutation.kt
Outdated
Show resolved
Hide resolved
4fdbc05
to
bf65476
Compare
bf65476
to
39d3dcb
Compare
server/src/main/kotlin/suwayomi/tachidesk/graphql/mutations/MangaMutation.kt
Show resolved
Hide resolved
server/src/main/kotlin/suwayomi/tachidesk/manga/impl/util/storage/SafePath.kt
Outdated
Show resolved
Hide resolved
39d3dcb
to
8e487cc
Compare
e5c5720
to
cb1acd5
Compare
When adding/removing manga from/to the library make sure the permanent thumbnail files will get handled properly
cb1acd5
to
c791f1b
Compare
Currently all thumbnails are downloaded permanently.
This not only includes thumbnails of mangas that are part of the library but also when browsing a source.
Unless you manually cleanup these files, they will never get deleted.
This PR changes thumbnails to be tmp files, which get saved in the systems tmp folder.
Only thumbnails of mangas, that are part of the library, will be saved permanently.
Once a manga gets added/removed from the library, the permanent thumbnail will get downloaded/deleted.
The logic for this reuses the existing logic of the chapter pages.
There had to be slight adaptions to the interface and classes since the functions for the thumbnails and pages have different number of arguments.
Since they are still classes which have to provide the same behaviour with the same functions (e.g. get image, download image, delete image) I wanted to use the same interface
In case the tmp files should not get saved in the systems tmp folder, this can be changed in a later/separate PR which implements a custom cache (which IMO then should also be used for the pages of chapters)