config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package config loads the spotui settings file and resolves the paths where spotui keeps its state.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// ClientID is the client ID of the user's own Spotify developer app. It is
	// used only for Web API calls (search and saved albums).
	ClientID string `toml:"client_id"`
	// RedirectPort is the loopback port of the Web API login callback. The
	// developer app must list http://127.0.0.1:<port>/callback.
	RedirectPort int `toml:"redirect_port"`

	DeviceName    string `toml:"device_name"`
	AudioBackend  string `toml:"audio_backend"`
	AudioDevice   string `toml:"audio_device"`
	Bitrate       int    `toml:"bitrate"`
	InitialVolume int    `toml:"initial_volume"`

	// CoverArt selects how cover images are drawn: "auto", "kitty",
	// "blocks", or "off".
	CoverArt string `toml:"cover_art"`
}

Config holds the user settings from config.toml.

func Load

func Load(path string) (Config, error)

Load reads the config file. A missing file gives the defaults, and a commented template is written so the user can find and edit it. SPOTUI_CLIENT_ID overrides client_id.

type Paths

type Paths struct {
	ConfigDir   string
	StateDir    string
	ConfigFile  string
	PlayerState string
	WebAPIToken string
	LogFile     string
}

Paths are the files spotui reads and writes.

func ResolvePaths

func ResolvePaths() (Paths, error)

ResolvePaths returns the spotui paths. The config file is in the user config directory. The login, the token, and the log are in the state directory of the operating system.

func (Paths) EnsureDirs

func (p Paths) EnsureDirs() error

EnsureDirs creates the config and state directories.

Jump to

Keyboard shortcuts

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