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) CreditsOn(ctx context.Context) (bool, error)
- func (a *Analyzer) IntrosOn(ctx context.Context) (bool, error)
- 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) SetCreditsOn(ctx context.Context, on bool) error
- func (a *Analyzer) SetIntrosOn(ctx context.Context, on bool) error
- func (a *Analyzer) SetMode(ctx context.Context, m Mode) error
- func (a *Analyzer) Status(ctx context.Context) (Status, error)
- func (a *Analyzer) Wake()
- type IntroStatus
- type Mode
- type Status
- type ThumbStatus
Constants ¶
const ( StateAnalyzing = "analyzing" StateWaiting = "waiting" // for playback to finish StateSlowDisk = "slowDisk" // files kept timing out; resting before trying again StateIntros = "intros" // looking for the intros of a season's episodes StateCredits = "credits" // looking for the end credits of a season's episodes or a movie StateThumbs = "thumbnails" // making a video's seek bar pictures StateGapless = "gapless" // listening for albums whose songs run into each other 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
// Intros, when set, looks for TV episodes' intros once every file is
// analyzed, at the same pace and priority.
Intros *intro.Detector
// Credits, when set, looks for where episodes' and movies' end credits
// start after that, at the same pace and priority.
Credits *credits.Detector
// Thumbs, when set, makes the seek bar's pictures of every video after
// that, when the admin has them made for all videos (see thumbs.Mode).
Thumbs *thumbs.Generator
// Gapless, when set, listens for albums whose songs run into each
// other (see internal/gapless), after the intros.
Gapless *gapless.Detector
// contains filtered or unexported fields
}
func (*Analyzer) CreditsOn ¶ added in v0.1.13
CreditsOn says whether to look for end credits, an admin setting, on by default.
func (*Analyzer) IntrosOn ¶ added in v0.1.10
IntrosOn says whether to look for intros, an admin setting, on by default.
func (*Analyzer) Reanalyze ¶
Reanalyze has one file looked at again soon, whatever its state, its intro and end credits looked for again and its seek bar pictures made again.
func (*Analyzer) SetCreditsOn ¶ added in v0.1.13
func (*Analyzer) SetIntrosOn ¶ added in v0.1.10
type IntroStatus ¶ added in v0.1.10
type IntroStatus struct {
On bool `json:"on"`
Total int `json:"total"`
Done int `json:"done"`
Found int `json:"found"`
}
IntroStatus counts video episodes: all of them, the ones looked at for an intro, and the ones an intro was found in.
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"`
// Intros is how far looking for TV episodes' intros is; absent when
// this server doesn't.
Intros *IntroStatus `json:"intros,omitempty"`
// Credits is how far looking for episodes' and movies' end credits is;
// absent when this server doesn't. It counts episodes and movies.
Credits *IntroStatus `json:"credits,omitempty"`
// Thumbnails is how far making the seek bar's pictures is; absent when
// this server doesn't.
Thumbnails *ThumbStatus `json:"thumbnails,omitempty"`
}
Status is the analysis' progress, for admins.