This implements a cache for thumbnails and image previews for non-image file formats, like videos and PDFs.
This patch extends the inbuilt image preview feature (285df85) by integrating the allmytoes crate and using its thumbnails instead of the actual file being previewed.
This increases performance for the image-preview because the preview does not need to load the full-sized version of the image and does not need to scale it down every time, once the thumbnail has been created. Also, thumbnails are now shared with other programs that use the XDG-thumb cache.
Furthermore, the new way to obtain thumbs allows to show image-previews for file types other than images. Existing thumbnails are shown for any file type. New thumbnails can be created for many video formats, PDF files, Postscript files, and SVGs. Users can also add “providers” for other file-types by configuring allmytoes.
The XDG-thumb feature can be disabled, and the thumbnail-size can be changed, both in joshuto.toml. The documentation has been extended, the whole image-preview page has been enhanced a little.
AllMyToes is currently GPL licensed. As I'm the author, I sill dare to provide this PR, even though Joshuto is LGPL. 🙂 I will eventually change the license soon, most probably to MIT.
I have never tested AllMyToes on Mac and I have no idea if that works. If MacOS does not use a "magic" database for mime-types like Linux does, it will probably not work. Mac users would need to switch off this feature. If there are Mac users around, I would appreciate some feedback.
Clippy's failure in the pipeline seems not to be related to the changes in this PR but because of the latest Rust update to 1.78.0.
This implements a cache for thumbnails and image previews for non-image file formats, like videos and PDFs. This patch extends the inbuilt image preview feature (285df85) by integrating the
allmytoes
crate and using its thumbnails instead of the actual file being previewed.The image-preview feature uses the XDG-(freedesktop.org-) specified thumbnail-cache to re-use existing thumbs and to store newly created thumbs. (https://specifications.freedesktop.org/thumbnail-spec/thumbnail-spec-latest.html)
This increases performance for the image-preview because the preview does not need to load the full-sized version of the image and does not need to scale it down every time, once the thumbnail has been created. Also, thumbnails are now shared with other programs that use the XDG-thumb cache.
Furthermore, the new way to obtain thumbs allows to show image-previews for file types other than images. Existing thumbnails are shown for any file type. New thumbnails can be created for many video formats, PDF files, Postscript files, and SVGs. Users can also add “providers” for other file-types by configuring
allmytoes
.The XDG-thumb feature can be disabled, and the thumbnail-size can be changed, both in
joshuto.toml
. The documentation has been extended, the whole image-preview page has been enhanced a little.