Repository navigation
Conversation
[Medium impact] The PR appears safe to merge; no actionable issues remain from this review. SummaryAdds embedded JPEG thumbnails for supported camera RAW files and checks that cached thumbnails belong to their files.
Reviews (12) · Last reviewed commit: "Name no package for a PDF that pdftoppm ..." · Reviewed by Greptile |
9e86482 to
182dbff
Compare
c23f80b to
bf4a85d
Compare
A cache entry or failure marker was trusted on its modified time alone, so one made for another file with the same time was shown as this file's. It now has to carry this file's Thumb::URI as well, as the thumbnail spec asks a reader to check.
311e0c0 to
bb0f83c
Compare
Failure markers went to fail/folio, so a file Folio could not thumbnail stayed blank after it learned to, as it does for camera RAW here. They now go to the spec's fail/<program>-<version>, as fail/folio-2: the number is raised whenever Folio learns to draw more.
A thumbnailer that names a type only by an alias never matched the canonical name Folio asks with, so glycin's image/x-dds left a DDS file blank. The declared types are resolved to canonical names once, when the thumbnailers are read.
A CR2, NEF, NRW, ARW, SR2, DNG or PEF showed a blank tile unless a RAW thumbnailer was installed. The camera stores a finished JPEG in each, and a bounded reader of the TIFF directories now finds the largest one. An installed thumbnailer still answers first.
A type with no installed thumbnailer showed a blank tile and nothing else. The details pane now says which optional package draws it, from the types ffmpegthumbnailer, papers, glycin and libgsf declare.
A file nothing installed could draw kept its failure marker, so a thumbnailer installed afterwards never ran for it. The marker now records the thumbnailer the type had, none included, and holds the file back only while that is unchanged.
One orientation was kept for the whole file, so a preview whose directory names a turn of its own was turned by IFD0's instead. Each embedded JPEG now carries its directory's orientation, and takes the file's only when its directory names none.
With Poppler installed and no PDF thumbnailer, a PDF that failed to draw (damaged, or locked with a password) had the details pane name papers as missing. A PDF's package is now named only when pdftoppm is not there either.
|
Thank you, @thisisgm, this is lovely work. To land it without waiting on pushes to your fork, it's continued in #66 from a branch here, with your commits kept exactly as you made them and you credited at the top. The review fixes are added as commits on top: the embedded JPEG's orientation is read past fill bytes and from IFD0 only, the cleanup of old failure markers never follows a link out of the cache, and a RAW claiming an impossible size is skipped before decoding. Closing this one in favour of #66. |
Six changes to thumbnails, one commit each with its own tests: camera RAW files show their picture without a RAW thumbnailer, a cached thumbnail has to belong to its file, a failure is tried again once Folio can draw more, a thumbnailer is found through a type's aliases, a type nothing installed can draw says which package would, and a thumbnailer installed later draws what failed before. Two smaller commits on top answer review: a RAW preview is turned by its own directory's orientation, and no package is named for a PDF that
pdftoppmdraws. The suite goes from 188 to 199 tests. No library is linked in and nothing new is needed to run.What you'd notice
Thumb::URI, as the thumbnail spec asks a reader to check; otherwise the thumbnail is made again.fail/folio, so a file one release could not thumbnail stayed blank under every later one, as camera RAW would here. They now go to the spec'sfail/<program>-<version>, asfail/folio-2: the number is raised whenever Folio learns to draw more.image/x-ddsand the file isimage/vnd.ms-dds. Declared types are resolved to canonical names once, when the thumbnailers are read. On a stock Omarchy install 23 of the 196 declared names are aliases, and DDS pictures and WAV audio gain the thumbnailer they already had.pdftoppmis there to draw it.Numbers
Measured on a mini PC with no RAW thumbnailer installed, cold start, main against this branch. Both tables are from the branch as it stands on the CMake build.
A folder of 100 RAW files in twelve formats, three runs each:
The rest of Folio pays nothing for it. Time until the window is up and the process has gone quiet, six runs a view:
The ranges overlap in every view, and the media folder draws the same 105 thumbnails on both.
Screenshots
One RAW file from each of twelve cameras, main above and this branch below: Nikon, Pentax and Sony gain their picture.
A cache entry written for another file (the first tile, which should be red) and one that names no file (the third, flipped so it shows), each with a matching modified time, main on the left and this branch on the right:
The details pane for a video with ffmpegthumbnailer not installed, before and after:
Tests
Eleven new cases, each failing without its commit: a cache entry and a failure marker for another file are rejected; a failure an older Folio remembered is tried again, once; an alias finds its thumbnailer; a RAW file's embedded JPEG is shown, the largest of several is picked, a smaller one is shown when the largest does not decode or does not fit the read limit, a broken file is refused, and an installed thumbnailer still wins; the pane names the package for a type; a file that failed with nothing installed is drawn once a thumbnailer for it is. The two commits on top extend two of them: a later directory's own orientation rules its preview, and a PDF's package is named only without
pdftoppm. Every commit builds and passes the suite on its own, also with a temp folder whose name has a space.