hygiene

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 30, 2026 License: GPL-3.0 Imports: 25 Imported by: 0

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 its owning movie or episode to "wanted" once a grace window elapses.

Index

Constants

This section is empty.

Variables

This section is empty.

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 New

func New(
	store db.Store,
	meta metadata.Provider,
	tvmeta metadata.TVProvider,
	importer library.Importer,
	cfg *config.LibraryConfig,
) *Service

func (*Service) RunDriftCheck

func (s *Service) RunDriftCheck(ctx context.Context, interval time.Duration) error

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 its owning movie or episode reverts to "wanted".

func (*Service) RunOrphanScan

func (s *Service) RunOrphanScan(ctx context.Context) error

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

func (s *Service) RunSeriesOrphanScan(ctx context.Context) error

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).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL