config

package
v0.0.0-...-0805d90 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Capability

type Capability string

Capability is a capability ID.

const (
	// CapabilityWatch is the filesystem watch capability ID.
	CapabilityWatch Capability = "watch"
	// CapabilityRemux is the remux capability ID.
	CapabilityRemux Capability = "remux"
	// CapabilityTranscode is the transcode capability ID.
	CapabilityTranscode Capability = "transcode"
)

type Config

type Config struct {
	// HTTP is the "http" configuration section.
	HTTP *HTTP `toml:"http"`
	// Repos is the collection of repository configuration, keyed by their ID.
	Repos map[string]*Repo `toml:"repos"`
}

Config is a struct representation of the TOML configuration file.

func Parse

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

Parse parses the configuration from a file.

func ParseWithDefaults

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

ParseWithDefaults parses the configuration from a file and completes it with default values (Section.Defaults).

func (*Config) Defaults

func (c *Config) Defaults() *Config

Defaults completes the configuration with default values.

type HTTP

type HTTP struct {
	// Host is the host string, used for http.ListenAndServe, defaults to ":8000".
	Host string `toml:"host"`
}

HTTP is an HTTP configuration section of the configuration file.

func (*HTTP) Defaults

func (h *HTTP) Defaults() *HTTP

Defaults completes the section with default values.

type MetadataSource

type MetadataSource string

MetadataSource is a metadata source ID.

const (
	// MetadataSourceLiteral is the literal metadata source ID (meta.NewLiteralSource).
	MetadataSourceLiteral MetadataSource = "literal"
	// MetadataSourceAnalysis is the analysis metadata source ID (meta.NewFileAnalysisSource).
	MetadataSourceAnalysis MetadataSource = "analysis"
	// MetadataSourceTMDB is the TMDB (The Movie Database) metadata source ID (tmdb.NewSource).
	MetadataSourceTMDB MetadataSource = "tmdb"
)

type Repo

type Repo struct {
	// Name is the name of the repository, defaults to the repository ID.
	Name string `toml:"name"`
	// Path is the relative or absolute path of the repository's directory.
	Path string `toml:"path"`
	// Path is the relative or absolute path of the repository's index file, can be empty.
	IndexPath string `toml:"index_path"`
	// CachePath is the relative or absolute path of the repository's operation cache, defaults to <path>/.katana/cache.
	CachePath string `toml:"cache_path"`
	// Capabilities are the capability IDs of the repository.
	Capabilities []Capability `toml:"capabilities"`
	// Sources is a mapping of used metadata sources and their configuration, keyed by their name.
	Sources map[MetadataSource]map[string]interface{} `toml:"sources"`
}

Repo is a base repository configuration.

func (*Repo) Capable

func (r *Repo) Capable(c Capability) bool

Capable checks whether a Capability is contained in the configuration.

func (*Repo) Defaults

func (r *Repo) Defaults() *Repo

Defaults completes the section with default values.

type Section

type Section[T any] interface {
	// Defaults completes the section with default values, set values are not replaced.
	Defaults() T
}

Section is a section of the configuration file. T is always going to be the type of this section.

Jump to

Keyboard shortcuts

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