identify

package
v1.30.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package identify scans a directory of video files, matches each filename against previously scraped FSS scene metadata, and writes Kodi-style .nfo sidecar files for the matches. It is the engine behind `fss identify`.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindVideos

func FindVideos(dir string) ([]string, error)

FindVideos recursively lists all video files under dir.

func WriteReport

func WriteReport(dir string, results []Result) error

WriteReport writes an fss-report.txt listing unmatched and skipped files.

Types

type Options

type Options struct {
	Apply    bool
	Force    bool
	NoReport bool

	// Poster downloads each matched scene's thumbnail to a `-poster` file
	// beside the video and points the NFO at it. Off by default: it is a
	// network fetch per scene against the same hosts a scrape rate-limits.
	//
	// Without it, a scene's thumbnail stays a remote URL — and scraped CDN
	// URLs are frequently signed and short-lived, so the link is often dead
	// by the time a media manager follows it.
	Poster bool

	// PosterAllowPrivate permits poster URLs resolving to private or loopback
	// addresses, for locally-hosted media. See mediafetch.ValidateURL.
	PosterAllowPrivate bool
}

Options controls the identify run behaviour.

type Result

type Result struct {
	VideoPath  string
	NFOPath    string
	Confidence match.MatchConfidence
	Scene      *match.MergedScene
	Skipped    bool
	SkipReason string

	// PosterPath is the downloaded poster file, set only with Options.Poster.
	PosterPath string
	// PosterError records why a poster could not be saved. The NFO is still
	// written — a missing poster does not fail the identification.
	PosterError error
}

Result holds the outcome of matching a single video file against the scene index.

func Run

func Run(videos []string, idx *match.SceneIndex, opts Options) []Result

Run matches each video against the scene index and optionally writes NFO sidecar files. It is RunContext with a background context.

func RunContext

func RunContext(ctx context.Context, videos []string, idx *match.SceneIndex, opts Options) []Result

RunContext is Run with cancellation, which Options.Poster needs since it performs network fetches.

type Stats

type Stats struct {
	Total     int
	Matched   int
	Unmatched int
	Ambiguous int
	Skipped   int
}

Stats aggregates identify results into counts.

func Summarize

func Summarize(results []Result) Stats

Summarize tallies results into matched/unmatched/ambiguous/skipped counts.

Jump to

Keyboard shortcuts

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