Help us shape the future of Go! Take the 2026 Go Developer Survey

overlays

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: GPL-3.0 Imports: 38 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Artwork

type Artwork struct {
	Posters        []Variant `json:"posters"`
	Backdrops      []Variant `json:"backdrops"`
	PinnedPoster   string    `json:"pinnedPoster,omitempty"`
	PinnedBackdrop string    `json:"pinnedBackdrop,omitempty"`
}

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 Facts

type Facts struct {
	NewEpisode  bool
	NewSeason   bool
	Returning   bool
	LastChance  time.Time
	Width       int
	Height      int
	HDR         bool
	DolbyVision bool
	Atmos       bool
}

type ImageSource

type ImageSource interface {
	Get(context.Context, string, int) ([]byte, string, error)
}

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 New

func New(db *sql.DB, o Options) *Service

func (*Service) Artwork

func (s *Service) Artwork(ctx context.Context, key core.RatingKey) (Artwork, error)

func (*Service) ArtworkMany added in v0.3.0

func (s *Service) ArtworkMany(ctx context.Context, keys []core.RatingKey) (map[core.RatingKey]Artwork, error)

func (*Service) Backdrop

func (s *Service) Backdrop(ctx context.Context, u *core.User, t *core.Title, lang string) ([]byte, string, error)

func (*Service) CacheStats added in v0.2.4

func (s *Service) CacheStats() CacheStats

func (*Service) CustomPostersEnabled added in v0.2.34

func (s *Service) CustomPostersEnabled() bool

func (*Service) Inspect added in v0.2.4

func (s *Service) Inspect(ctx context.Context, u *core.User, t *core.Title) (Presentation, error)

func (*Service) Labels

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 (*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

func (s *Service) Sample(cfg Settings) ([]byte, string, error)

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 (s *Service) SampleContext(ctx context.Context, cfg Settings) ([]byte, string, error)

func (*Service) SaveArtwork

func (s *Service) SaveArtwork(ctx context.Context, key core.RatingKey, v Artwork) error

func (*Service) SaveSettings

func (s *Service) SaveSettings(ctx context.Context, v Settings) error

func (*Service) Settings

func (s *Service) Settings(ctx context.Context) (Settings, error)

func (*Service) Version

func (s *Service) Version(ctx context.Context, u *core.User, t *core.Title, lang string) string

func (*Service) WithArtworkPage added in v0.3.0

func (s *Service) WithArtworkPage(ctx context.Context, keys []core.RatingKey) (context.Context, error)

WithArtworkPage reads saved variants for a grid once and keeps settings on the context so each tile does not query them again.

func (*Service) WithSettingsSnapshot added in v0.2.6

func (s *Service) WithSettingsSnapshot(ctx context.Context) context.Context

WithSettingsSnapshot reads settings once for a bounded render. It avoids a database round trip per tile without keeping settings stale across requests.

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"`
}

type Variant

type Variant struct {
	Path     string   `json:"path"`
	Language string   `json:"language,omitempty"`
	Tags     []string `json:"tags,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL