Documentation
¶
Overview ¶
Package ignore holds the cross-subsystem "should I skip this library / show / episode?" decision. One policy value constructed in main.run() is injected into notifyAdapter, Syncer, and Scheduler via their Config, replacing three duplicated ignore implementations and two inline slices.Contains guards in the scheduler.
Consumers depend on api.IgnoreChecker (declared in internal/api) rather than on *Policy directly, so tests can substitute a fake policy without importing this package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Policy ¶
Policy encapsulates the ignore rules applied before touching a library, show, or episode. Zero value is valid: an empty Policy never skips anything.
Construct with NewPolicy in the composition root; the Libraries and Labels fields hold defensive copies of the configured slices so the caller can mutate its own env-var-derived slices without affecting the policy.
func NewPolicy ¶
NewPolicy returns a Policy with defensive copies of the supplied slices. Nil inputs are allowed and produce an empty policy (which always reports "do not skip").
func (*Policy) IgnoreLibrary ¶
IgnoreLibrary reports whether a library section title is on the ignore list. Case-sensitive to match the pre-extraction behaviour in Syncer.shouldIgnoreLibrary and the scheduler's inline slices.Contains guards.
func (*Policy) IgnoreShowLabels ¶
IgnoreShowLabels reports whether any of the show's labels match the ignore list. Case-sensitive equality on label.Tag, mirroring the pre-extraction hasIgnoreLabel helper in sync/tracks.go.
func (*Policy) ShouldSkipEpisode ¶
func (p *Policy) ShouldSkipEpisode(ctx context.Context, reader api.PlexReader, ref *streams.Episode) bool
ShouldSkipEpisode combines IgnoreLibrary + a ShowMetadata fetch + IgnoreShowLabels into a single decision. Returns true if the episode should be skipped for any reason.
A nil ref is treated as "no reason to skip" (false) so the scheduler can call this from paths where the episode reference is absent without guarding at every call site.
On ShowMetadata fetch failure the method returns false (do not skip) to match the pre-extraction behaviour in Syncer.shouldIgnoreShow: conservatism here trades a single episode processed against a transient Plex blip for never silently dropping work on a real error.
DEBUG log keys ("library ignored", "show ignored") are preserved verbatim from the three pre-extraction emit sites so any Loki query grepping on those strings keeps firing.