Documentation
¶
Overview ¶
Package availability discovers releases incrementally and spends a bounded background allowance validating useful candidates. Recent releases require evidence for discovery; older catalogue entries need no background search.
Index ¶
- func EvidenceWindow(t core.Title, now time.Time) bool
- func WithDiscoveryMemo(ctx context.Context) context.Context
- type Catalog
- type Deps
- type FeedStatus
- type Feeds
- type NewRelease
- type Observation
- type Service
- func (s *Service) Candidates(ctx context.Context, t *core.Title) []core.Release
- func (s *Service) Cycle(ctx context.Context) error
- func (s *Service) Explain(ctx context.Context, key core.RatingKey) (TitleEvidence, error)
- func (s *Service) FilterDiscovery(ctx context.Context, items []core.Title) []core.Title
- func (s *Service) FilterDiscoveryCurrent(ctx context.Context, items []core.Title) []core.Title
- func (s *Service) Handler() http.Handler
- func (s *Service) HiddenMovies(ctx context.Context) []core.RatingKey
- func (s *Service) HiddenShows(ctx context.Context) []core.RatingKey
- func (s *Service) Hubs(ctx context.Context, limit int) []core.Hub
- func (s *Service) Invalidate(ctx context.Context, id string)
- func (s *Service) NewReleases(ctx context.Context) ([]NewRelease, error)
- func (s *Service) Observe(ctx context.Context, t *core.Title, r core.Release)
- func (s *Service) Prioritize(ctx context.Context, items []core.Title) []core.Title
- func (s *Service) RecordSearch(ctx context.Context, t *core.Title, rs []core.Release)
- func (s *Service) Run(ctx context.Context)
- func (s *Service) Status(ctx context.Context) (Status, error)
- func (s *Service) Summary(ctx context.Context) (Summary, error)
- type Status
- type Summary
- type TitleEvidence
- type Validator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EvidenceWindow ¶ added in v0.2.9
EvidenceWindow is a proof window, not a delay: an eligible observed release unlocks a title immediately. Older catalogue entries do not need a scan.
Types ¶
type Deps ¶
type Deps struct {
DB *sql.DB
Config func() config.Config
Feeds Feeds
Catalog Catalog
Validator Validator
Seal func(string) (string, error)
Open func(string) (string, error)
CacheCheck func(context.Context, []string) (map[string]bool, bool)
// Search is a budgeted id search across indexers and configured addons.
Search func(context.Context, core.SearchRequest) ([]core.Release, error)
Watchlist func(context.Context) (map[core.RatingKey]bool, error)
Active func() bool
Now func() time.Time
Logger *slog.Logger
ConfigGeneration func() uint64
}
type FeedStatus ¶
type FeedStatus struct {
core.ReleaseFeed
Selected bool `json:"selected"`
LastAttempt int64 `json:"lastAttempt"`
LastSync int64 `json:"lastSync"`
Gap bool `json:"gap"`
Message string `json:"message"`
Matched int `json:"matched"`
Queued bool `json:"queued"`
Progress float64 `json:"progress,omitempty"`
ETASeconds int64 `json:"etaSeconds,omitempty"`
}
type NewRelease ¶ added in v0.3.0
type NewRelease struct {
Key string `json:"key"`
Title string `json:"title"`
Year int `json:"year,omitempty"`
Poster string `json:"poster,omitempty"`
Theatrical int64 `json:"theatrical,omitempty"`
Digital int64 `json:"digital,omitempty"`
Code string `json:"code"`
Source string `json:"source,omitempty"`
NextCheck int64 `json:"nextCheck,omitempty"`
Reason string `json:"reason,omitempty"`
}
NewRelease is one movie inside the evidence window, for the owner list.
type Observation ¶
type Observation struct {
Key core.RatingKey `json:"key"`
Title string `json:"title"`
Release string `json:"release"`
Protocol string `json:"protocol"`
State string `json:"state"`
Reason string `json:"reason"`
FirstSeen int64 `json:"firstSeen"`
FirstVerified int64 `json:"firstVerified"`
VerifiedAt int64 `json:"verifiedAt"`
NextCheck int64 `json:"nextCheck"`
}
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) Candidates ¶
Candidates serves remembered descriptors locally; playback still applies its exact viewer/device policy and validates the selected source.
func (*Service) FilterDiscovery ¶ added in v0.2.9
A short local memo keeps repeated Plex artwork/list requests inexpensive. New observations and invalidations clear it immediately. Other cluster nodes see changes within fifteen seconds, without a provider request.
func (*Service) FilterDiscoveryCurrent ¶ added in v0.3.0
FilterDiscoveryCurrent bypasses node-local visibility and resolver memos for one bounded policy preflight batch. It performs no provider lookup.
func (*Service) HiddenMovies ¶ added in v0.2.9
HiddenMovies supplies SQL pagination with exclusions from the recent local mirror only. No per-title provider lookup or historical catalogue walk occurs.
func (*Service) HiddenShows ¶ added in v0.2.9
HiddenShows excludes first-day series before SQL pagination, just as movies.
func (*Service) Invalidate ¶
Invalidate retracts positive evidence immediately when playback or the owner invalidates a release. The title and its other sources remain discoverable.
func (*Service) NewReleases ¶ added in v0.3.0
func (s *Service) NewReleases(ctx context.Context) ([]NewRelease, error)
func (*Service) Observe ¶
Observe reuses an actual successful resolver health check. Optimistic starts and prepared sessions without health evidence do not call this method.
func (*Service) Prioritize ¶
func (*Service) RecordSearch ¶ added in v0.2.9
RecordSearch retains descriptors from an actual requested search. It does not initiate searches, grab media or claim health. Policy is reevaluated on reads.
type Status ¶
type Status struct {
Mode string `json:"mode"`
Message string `json:"message"`
Feeds []FeedStatus `json:"feeds"`
Usage map[string]int64 `json:"usage"`
Counts map[string]int `json:"counts"`
Recent []Observation `json:"recent"`
Day string `json:"day"`
Ceilings map[string]int64 `json:"ceilings,omitempty"`
Effort string `json:"effort"`
EffectiveFeedRequests int `json:"effectiveFeedRequests"`
EffectivePollMinutes int `json:"effectivePollMinutes"`
EffectiveMaxPages int `json:"effectiveMaxPages"`
OverAllowance bool `json:"overAllowance"`
}
type Summary ¶ added in v0.3.0
type Summary struct {
Ready int `json:"ready"`
Waiting int `json:"waiting"`
LastChecked int64 `json:"lastChecked,omitempty"`
}
Summary is the quiet status line for "When they can play": how many in-window movies are ready, how many are still waiting, and when Ether last looked.
type TitleEvidence ¶ added in v0.3.0
type TitleEvidence struct {
Code string `json:"code"`
CheckedAt int64 `json:"checkedAt,omitempty"`
NextCheck int64 `json:"nextCheck,omitempty"`
Reason string `json:"reason,omitempty"`
}
TitleEvidence is why a movie is shown or hidden. Codes are for the owner console; they are not sentences.