files: the previews button says where video previews are made

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Mitchell-Johnson
2026-10-23 16:08:45 -07:00
co-authored by Claude Opus 5.5
parent d5c16540a1
commit fac8a3a180
3 changed files with 36 additions and 2 deletions
+31 -1
View File
@@ -245,8 +245,38 @@ type transcodeMachine struct {
}
// getTranscode: GET /api/transcode — the setting, and what every machine can encode on,
// asked of each now.
// asked of each now. ?only=selected asks only the chosen machine, for the device's name.
func (s *Server) getTranscode(w http.ResponseWriter, r *http.Request) {
if r.URL.Query().Get("only") == "selected" {
c := s.transcodeChoice()
out := map[string]any{"selected": c}
if c != nil {
name := c.Device
ctx, cancel := context.WithTimeout(r.Context(), 5*time.Second)
defer cancel()
var devs []media.Device
if c.Node == "" {
caps, _ := s.thumbs.capsFor(ctx, false, false)
devs = media.Devices(caps)
} else if code, b, err := s.nodes.Do(ctx, c.Node, "GET", "/api/files/play-devices", nil, nil); err == nil && code == 200 {
var d struct{ Devices []media.Device }
_ = json.Unmarshal(b, &d)
devs = d.Devices
}
for _, d := range devs {
if d.ID == c.Device {
name = d.Name
}
}
host := c.Node
if host == "" {
host = s.hostName()
}
out["host"], out["name"] = host, name
}
jsonOK(w, 200, out)
return
}
names := []string{""}
if s.nodes != nil {
names = append(names, s.nodes.Names()...)