Documentation
¶
Overview ¶
Package hygiene runs two periodic library jobs:
- orphan_scan walks library.movie_path and reconciles untracked files against the movies table, auto-importing high-confidence matches and queueing ambiguous ones into the bulk-import review surface.
- drift_check confirms every tracked MediaFile is still present on disk and reverts the owning movie to "wanted" once a grace window elapses.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrAutoImportSkipped = errors.New(
"hygiene: auto-import skipped (confidence gate)",
)
ErrAutoImportSkipped signals that the auto-import gate rejected a confirmed match (e.g. because the movie already has a tracked file). The orphan falls through to the queue path.
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service coordinates orphan_scan and drift_check passes against the on-disk library and the database. It is stateless aside from its dependencies; one instance is shared between the two scheduler jobs.
func (*Service) RunDriftCheck ¶
RunDriftCheck verifies every tracked MediaFile is still present on disk. Missing files start (or advance) a grace clock keyed off last_seen_at; once the file has been gone for at least cfg.DriftGraceTicks intervals the row is deleted and the owning movie reverts to "wanted".
func (*Service) RunOrphanScan ¶
RunOrphanScan walks library.movie_path, classifies untracked media files against TMDB, and either auto-imports high-confidence matches or enqueues the rest into a bulk-import scan for human review.
func (*Service) RunSeriesOrphanScan ¶
RunSeriesOrphanScan walks series_path's top-level folders, classifies each untracked show against TVDB, and appends it to the directory's open review scan — one series import entry per directory, consolidated across runs. Shows whose files are all already tracked, or that are already queued for review, are skipped. Adoption happens on commit, not here (review-only).