config

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearCache

func ClearCache() error

ClearCache removes all cached data

func ClearServerConfig

func ClearServerConfig() error

ClearServerConfig removes all server-related configuration (type, URL, credentials) while preserving other settings (player, UI, logging)

func DefaultCachePath

func DefaultCachePath() string

DefaultCachePath returns the default cache directory path for the current OS

func SaveConfig

func SaveConfig(cfg *Config) error

SaveConfig saves the current configuration to file

Types

type Config

type Config struct {
	Server         ServerConfig             `mapstructure:"server"`
	Player         PlayerConfig             `mapstructure:"player"`
	UI             UIConfig                 `mapstructure:"ui"`
	Logging        LoggingConfig            `mapstructure:"logging"`
	CurrentProfile string                   `mapstructure:"current_profile"`
	Profiles       map[string]ProfileConfig `mapstructure:"profiles"`
}

Config holds all application configuration

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default configuration

func LoadConfig

func LoadConfig() (*Config, error)

LoadConfig loads configuration from file and environment

func (*Config) ApplyProfileForUI

func (c *Config) ApplyProfileForUI(name string)

ApplyProfileForUI switches the active server profile in memory.

func (*Config) IsConfigured

func (c *Config) IsConfigured() bool

IsConfigured returns true if the server URL and token are set

func (*Config) ProfileNames

func (c *Config) ProfileNames() []string

ProfileNames returns configured profile names in stable insertion-free order.

type LoggingConfig

type LoggingConfig struct {
	File  string `mapstructure:"file"`
	Level string `mapstructure:"level"`
}

LoggingConfig holds logging configuration

type PlayerConfig

type PlayerConfig struct {
	Command   string   `mapstructure:"command"`
	Args      []string `mapstructure:"args"`
	StartFlag string   `mapstructure:"start_flag"` // e.g., "--start=" or "--start-time="
}

PlayerConfig holds media player configuration

type ProfileConfig

type ProfileConfig struct {
	Server ServerConfig `mapstructure:"server"`
}

ProfileConfig stores a named server profile.

type ServerConfig

type ServerConfig struct {
	Type     SourceType `mapstructure:"type"     yaml:"type"`     // "plex" or "jellyfin"
	URL      string     `mapstructure:"url"      yaml:"url"`      // Server URL
	Token    string     `mapstructure:"token"    yaml:"token"`    // Plex token OR Jellyfin API key
	UserID   string     `mapstructure:"user_id"  yaml:"user_id"`  // Jellyfin only
	Username string     `mapstructure:"username" yaml:"username"` // Jellyfin only (display)
}

ServerConfig holds media server configuration

type SourceType

type SourceType string

SourceType identifies the media server backend

const (
	SourceTypePlex     SourceType = "plex"
	SourceTypeJellyfin SourceType = "jellyfin"
)

type UIConfig

type UIConfig struct {
	ShowWatchStatus   bool `mapstructure:"show_watch_status"`   // Show watched/unwatched/in-progress indicators
	ShowLibraryCounts bool `mapstructure:"show_library_counts"` // Keep library item counts visible after sync
	HideWatched       bool `mapstructure:"hide_watched"`        // Hide items that are already watched
	Autoplay          bool `mapstructure:"autoplay"`            // Automatically play the next episode
}

UIConfig holds UI configuration

Jump to

Keyboard shortcuts

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