metadata

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 License: GPL-2.0 Imports: 56 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyRequestScopedAudioPolicy

func ApplyRequestScopedAudioPolicy(meta *api.PreparedMetadata, cfg config.Config, logger api.Logger)

ApplyRequestScopedAudioPolicy updates audio labels and tracker audio blocks for the request's active tracker set.

func ApplyTagOverrides

func ApplyTagOverrides(path, currentTag, tagsPath string) (string, *api.TagOverride, error)

func BuildReleaseName

func BuildReleaseName(req api.ReleaseNameRequest, logger api.Logger) api.ReleaseNameResult

func DetectTag

func DetectTag(path string) string

DetectTag returns the parsed release group as a hyphen-prefixed tag.

func ParseReleaseInfo

func ParseReleaseInfo(path string) api.ReleaseInfo

func RebuildReleaseName

func RebuildReleaseName(meta *api.PreparedMetadata, logger api.Logger)

RebuildReleaseName regenerates the prepared release-name fields from the current metadata and release-name overrides.

func SeasonPackMixedGroupTagNotice added in v0.2.3

func SeasonPackMixedGroupTagNotice(meta api.PreparedMetadata) (string, bool)

SeasonPackMixedGroupTagNotice returns the user-facing notice for season packs with mismatched file-level group tags.

Types

type ArrLookupClient

type ArrLookupClient interface {
	Lookup(ctx context.Context, meta api.PreparedMetadata) (ArrLookupResult, error)
}

type ArrLookupResult

type ArrLookupResult struct {
	Source       string
	TMDBID       int
	IMDBID       int
	TVDBID       int
	TVmazeID     int
	Year         int
	Genres       []string
	ReleaseGroup string
}

type IMDBClient

type IMDBClient interface {
	Search(ctx context.Context, input imdb.SearchInput) (imdb.SearchResult, error)
	GetInfo(ctx context.Context, imdbID string, manualLanguage string, debug bool) (imdb.Info, error)
}

IMDBClient is the IMDb metadata surface used by external-ID resolution.

type Option

type Option func(*Service)

func WithBDInfoService

func WithBDInfoService(bi *bdinfo.Service) Option

func WithBlurayClient

func WithBlurayClient(client *bluraycom.Client) Option

func WithConfig

func WithConfig(cfg config.Config) Option

func WithIMDBClient

func WithIMDBClient(client IMDBClient) Option

func WithLogger

func WithLogger(logger api.Logger) Option

func WithMediaInfoExporter

func WithMediaInfoExporter(exporter mediainfo.Exporter) Option

func WithRadarrClient

func WithRadarrClient(client ArrLookupClient) Option

func WithSRRDBPaths

func WithSRRDBPaths(dbPath string) Option

func WithSceneDetector

func WithSceneDetector(detector SceneDetector) Option

func WithSonarrClient

func WithSonarrClient(client ArrLookupClient) Option

func WithTMDBClient

func WithTMDBClient(client TMDBClient) Option

func WithTVDBClient

func WithTVDBClient(client TVDBClient) Option

func WithTVmazeClient

func WithTVmazeClient(client TVmazeClient) Option

func WithTagsPathFromDB

func WithTagsPathFromDB(dbPath string) Option

func WithTrackerDataLookup

func WithTrackerDataLookup(lookup TrackerDataLookup) Option

type SceneDetector

type SceneDetector interface {
	Detect(ctx context.Context, meta api.PreparedMetadata) (SceneResult, error)
}

SceneDetector resolves scene metadata from a prepared item. Implementations may return a populated result with an error when an optional side effect fails.

type SceneResult

type SceneResult struct {
	IsScene   bool
	SceneName string
	TMDBID    int
	IMDBID    int
	TVDBID    int
	TVmazeID  int
	MALID     int
	// Service is the normalized service code parsed from a saved scene NFO.
	Service string
	// ServiceLongName is the display name matching Service when one is known.
	ServiceLongName string
	// NFOPath is the local filesystem path to a saved scene NFO.
	NFOPath string
	// NFONew reports whether NFOPath was downloaded during this detection run.
	NFONew bool
	// Renamed reports that a scene release was identified via the imdb: fallback
	// (the exact r: name missed) and the on-disk basename differs from the
	// canonical scene media filename, i.e. the release was renamed/modified.
	Renamed bool
	// RenamedReason is an operator-facing explanation set when Renamed is true.
	RenamedReason string
}

SceneResult captures scene metadata from external sources. NFO fields are best-effort side-effect outputs and may be empty on an otherwise valid match.

type SeasonPackGroupTagInfo added in v0.2.3

type SeasonPackGroupTagInfo struct {
	// Mixed reports whether more than one usable release group was parsed.
	Mixed bool
	// Groups contains the distinct parsed group labels in stable display order.
	Groups []string
	// Notice contains the user-facing warning text for mixed season packs.
	Notice string
}

SeasonPackGroupTagInfo describes the parsed release groups found in a season pack file list.

func DetectSeasonPackGroupTags added in v0.2.3

