Documentation
¶
Overview ¶
Package analyze slowly works through the libraries in the background, recording each file's full media info: resolution and HDR, codecs and bitrates, audio channels and languages, subtitles. It is built to go unnoticed: one file at a time at the lowest CPU and disk priority, with a pause between files and while anyone is watching something transcoded, so network shares and the server stay responsive. Progress lives in the database, so it picks up where it was after a restart, and a file is looked at again only when it changes.
Index ¶
- Constants
- type Analyzer
- func (a *Analyzer) Mode(ctx context.Context) (Mode, error)
- func (a *Analyzer) Reanalyze(ctx context.Context, id int64) error
- func (a *Analyzer) Run(ctx context.Context)
- func (a *Analyzer) SetMode(ctx context.Context, m Mode) error
- func (a *Analyzer) Status(ctx context.Context) (Status, error)
- func (a *Analyzer) Wake()
- type Mode
- type Status
Constants ¶
const ( StateAnalyzing = "analyzing" StateWaiting = "waiting" // for playback to finish StateSlowDisk = "slowDisk" // files kept timing out; resting before trying again StateIdle = "idle" // everything is analyzed StateOff = "off" )
State says what the analysis is doing right now.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Analyzer ¶
type Analyzer struct {
Store *store.Store
Prober probe.Prober // should be LowPriority
Log *slog.Logger
// Busy reports whether anyone is watching something the server is
// transcoding right now. Gentle analysis waits until nobody is.
Busy func() bool
// contains filtered or unexported fields
}
type Mode ¶
type Mode string
Mode is how hard the analysis works, an admin setting.
const ( // Gentle analyzes a file every few seconds and waits while anyone is // watching something transcoded. The default. Gentle Mode = "gentle" // Normal analyzes files back to back, still at the lowest priority. Normal Mode = "normal" // Off pauses the analysis until it's turned back on. Off Mode = "off" )
type Status ¶
type Status struct {
Mode Mode `json:"mode"`
State string `json:"state"`
// Total is how many files the libraries have; Done how many are analyzed
// as they are now, Unreadable among them the ones ffprobe couldn't read.
Total int `json:"total"`
Done int `json:"done"`
Unreadable int `json:"unreadable"`
Current string `json:"current,omitempty"`
}
Status is the analysis' progress, for admins.