S017: thumbnail crate with freedesktop cache, generators and worker pool
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
parent
ca8e061657
commit
3443b12df2
1 changed files with 1084 additions and 27 deletions
|
|
@ -49,5 +49,12 @@ One entry per session, newest last, ≤ 15 lines: done, verified how, not done,
|
|||
- Not done: motion (scale, slide, re-stack, sweep) not watched live (screenshots force reduced motion; software renderer ignores `transform-scale`, D-025); pointer outside-click and hover-open not exercised. Dialog content should hold one focus stop: a `TextField` with text has two (input + clear), so Shift+Tab from its clear button wraps to the last action.
|
||||
- Later: focus doesn't return to the opener by itself (use `closed` / after `close()`); a menu opened from a button flips to end at the anchor point, not above the button.
|
||||
|
||||
## S017 — Thumbnail generation and cache
|
||||
- Done: `tunal-thumbs`. `Thumbnailer::new(Config { workers, max_file_size (64 MiB, images/SVG only), allow_remote, video_time: VideoTime::Percent(10)|Seconds, tool_timeout (15 s) })`; `request(Request { path (absolute), size: ThumbSize::{Normal 128, Large 256, XLarge 512}, priority: Priority::{Low, Normal, High}, remote, done: Box<dyn FnOnce(Outcome) + Send> }) -> Ticket` (`cancel()`: queued job → `Cancelled`, running ffmpeg killed). `done` runs on a worker thread. `Outcome::{Ready(cache PNG path), Skipped(Skip::{Unsupported, Remote, TooLarge, InCache, KnownFailure}), Failed(String), Cancelled}`. Also `cache_path(path, size)`, `thumbnail_dir()`, `ffmpeg_available()`.
|
||||
- Cache: `$XDG_CACHE_HOME/thumbnails/{normal,large,x-large}/<md5 of file URI>.png` with `Thumb::URI/MTime/Size`, atomic write, 0700/0600; a thumbnail is valid while `Thumb::MTime` matches; failures in `fail/tunal-<version>/` (1×1 PNG) until the file changes. Generators: `image` (EXIF orientation applied), `resvg` (system fonts), `lofty` cover (front cover first), `ffprobe` duration + `ffmpeg -ss … -frames:v 1` PNG on stdout (no shell, killed on timeout/cancel; seek past end → first frame). ffmpeg missing or audio without cover → `Skipped(Unsupported)`, no fail entry.
|
||||
- Verified: build, clippy -D warnings (workspace), fmt --check; `XDG_CACHE_HOME=<scratch> --example thumb` on PNG, SVG, MP3 with cover, MP4 (looked at SVG and video PNGs), MP3 without cover (skipped), corrupt PNG (Failed, then KnownFailure), file inside the cache (skipped), missing ffmpeg via PATH (skipped), all three sizes. Workspace deps added: image, resvg, lofty, md-5.
|
||||
- Not done: cancel and timeout paths not exercised (code only); SVG `<text>` did not render in the smoke run (system fonts not found in this environment; geometry fine); local files only — remote requests are gated by the flag, the pool reads `std::fs` (S018/UI must hand remote files over another way).
|
||||
- Later: stale-thumbnail cleanup; video thumbnails of very short clips use first frame only when seek fails.
|
||||
|
||||
## Later
|
||||
-
|
||||
|
|
|
|||
Loading…
Reference in a new issue