config

package
v1.19.2 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigPath

func ConfigPath() (string, error)

ConfigPath returns the path to the config file

func EnsureBuiltinProviders added in v1.19.2

func EnsureBuiltinProviders() error

EnsureBuiltinProviders makes the built-in providers available through the provider registry. The loader is idempotent, so callers can use this before reading provider facts without coordinating initialization order.

func NormalizeProviderConfigs added in v1.19.2

func NormalizeProviderConfigs(values map[string]ProviderConfig, reg *provider.Registry) map[string]ProviderConfig

NormalizeProviderConfigs keeps only user-owned provider configuration values. Provider schema defaults are applied at runtime by ProviderConfigValues.

func ProviderConfigComplete added in v1.19.2

func ProviderConfigComplete(p provider.Provider, values map[string]interface{}) bool

ProviderConfigComplete reports whether all required schema fields are present.

func ProviderDisplayName added in v1.19.2

func ProviderDisplayName(p provider.Provider) string

ProviderDisplayName returns the provider-owned display name, falling back to the provider's stable registry name.

func ProvidersByDisplayOrder added in v1.19.2

func ProvidersByDisplayOrder(reg *provider.Registry) []provider.Provider

ProvidersByDisplayOrder returns registered providers sorted for UI display.

func ResolveTemplate added in v1.19.2

func ResolveTemplate(template string, ctx *FormatContext, metadata *provider.Metadata, reg *provider.Registry) (string, error)

ResolveTemplate processes a template string with metadata.

func TemplateVariableDisplayOrder added in v1.19.2

func TemplateVariableDisplayOrder(reg *provider.Registry, variableName string) int

TemplateVariableDisplayOrder returns the earliest provider display order for a variable, or a large default when no provider owns it.

func TemplateVariableProviders added in v1.19.2

func TemplateVariableProviders(reg *provider.Registry, variableName string) []provider.Provider

TemplateVariableProviders returns providers that can supply the variable.

func TemplateVariablesForMediaType added in v1.19.2

func TemplateVariablesForMediaType(reg *provider.Registry, mediaType provider.MediaType) []provider.TemplateVariable

TemplateVariablesForMediaType returns provider-owned variables available for a media type, using provider display order when multiple providers supply the same variable.

Types

type FormatConfig

type FormatConfig struct {
	ShowFolder           string                    `json:"show_folder"`
	SeasonFolder         string                    `json:"season_folder"`
	Episode              string                    `json:"episode"`
	Movie                string                    `json:"movie"`
	PreserveExistingTags bool                      `json:"preserve_existing_tags"`
	LogRetentionDays     int                       `json:"log_retention_days"`
	EnableLogging        bool                      `json:"enable_logging"`
	MetadataWorkerCount  int                       `json:"metadata_worker_count"`
	Providers            map[string]ProviderConfig `json:"providers,omitempty"`
}

FormatConfig holds the format templates for different media types

func DefaultConfig

func DefaultConfig() *FormatConfig

DefaultConfig returns the default format configuration

func Load

func Load() (*FormatConfig, error)

Load reads the configuration from disk

func (*FormatConfig) ApplyEpisodeTemplate

func (cfg *FormatConfig) ApplyEpisodeTemplate(ctx *FormatContext) string

ApplyEpisodeTemplate applies the episode template using the provided context

func (*FormatConfig) ApplyMovieTemplate

func (cfg *FormatConfig) ApplyMovieTemplate(ctx *FormatContext) string

ApplyMovieTemplate applies the movie template using the provided context

func (*FormatConfig) ApplySeasonFolderTemplate

func (cfg *FormatConfig) ApplySeasonFolderTemplate(ctx *FormatContext) string

ApplySeasonFolderTemplate applies the season folder template using the provided context

func (*FormatConfig) ApplyShowFolderTemplate

func (cfg *FormatConfig) ApplyShowFolderTemplate(ctx *FormatContext) string

ApplyShowFolderTemplate applies the show folder template using the provided context

func (*FormatConfig) ConfigureProviderRegistry added in v1.19.2

func (cfg *FormatConfig) ConfigureProviderRegistry(reg *provider.Registry) []error

ConfigureProviderRegistry applies enabled app provider configuration to the registry. It returns per-provider warnings instead of failing the whole UI.

func (*FormatConfig) NeedsMetadata added in v1.7.0

func (cfg *FormatConfig) NeedsMetadata() bool

NeedsMetadata checks if any template uses variables that would benefit from metadata

func (*FormatConfig) Provider added in v1.19.2

func (cfg *FormatConfig) Provider(name string) ProviderConfig

Provider returns stored user config for a provider name.

func (*FormatConfig) ProviderConfigValues added in v1.19.2

func (cfg *FormatConfig) ProviderConfigValues(p provider.Provider) map[string]interface{}

ProviderConfigValues returns provider schema field values from app config, using provider defaults for fields not persisted by the app config.

func (*FormatConfig) ProviderEnabled added in v1.19.2

func (cfg *FormatConfig) ProviderEnabled(p provider.Provider) bool

ProviderEnabled reports whether this app config enables the provider.

func (*FormatConfig) ProviderRuntimeConfigs added in v1.19.2

func (cfg *FormatConfig) ProviderRuntimeConfigs(reg *provider.Registry) []provider.RuntimeConfig

ProviderRuntimeConfigs adapts the app config into generic provider runtime configs consumed by metadata fetching.

func (*FormatConfig) Save

func (cfg *FormatConfig) Save() error

Save writes the configuration to disk

func (*FormatConfig) SetProviderEnabled added in v1.19.2

func (cfg *FormatConfig) SetProviderEnabled(name string, enabled bool)

SetProviderEnabled updates the enabled flag for one provider.

func (*FormatConfig) SetProviderValue added in v1.19.2

func (cfg *FormatConfig) SetProviderValue(providerName, fieldName string, value interface{})

SetProviderValue updates one provider config field.

type FormatContext

type FormatContext struct {
	// Core identifiers
	ShowName  string
	MovieName string
	Year      string
	Season    int
	Episode   int

	// File information
	OriginalName string
	Node         *treeview.Node[treeview.FileInfo]

	// External metadata supplied by metadata providers.
	Metadata *provider.Metadata

	// Configuration
	Config *FormatConfig
}

FormatContext holds all the contextual information needed for formatting media names. This allows us to easily extend with new metadata without changing function signatures.

type ProviderConfig added in v1.19.2

type ProviderConfig struct {
	Enabled bool                   `json:"enabled"`
	Config  map[string]interface{} `json:"config,omitempty"`
}

ProviderConfig stores persisted settings for a metadata provider.

Jump to

Keyboard shortcuts

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