metadata

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 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

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.

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
}

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 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 policies, then rebuilds the release name.

func (*Service) ApplyMediaInfoIDs

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

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) (api.PreparedMetadata, 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