Documentation
¶
Index ¶
- func ApplyTagOverrides(path, currentTag, tagsPath string) (string, *api.TagOverride, error)
- func BuildReleaseName(req api.ReleaseNameRequest, logger api.Logger) api.ReleaseNameResult
- func DetectTag(path string) string
- func EnsureDefaultTagOverrides(dbPath string) (string, error)
- func EvaluateAudioBloatPolicy(subject api.UploadSubject, candidateTrackers []string, ...) (map[string][]string, map[string][]string)
- func ParseReleaseInfo(path string) api.ReleaseInfo
- func RebuildReleaseName(meta *preparationstate.State, logger api.Logger)
- func SeasonPackMixedGroupTagNotice(meta preparationstate.State) (string, bool)
- type AniListClient
- type ArrLookupClient
- type ArrLookupResult
- type IMDBClient
- type Option
- func WithAniListClient(client AniListClient) Option
- func WithBDInfoService(bi *bdinfo.Service) Option
- func WithBlurayClient(client *bluraycom.Client) Option
- func WithClientDiscovery(discovery *clientdiscovery.Module) Option
- func WithConfig(cfg config.Config) Option
- func WithIMDBClient(client IMDBClient) Option
- func WithLogger(logger api.Logger) Option
- func WithMediaInfoExporter(exporter mediainfo.Exporter) Option
- func WithRadarrClient(client ArrLookupClient) Option
- func WithSRRDBPaths(dbPath string) Option
- func WithSceneDetector(detector SceneDetector) Option
- func WithSonarrClient(client ArrLookupClient) Option
- func WithTMDBClient(client TMDBClient) Option
- func WithTVDBClient(client TVDBClient) Option
- func WithTVmazeClient(client TVmazeClient) Option
- func WithTagsPathFromDB(dbPath string) Option
- func WithTrackerDataLookup(lookup TrackerDataLookup) Option
- func WithTrackerRegistry(registry *trackers.Registry) Option
- type SceneDetector
- type SceneResult
- type SeasonPackGroupTagInfo
- type Service
- func (s *Service) CollectPreparationEvidence(ctx context.Context, request preparationstate.Request) (preparationstate.State, error)
- func (s *Service) EvaluateTrackerClaims(ctx context.Context, subject api.UploadSubject) (api.UploadSubject, error)
- func (s *Service) HydrateClientEvidence(ctx context.Context, request preparationstate.Request) (preparationstate.ClientEvidenceSnapshot, error)
- func (s *Service) HydratePrivateResources(ctx context.Context, request preparationstate.Request) (preparationstate.State, error)
- type TMDBClient
- type TVDBClient
- type TVmazeClient
- type TrackerDataLookup
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyTagOverrides ¶
func ApplyTagOverrides(path, currentTag, tagsPath string) (string, *api.TagOverride, error)
ApplyTagOverrides resolves a release tag and its optional naming overrides from tagsPath. An empty path or missing file is a no-op; read and JSON errors preserve currentTag. In-name and explicit-tag matches are case-sensitive.
func BuildReleaseName ¶
func BuildReleaseName(req api.ReleaseNameRequest, logger api.Logger) api.ReleaseNameResult
BuildReleaseName normalizes category and format signals, applies the request's manual omission controls, and builds tracker-style name variants. Unsupported category/format combinations return an empty name while preserving the applicable missing-field hints; a nil logger is accepted.
func EnsureDefaultTagOverrides ¶ added in v0.3.0
EnsureDefaultTagOverrides creates the bundled tag overrides beside the configured database when no user-managed file exists.
func EvaluateAudioBloatPolicy ¶ added in v0.3.0
func EvaluateAudioBloatPolicy( subject api.UploadSubject, candidateTrackers []string, registry *trackers.Registry, ) (map[string][]string, map[string][]string)
EvaluateAudioBloatPolicy returns tracker-scoped disallowed and warning-only extra audio languages for an exact workflow upload subject.
func ParseReleaseInfo ¶
func ParseReleaseInfo(path string) api.ReleaseInfo
ParseReleaseInfo parses the host-path basename into detached release fields. It derives the release format separately from the movie/TV category and fills missing season or episode values from the basename fallback parser.
func RebuildReleaseName ¶
func RebuildReleaseName(meta *preparationstate.State, logger api.Logger)
RebuildReleaseName regenerates the prepared release-name fields from the current metadata and the naming-only override controls. Fact-producing instruction values are already part of the metadata by the final rebuild. It is a no-op for nil input and replaces ResolvedNaming, all name variants, and missing-field hints in place without rewriting the detached Release evidence. Title and original-title overrides are ignored. TV year uses only a matching TVDB alias year; ResolvedNaming.Category records the category used for naming.
func SeasonPackMixedGroupTagNotice ¶ added in v0.2.3
func SeasonPackMixedGroupTagNotice(meta preparationstate.State) (string, bool)
SeasonPackMixedGroupTagNotice returns the user-facing notice for season packs with mismatched file-level group tags.
Types ¶
type AniListClient ¶ added in v0.2.5
type AniListClient interface {
FetchAniListMetadata(ctx context.Context, malID int) (tmdb.AniListMetadataResult, error)
}
AniListClient is the keyless AniList metadata surface used by external-ID resolution.
type ArrLookupClient ¶
type ArrLookupClient interface {
Lookup(ctx context.Context, meta preparationstate.State) (ArrLookupResult, error)
}
ArrLookupClient returns non-authoritative source-path evidence from an Arr service. An empty result means the source was not matched.
type ArrLookupResult ¶
type ArrLookupResult struct {
Source string
TMDBID int
IMDBID int
TVDBID int
TVmazeID int
Year int
Genres []string
ReleaseGroup string
}
ArrLookupResult carries non-authoritative identity, genre, and release-group evidence from an Arr path match. Source identifies the provider family.
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)
Option configures a Service during construction. Options run in caller order; later options may replace earlier dependencies.
func WithAniListClient ¶ added in v0.2.5
func WithAniListClient(client AniListClient) Option
WithAniListClient explicitly replaces the current AniList provider, including one inferred by an earlier WithTMDBClient option.
func WithBDInfoService ¶
func WithBlurayClient ¶
func WithClientDiscovery ¶ added in v0.3.0
func WithClientDiscovery(discovery *clientdiscovery.Module) Option
WithClientDiscovery installs canonical preparation-time client discovery.
func WithConfig ¶
WithConfig copies cfg for provider, path, and policy decisions.
func WithIMDBClient ¶
func WithIMDBClient(client IMDBClient) Option
func WithLogger ¶
WithLogger installs the service logger; nil is normalized to api.NopLogger.
func WithMediaInfoExporter ¶
WithMediaInfoExporter installs the MediaInfo exporter; nil permits the construction-time default.
func WithRadarrClient ¶
func WithRadarrClient(client ArrLookupClient) Option
func WithSRRDBPaths ¶
WithSRRDBPaths derives the scene cache and NFO directories from dbPath and may create the private cache directory during construction.
func WithSceneDetector ¶
func WithSceneDetector(detector SceneDetector) Option
WithSceneDetector installs an explicit detector. A non-nil detector is used even when configured scene detection is disabled; nil permits the config-gated default.
func WithSonarrClient ¶
func WithSonarrClient(client ArrLookupClient) Option
func WithTMDBClient ¶
func WithTMDBClient(client TMDBClient) Option
WithTMDBClient also installs client as the AniList provider when it implements AniListClient and no earlier option supplied one.
func WithTVDBClient ¶
func WithTVDBClient(client TVDBClient) Option
func WithTVmazeClient ¶
func WithTVmazeClient(client TVmazeClient) Option
func WithTagsPathFromDB ¶
WithTagsPathFromDB derives the optional tag-override file from dbPath.
func WithTrackerDataLookup ¶
func WithTrackerDataLookup(lookup TrackerDataLookup) Option
func WithTrackerRegistry ¶ added in v0.3.0
WithTrackerRegistry supplies tracker policies and factories and enables the default tracker-data client when no explicit lookup is installed.
type SceneDetector ¶
type SceneDetector interface {
Detect(ctx context.Context, meta preparationstate.State) (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 preparationstate.State) 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
}
Service collects source-scoped metadata evidence for canonical preparation. Optional providers and client discovery are installed through Option values.
func NewService ¶
NewService applies non-nil options in order, then installs default logging, MediaInfo, configured scene detection, tracker lookup, and Blu-ray providers. Resolving default scene paths may create private cache directories.
func (*Service) CollectPreparationEvidence ¶ added in v0.3.0
func (s *Service) CollectPreparationEvidence(ctx context.Context, request preparationstate.Request) (preparationstate.State, error)
CollectPreparationEvidence owns the complete ordered metadata collection sequence. Canonical preparation sees one deep collection port; intermediate mutable evidence and step ordering do not escape this package.
func (*Service) EvaluateTrackerClaims ¶ added in v0.3.0
func (s *Service) EvaluateTrackerClaims(ctx context.Context, subject api.UploadSubject) (api.UploadSubject, error)
EvaluateTrackerClaims evaluates every eligible tracker from the subject and appends strict claim_active failures for matches. Registry claim checkers run directly; API-backed policies may refresh a private 24-hour filesystem cache. The subject and its maps must be operation-owned because failures are appended in place. Any cancellation, checker, fetch, or cache error discards the partial result. Prepared-release state is neither read nor published.
func (*Service) HydrateClientEvidence ¶ added in v0.3.0
func (s *Service) HydrateClientEvidence( ctx context.Context, request preparationstate.Request, ) (preparationstate.ClientEvidenceSnapshot, error)
HydrateClientEvidence rebuilds only the private client snapshot needed when a compatible persisted generation is first reused after process restart.
func (*Service) HydratePrivateResources ¶ added in v0.3.0
func (s *Service) HydratePrivateResources( ctx context.Context, request preparationstate.Request, ) (preparationstate.State, error)
HydratePrivateResources reconstructs restart-only local artifacts and client evidence without rerunning tracker, provider, or canonical identity stages.
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 {
SearchSeries(ctx context.Context, filename, year string) ([]tvdb.SeriesSearchResult, int, error)
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)
GetNameDisambiguation(ctx context.Context, input tvdb.NameDisambiguationInput) tvdb.NameDisambiguation
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,
subject api.UploadSubject,
searchFileName string,
onlyID bool,
keepImages bool,
) (trackerdata.Result, error)
}
TrackerDataLookup provides optional remote enrichment for one tracker candidate. Implementations receive the operation's ID-only and image-retention policy; persistence and cross-tracker selection remain owned by Service.
Source Files
¶
- arr.go
- bluray.go
- client_evidence.go
- collection.go
- effective_facts.go
- external_ids.go
- media_details.go
- media_tracks.go
- mediainfo_ids.go
- mediainfo_languages.go
- mediainfo_parse.go
- naming.go
- overrides.go
- playlist_selection.go
- release.go
- release_overrides.go
- requirements.go
- scene.go
- scene_scoring.go
- service.go
- service_map.go
- service_resolve.go
- source_lookup.go
- tags.go
- tmdb_localized.go
- tracker_artifacts.go
- tracker_claims.go
- tracker_data.go