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.
63 lines
1.4 KiB
Go
63 lines
1.4 KiB
Go
package types
|
|
|
|
type MediaType string
|
|
|
|
const (
|
|
MediaTypeDVD MediaType = "DVD"
|
|
MediaTypeBluRay MediaType = "Blu-ray"
|
|
MediaTypeWebDL MediaType = "WebDL"
|
|
MediaTypeTVRip MediaType = "TVRip"
|
|
)
|
|
|
|
type Job struct {
|
|
InputPath string
|
|
OutputPath string
|
|
MediaType MediaType
|
|
Metadata *Metadata
|
|
CRF int
|
|
Preset int
|
|
DeleteOrigin bool
|
|
}
|
|
|
|
type Metadata struct {
|
|
Title string
|
|
Collection string
|
|
Season string
|
|
Episode string
|
|
DateReleased string
|
|
IMDBID string
|
|
TVMazeID string
|
|
OriginalMedia MediaType
|
|
IsSeries bool
|
|
}
|
|
|
|
type Config struct {
|
|
OMDBAPIKey string `yaml:"omdb_api_key"`
|
|
LogRetentionDays int `yaml:"log_retention_days"`
|
|
// HTTPAddr is the status server listen address. Absent (nil) defaults to
|
|
// ":8080"; an explicit empty string disables the server.
|
|
HTTPAddr *string `yaml:"http_addr"`
|
|
Encoding EncodingConfig
|
|
Paths PathsConfig
|
|
}
|
|
|
|
type EncodingConfig struct {
|
|
DVD EncodingParams `yaml:"dvd"`
|
|
Bluray EncodingParams `yaml:"bluray"`
|
|
WebDL EncodingParams `yaml:"webdl"`
|
|
TVRip EncodingParams `yaml:"tvrip"`
|
|
}
|
|
|
|
type EncodingParams struct {
|
|
CRF int `yaml:"crf"`
|
|
Preset int `yaml:"preset"`
|
|
}
|
|
|
|
type PathsConfig struct {
|
|
Input string `yaml:"input"`
|
|
Output string `yaml:"output"`
|
|
Originals string `yaml:"originals"`
|
|
Failed string `yaml:"failed"`
|
|
Work string `yaml:"work"`
|
|
}
|