Files: previews — a toggle that shows a thumbnail per image and video, made by ffmpeg on the machine's GPU where it has one, cached under the data dir
A previews button on the Files tab turns the icon column into a 256 px thumbnail for every image and video row, loaded as rows scroll near. internal/thumbs probes what the machine can do rather than assuming it: ffmpeg and ffprobe, every /dev/dri/renderD* opened and exercised, vainfo's decode profiles per node where it exists. A video goes to the first GPU that lists its codec, with ffmpeg's own software fallback behind it and a CPU retry behind that; images decode on the CPU, JPEGs at a reduced DCT size. Previews are kept under <data dir>/thumbs/ keyed by path, size and mtime, with undecodable files remembered too. Root mode makes them through the same root helper the file reads use. Where ffmpeg is missing the tab offers to install it; where a render node exists but is closed to the daemon's user, it offers a drop-in adding the group and a restart. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
e7034cd478
commit
f8c9479e93
@@ -0,0 +1,26 @@
|
||||
package thumbs
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/user"
|
||||
"strconv"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
// ownerOf is "root:render 0660" for a device node, the thing to say when it cannot be opened.
|
||||
func ownerOf(st os.FileInfo) string {
|
||||
sys, ok := st.Sys().(*syscall.Stat_t)
|
||||
if !ok {
|
||||
return ""
|
||||
}
|
||||
u := strconv.Itoa(int(sys.Uid))
|
||||
if x, err := user.LookupId(u); err == nil {
|
||||
u = x.Username
|
||||
}
|
||||
g := strconv.Itoa(int(sys.Gid))
|
||||
if x, err := user.LookupGroupId(g); err == nil {
|
||||
g = x.Name
|
||||
}
|
||||
return fmt.Sprintf("%s:%s %04o", u, g, st.Mode().Perm())
|
||||
}
|
||||
Reference in New Issue
Block a user