add: queue total ETA from current encode speed

The queue card now shows an estimated time to clear: current job remaining +
sum(pending source durations) / current speed. Durations come from a
path+mtime-keyed cache that probes each file once in the background (ffprobe
format=duration, header-only), so the 1s poll never re-probes; entries are
pruned to the live queue. No speed (idle/held) -> no estimate; files still
being probed mark it partial (shown as '~Xh+').

Closes #9
This commit is contained in:
Esa Kataja
2026-06-21 20:48:37 +03:00
parent 04d6c85712
commit dfbd74b0d2
4 changed files with 198 additions and 16 deletions
+6 -1
View File
@@ -113,7 +113,12 @@ func main() {
}
if addr := *cfg.HTTPAddr; addr != "" {
srv := &http.Server{Addr: addr, Handler: server.New(tracker, log, store, controls, cfg.Paths.Input, cfg.Paths.Failed).Handler()}
probeDuration := func(p string) (float64, error) {
pctx, pcancel := context.WithTimeout(context.Background(), 10*time.Second)
defer pcancel()
return enc.GetDuration(pctx, p)
}
srv := &http.Server{Addr: addr, Handler: server.New(tracker, log, store, controls, probeDuration, cfg.Paths.Input, cfg.Paths.Failed).Handler()}
go func() {
log.Info(fmt.Sprintf("Status server listening on %s", addr))
if err := srv.ListenAndServe(); err != nil && err != http.ErrServerClosed {