add: live encode progress tracking and read-only status web UI
Stream ffmpeg -progress during the video encode into an in-memory tracker (internal/status) so the long-running step is no longer a black box: percent, fps, speed, and ETA are derived from the source duration and updated ~1/s. Progress prints to stdout only (no logs.db row) to avoid burying real events. Expose it over HTTP (internal/server, default :8080, set http_addr to "" to disable): GET /status returns the live snapshot, the pending input queue, and recent non-debug events; GET / serves an embedded dashboard that polls /status every second. The server shuts down on the same SIGINT/SIGTERM context as the watcher.
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"time"
|
||||
|
||||
"videnc-vibe/pkg/types"
|
||||
@@ -28,6 +29,19 @@ var inputExtensions = []string{
|
||||
"webm", "wmv", "flv",
|
||||
}
|
||||
|
||||
// InputFiles returns the source files currently in dir that the watcher would
|
||||
// consider, sorted. The status server uses this to report the pending queue, so
|
||||
// it stays in sync with inputExtensions.
|
||||
func InputFiles(dir string) []string {
|
||||
var files []string
|
||||
for _, ext := range inputExtensions {
|
||||
matches, _ := filepath.Glob(filepath.Join(dir, "*."+ext))
|
||||
files = append(files, matches...)
|
||||
}
|
||||
sort.Strings(files)
|
||||
return files
|
||||
}
|
||||
|
||||
// fileStat is the (mtime, size) pair used to decide whether a file has settled
|
||||
// between two consecutive ticks.
|
||||
type fileStat struct {
|
||||
|
||||
Reference in New Issue
Block a user