Documentation
¶
Overview ¶
Package overlays creates truthful, versioned poster variants in pure Go. Quality badges require observed release facts; metadata estimates are never treated as evidence of 4K/HDR/Dolby Vision/Atmos availability.
Index ¶
- type Artwork
- type CacheStats
- type Facts
- type ImageSource
- type LayerReport
- type Options
- type Presentation
- type Service
- func (s *Service) Artwork(ctx context.Context, key core.RatingKey) (Artwork, error)
- func (s *Service) ArtworkMany(ctx context.Context, keys []core.RatingKey) (map[core.RatingKey]Artwork, error)
- func (s *Service) Backdrop(ctx context.Context, u *core.User, t *core.Title, lang string) ([]byte, string, error)
- func (s *Service) CacheStats() CacheStats
- func (s *Service) CustomPostersEnabled() bool
- func (s *Service) Inspect(ctx context.Context, u *core.User, t *core.Title) (Presentation, error)
- func (s *Service) Labels(ctx context.Context, u *core.User, t *core.Title) []string
- func (s *Service) Logo(ctx context.Context, t *core.Title) ([]byte, string, error)
- func (s *Service) Paths(ctx context.Context, u *core.User, t *core.Title, lang string) (string, string)
- func (s *Service) Poster(ctx context.Context, u *core.User, t *core.Title, lang string) ([]byte, string, error)
- func (s *Service) Router(cat core.Catalog, users func(*http.Request, int64) (*core.User, error)) http.Handler
- func (s *Service) Sample(cfg Settings) ([]byte, string, error)
- func (s *Service) SampleContext(ctx context.Context, cfg Settings) ([]byte, string, error)
- func (s *Service) SaveArtwork(ctx context.Context, key core.RatingKey, v Artwork) error
- func (s *Service) SaveSettings(ctx context.Context, v Settings) error
- func (s *Service) Settings(ctx context.Context) (Settings, error)
- func (s *Service) Version(ctx context.Context, u *core.User, t *core.Title, lang string) string
- func (s *Service) WithArtworkPage(ctx context.Context, keys []core.RatingKey) (context.Context, error)
- func (s *Service) WithSettingsSnapshot(ctx context.Context) context.Context
- type Settings
- type Variant
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheStats ¶ added in v0.2.4
type CacheStats struct {
MemoryHits uint64 `json:"memoryHits"`
DiskHits uint64 `json:"diskHits"`
Renders uint64 `json:"renders"`
Coalesced uint64 `json:"coalesced"`
MemoryEvictions uint64 `json:"memoryEvictions"`
DiskEvictions uint64 `json:"diskEvictions"`
DiskErrors uint64 `json:"diskErrors"`
MemoryBytes int64 `json:"memoryBytes"`
DiskBytes int64 `json:"diskBytes"`
MemoryEntries int `json:"memoryEntries"`
DiskEntries int `json:"diskEntries"`
InFlight int `json:"inFlight"`
}
CacheStats is a point-in-time diagnostic snapshot. Counters last for this Service's lifetime; disk sizes include the checksum envelope.
type ImageSource ¶
type LayerReport ¶ added in v0.2.4
type LayerReport struct {
Key string `json:"key"`
State string `json:"state"` // ready, unavailable, off
Labels []string `json:"labels"`
Reason string `json:"reason"`
}
LayerReport describes exactly why a layer is or isn't present in the rendered poster. The designer and production compositor share this evaluation.
type Options ¶
type Options struct {
// CacheDir contains disposable generated variants only. Empty disables disk caching.
CacheDir string
// Zero selects defaults (16 MiB memory, 256 MiB disk); negative disables a tier.
MemoryCacheBytes int64
DiskCacheBytes int64
// RenderConcurrency bounds CPU-heavy cold work (default 2, maximum 16).
RenderConcurrency int
Images ImageSource
Allowed func(*core.User, *core.Title) bool
Facts func(context.Context, *core.User, *core.Title) Facts
FactsFor func(context.Context, *core.User, *core.Title, bool, bool) Facts
Ratings *ratings.Service
Taste func(context.Context, *core.User) []string
Now func() time.Time
Variants func(context.Context, *core.Title, string) (Artwork, error)
}
type Presentation ¶ added in v0.2.4
type Presentation struct {
Labels []string `json:"labels"`
Layers []LayerReport `json:"layers"`
}
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) ArtworkMany ¶ added in v0.3.0
func (*Service) CacheStats ¶ added in v0.2.4
func (s *Service) CacheStats() CacheStats
func (*Service) CustomPostersEnabled ¶ added in v0.2.34
func (*Service) Paths ¶
func (s *Service) Paths(ctx context.Context, u *core.User, t *core.Title, lang string) (string, string)
Paths returns owner-approved variants, selected by language and actual tags.
func (*Service) Poster ¶
func (s *Service) Poster(ctx context.Context, u *core.User, t *core.Title, lang string) ([]byte, string, error)
Poster decodes bounded images and uses a bounded generated-image cache.
func (*Service) Router ¶
func (s *Service) Router(cat core.Catalog, users func(*http.Request, int64) (*core.User, error)) http.Handler
Router must be owner authenticated. Previews pass through the same generator as Plex; the caller supplies real catalog titles, never arbitrary image URLs.
func (*Service) Sample ¶ added in v0.2.4
Sample is an original offline illustration. Its fictional facts are deliberately separate from Labels, which accepts only observed catalog/release information.
func (*Service) SampleContext ¶ added in v0.2.4
func (*Service) SaveArtwork ¶
func (*Service) SaveSettings ¶
type Settings ¶
type Settings struct {
Enabled bool `json:"enabled"`
Status bool `json:"status"`
Quality bool `json:"quality"`
Ratings bool `json:"ratings"`
Details bool `json:"details"`
Personalize bool `json:"personalize"`
Localize bool `json:"localize"`
Style string `json:"style"`
Position string `json:"position"`
Accent string `json:"accent"`
Size string `json:"size"`
}