func DetectSeasonPackGroupTags(meta api.PreparedMetadata) SeasonPackGroupTagInfo

DetectSeasonPackGroupTags parses file-list release groups and reports when a season pack contains more than one group tag.

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(repo db.MetadataRepository, opts ...Option) *Service

func (*Service) ApplyArrData

func (s *Service) ApplyArrData(ctx context.Context, meta api.PreparedMetadata) (api.PreparedMetadata, error)

func (*Service) ApplyMediaDetails

func (s *Service) ApplyMediaDetails(ctx context.Context, meta api.PreparedMetadata) (api.PreparedMetadata, error)

ApplyMediaDetails enriches prepared metadata from MediaInfo, BDInfo, filename tokens, overrides, and tracker rules, then rebuilds the release name.

func (*Service) ApplyMediaInfoIDs

func (s *Service) ApplyMediaInfoIDs(ctx context.Context, meta api.PreparedMetadata) (api.PreparedMetadata, error)

func (*Service) ApplyTrackerClaims added in v0.2.1

func (s *Service) ApplyTrackerClaims(ctx context.Context, meta api.PreparedMetadata) (api.PreparedMetadata, error)

ApplyTrackerClaims refreshes claim-based tracker blocks after media details and tracker rules have populated the release attributes used for matching.

func (*Service) EnrichTrackerData

func (s *Service) EnrichTrackerData(ctx context.Context, meta api.PreparedMetadata) (api.PreparedMetadata, error)

func (*Service) Prepare

func (s *Service) Prepare(ctx context.Context, req api.Request) (meta api.PreparedMetadata, err error)

func (*Service) RefreshPreparedMetadata

func (s *Service) RefreshPreparedMetadata(ctx context.Context, meta api.PreparedMetadata) (api.PreparedMetadata, error)

RefreshPreparedMetadata reapplies request-scoped audio, naming, rule, and claim state without rereading media files. HDR may be refreshed from the current source path only when it still matches the parsed release HDR.

func (*Service) ResolveExternalIDs

func (s *Service) ResolveExternalIDs(ctx context.Context, meta api.PreparedMetadata) (api.PreparedMetadata, error)

ResolveExternalIDs resolves and persists cross-provider IDs and metadata for a prepared item, honoring fresh stored data, overrides, scene IDs, and tracker matches before falling back to provider searches. Selected BJS, BT, and ASC targets trigger pt-BR TMDB localized metadata when a TMDB ID is known.

type TMDBClient

type TMDBClient interface {
	FindByExternalID(ctx context.Context, input tmdb.FindInput) (tmdb.FindResult, error)
	SearchID(ctx context.Context, input tmdb.SearchInput) (tmdb.SearchOutcome, error)
	FetchMetadata(ctx context.Context, input tmdb.MetadataInput) (tmdb.MetadataResult, error)
	GetEpisodeDetails(ctx context.Context, tmdbID, season, episode int) (tmdb.EpisodeDetails, error)
	GetSeasonDetails(ctx context.Context, tmdbID, season int) (tmdb.SeasonDetails, error)
	DailyToSeasonEpisode(ctx context.Context, tmdbID int, date time.Time) (int, int, error)
	GetLocalizedData(ctx context.Context, input tmdb.LocalizedDataInput) (map[string]any, error)
}

TMDBClient is the TMDB metadata surface used by external-ID resolution.

type TVDBClient

type TVDBClient interface {
	GetByExternalID(ctx context.Context, imdbID, tmdbID string, tvMovie bool) (int, string, error)
	GetSeriesMetadata(ctx context.Context, seriesID int) (tvdb.SeriesMetadata, error)
	GetSeriesMetadataWithLanguage(ctx context.Context, seriesID int, language string) (tvdb.SeriesMetadata, error)
	GetEpisodes(ctx context.Context, seriesID int, query tvdb.EpisodeQuery) (tvdb.EpisodesData, string, error)
	GetEpisodesWithLanguage(ctx context.Context, seriesID int, query tvdb.EpisodeQuery, language string) (tvdb.EpisodesData, string, error)
	GetEpisodeTranslation(ctx context.Context, episodeID int, language string) (tvdb.EpisodeTranslation, error)
}

TVDBClient is the TVDB metadata surface used by external-ID resolution.

type TVmazeClient

type TVmazeClient interface {
	Search(ctx context.Context, input tvmaze.SearchInput) (tvmaze.SearchResult, error)
	GetEpisodeByNumber(ctx context.Context, tvmazeID, season, episode int, lookup tvmaze.EpisodeLookupContext) (*tvmaze.EpisodeData, error)
	GetEpisodeByDate(ctx context.Context, tvmazeID int, airdate string) (*tvmaze.EpisodeData, error)
}

TVmazeClient is the TVmaze metadata surface used by external-ID resolution.

type TrackerDataLookup

type TrackerDataLookup interface {
	Lookup(
		ctx context.Context,
		tracker string,
		trackerID string,
		meta api.PreparedMetadata,
		searchFileName string,
		onlyID bool,
		keepImages bool,
	) (trackerdata.Result, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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