config

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package config assembles the application configuration. It sits at the edge of the dependency graph: every section's type is owned by the package that consumes it (cast, extractor, resolve) and composed here, so domain packages never import application-level state.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Device    DeviceConfig          `yaml:"device" validate:"required"`
	Network   cast.NetworkConfig    `yaml:"network" validate:"required"`
	Browser   extract.BrowserConfig `yaml:"browser" validate:"required"`
	Capture   extract.CaptureConfig `yaml:"capture" validate:"required"`
	Actions   extract.ActionConfig  `yaml:"actions" validate:"required"`
	Sources   []Source              `yaml:"sources" validate:"dive"`
	Resolver  resolve.Config        `yaml:"resolver" validate:"required"`
	Transcode cast.TranscodeConfig  `yaml:"transcode" validate:"required"`
	Whisper   cast.WhisperConfig    `yaml:"whisper"`
	TMDB      TMDB                  `yaml:"tmdb"`
}

func Load

func Load(path string) (*Config, error)

Load reads the YAML file at path plus a sibling *.local.yaml and CASTOR_* environment variables, decodes them over the typed defaults, and validates the result.

func (*Config) AllEpisodeURLs added in v1.3.0

func (c *Config) AllEpisodeURLs(itemID string, season, episode uint) []string

func (*Config) AllMovieURLs added in v1.3.0

func (c *Config) AllMovieURLs(itemID string) []string

func (*Config) Cast

func (c *Config) Cast() cast.Config

func (*Config) Extractor

func (c *Config) Extractor() extract.Config

type DeviceConfig added in v1.8.0

type DeviceConfig struct {
	// Name identifies the device to discovery. It is required only without Host:
	// once Host pins the device, Name is just a display label and may be omitted.
	Name string      `yaml:"name" validate:"required_without=Host"`
	Type device.Type `yaml:"type" validate:"required"`

	// Host pins the device's address to skip discovery (see device.Config.Address):
	// a bare IP/host for any family, or a DLNA description URL. Left empty, Castor
	// discovers the device by Name over SSDP/mDNS.
	Host string `yaml:"host"`

	Roku device.RokuConfig `yaml:"roku"`
}

DeviceConfig is the composition-root device section: the generic cast target plus each device family's optional connect settings. This is the one place the application binds a family's typed config (device.RokuConfig) to its YAML, so the agnostic layers below never name a family; resolve() collapses it into the opaque device.Config they carry.

type Source

type Source struct {
	Proxies   []string  `yaml:"proxies" validate:"required,min=1"`
	Templates Templates `yaml:"templates" validate:"required"`
}

Source defines a set of proxy hosts and the URL templates to reach a movie or episode page on them.

func (*Source) EpisodeURLs

func (s *Source) EpisodeURLs(itemID string, season, episode uint) []string

func (*Source) MovieURLs

func (s *Source) MovieURLs(itemID string) []string

type TMDB

type TMDB struct {
	APIKey string `yaml:"api_key"`
}

TMDB holds settings for the TMDB browse subcommand. The API key may also be supplied via the CASTOR_TMDB__API_KEY environment variable, so it is intentionally not marked required here.

type Templates

type Templates struct {
	Movie   string `yaml:"movie" validate:"required"`
	Episode string `yaml:"episode" validate:"required"`
}

Jump to

Keyboard shortcuts

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