Skip to content

Thumbnails: pictures in rows, sturdier thumbnailers - #50

Closed
thisisgm wants to merge 12 commits into
omacom:mainfrom
thisisgm:thumbnail-rows
Closed

thisisgm wants to merge 12 commits into
omacom:mainfrom
thisisgm:thumbnail-rows

Conversation

@thisisgm

@thisisgm thisisgm commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #17: its eight commits come first here, the last four are this pull request's, and I will rebase it as soon as #17 lands.

Four changes to thumbnails, one commit each with its own tests: a row in the list and the columns shows the picture its tile shows, a file whose name holds a thumbnailer code reaches the thumbnailer as it is, a failure is remembered only when the file itself was judged, and a thumbnailer past its time is stopped together with what it started. The suite goes from 199 to 204 tests. No library, depends or optdepends entry is added.

What you'd notice

  • Rows show the pictures tiles show. The list and the columns asked for a thumbnail only for a photo or a video, so a PDF, a song with a cover or an office document had its picture in the grid and an icon in a row. A row now asks for every picture a tile shows, except a text file's page, which says nothing at a row's size. A page or a cover is fitted whole in the row, where a photo is still cropped to fill it.
  • A file called 50%off.mp4 gets its thumbnail. A thumbnailer's Exec line was filled in one code after another, so the %o in the file's own name was replaced by the output path. The thumbnailer was sent a file that is not there and the failure was remembered. Each code is now read once, in one pass, and %% is a percent sign as the spec says.
  • A failure is remembered only when the file was judged. A failure marker keeps every app from trying a file again. One was written when the thumbnailer never started, when a spec's program was not installed, when the file could not be read, and when it was moved away or written to during the run. None of those says the file is broken, so none is remembered now. A spec whose Exec program is gone is no longer taken as a thumbnailer, so the details pane still names the package that would draw the type, and a PDF whose thumbnailer cannot start is left to pdftoppm.
  • A hung thumbnailer does not leave programs behind. A thumbnailer still running after 15 seconds was killed alone, so the programs it had started (glycin and the office thumbnailer start their own) ran on. Each thumbnailer now runs in a session of its own under a small keeper process. The session is stopped whole when the time is up, and also when Folio itself is gone, where a terminal's Ctrl-C no longer reaches it.

Numbers

Measured on a mini PC, cold start, six runs a view, on a folder of 2,000 pictures and videos. These runs are from the rows commit before the rebase onto the current main, against the main of that day. The keeper adds one fork to each thumbnailer run; that is not in these numbers yet.

View main this branch
Grid 4446 to 4627 ms, 153.6 to 154.2 MiB, 105 thumbnails 4455 to 5490 ms, 151.6 to 154.6 MiB, 105 thumbnails
List 2872 to 3203 ms, 127.9 to 129.8 MiB, 52 thumbnails 2960 to 3253 ms, 129.0 to 129.6 MiB, 52 thumbnails
Columns 3016 to 3494 ms, 142.5 to 146.2 MiB, 52 thumbnails 3063 to 3457 ms, 143.8 to 147.0 MiB, 52 thumbnails

A folder of photos and videos asks for the same thumbnails as before, and the ranges overlap in every view. A folder of PDFs or music now draws its rows' pictures, which costs what the grid already paid for them.

Screenshots

The same folder in the list, main on the left and this branch on the right: the song shows its cover and the PDF its first page.

List rows before and after

Tests

Five new cases, each failing without its commit: a row asks for the pictures a tile asks for and lays a fitted one out at its own shape; a name with every code in it reaches the thumbnailer whole, by path and by URI; no failure is remembered for a program that is gone, one that could not start, a file taken away or written to during the run or one that cannot be read, while a real failure still is, and pdftoppm draws the page when a PDF's thumbnailer cannot start; a thumbnailer past its time is stopped with the helper it started; and a thumbnailer and the helper it started are both ended when the process that started them is killed. Every commit builds and passes the suite on its own, also with a temp folder whose name has a space.

@greptile-apps

greptile-apps Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge, with the previous percent-path finding fixed and no new actionable issues found.

Summary

This PR brings row thumbnails closer to grid thumbnails and makes external thumbnailers more reliable.

  • Rows show the same file pictures as tiles, fitted or cropped to match.
  • Thumbnail helpers get file names intact and stop with the programs they start.
  • Thumbnail failures are remembered only for the file and helper that were tried.
  • Supported camera RAW files can show their largest usable embedded JPEG preview.
  • The preview pane names the package that can draw an unsupported file type.

The numbered percent-path finding is fixed. The earlier helper-cleanup, RAW-orientation, and PDF-hint cases are also addressed. No new actionable issues were found. Tests were read, not run.

Diagram

sequenceDiagram
    participant F as Folio
    participant K as Keeper
    participant T as Thumbnailer
    participant H as Spawned helper
    F->>K: Start in a new session
    K->>T: Fork and run
    T->>H: Start helper
    alt Thumbnailer finishes
        T-->>K: Exit result
        K-->>F: Return exit result
    else Time runs out
        F->>K: Kill process group
    else Folio exits
        K->>K: Receive parent-death signal
        K->>T: Kill process group
        K->>H: Kill process group
    end
Loading

Reviews (6) · Last reviewed commit: "Stop a thumbnailer past its time with wh..." · Reviewed by Greptile

Comment thread src/thumbnails.cpp Resolved
Comment thread src/rawembed.cpp Resolved
Comment thread src/thumbnails.cpp Resolved
@thisisgm
thisisgm force-pushed the thumbnail-rows branch 2 times, most recently from 1d140b2 to c171add Compare November 11, 2026 15:27
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.
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.
The list and the columns asked for a thumbnail only for a photo or a
video, so a PDF, a song with a cover or a document had its picture in
the grid and an icon in a row. A row now asks for every picture a tile
shows but a text file's page, which says nothing at a row's size, and
a page or a cover is fitted whole in the row where a photo is cropped.
A thumbnailer's command was filled in one code after another, so a
file called 50%off.mp4 had the %o in its own name replaced by the
output path. The thumbnailer was sent a file that is not there, and
the failure was remembered. Each code is now read once.
Comment thread src/thumbnails.cpp Resolved
A failure marker keeps every app from trying a file again, and one was
written for a thumbnailer that never started, for a spec whose program
is not installed, for a file that could not be read and for one moved
away or written to during the run. None of those says the file is
broken, so none is remembered now, and a PDF whose thumbnailer cannot
start is left to pdftoppm.
A thumbnailer still running after 15 seconds was killed alone, so the
programs it had started (glycin and the office thumbnailer start their
own) ran on. Each now runs in a session of its own, under a keeper that
stops the whole session past its time, and when Folio itself is gone.
@dhh

dhh commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

Thank you, @thisisgm! This one is continued in #67, stacked on #66 (your #17), from a branch here with your commits kept as you made them and you credited at the top. Added on top in review: quitting no longer waits on a running thumbnailer, what a thumbnailer leaves behind is stopped after every run rather than only on a timeout, a larger fresh thumbnail serves a smaller row, and the process tests hold in CI containers. Closing this one in favour of #67.

@dhh dhh closed this Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants