config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppName           = "SomaFM CLI"
	AppTagline        = "Terminal radio player"
	AppDescription    = "A terminal-based music player for SomaFM radio stations"
	AppAuthor         = "Ilya Glebov"
	AppAuthorURL      = "https://ilyaglebov.dev"
	AppAuthorURLShort = "ilyaglebov.dev"
	AppProjectURL     = "https://github.com/glebovdev/somafm-cli"
	AppProjectShort   = "github.com/glebovdev/somafm-cli"
	AppDonateURL      = "https://somafm.com/donate/"
	AppDonateShort    = "somafm.com/donate"

	ConfigDir         = ".config/somafm"
	ConfigFileName    = "config.yml"
	DefaultVolume     = 70
	MinVolume         = 0
	MaxVolume         = 100
	DefaultBufferSecs = 5
	MinBufferSecs     = 0
	MaxBufferSecs     = 60
)

Variables

View Source
var AppVersion = "dev"

AppVersion can be overridden at build time using ldflags: go build -ldflags "-X github.com/glebovdev/somafm-cli/internal/config.AppVersion=1.0.0"

Functions

func ClampVolume

func ClampVolume(volume int) int

ClampVolume ensures volume is within the valid range [0, 100].

func GetColor

func GetColor(colorStr string) tcell.Color

func GetConfigPath

func GetConfigPath() (string, error)

Types

type Config

type Config struct {
	Volume        int      `yaml:"volume"`
	BufferSeconds int      `yaml:"buffer_seconds"`
	LastStation   string   `yaml:"last_station"`
	Favorites     []string `yaml:"favorites"`
	Theme         Theme    `yaml:"theme"`
}

func DefaultConfig

func DefaultConfig() *Config

func Load

func Load() (*Config, error)

func (*Config) CleanupFavorites

func (c *Config) CleanupFavorites(validStationIDs map[string]bool)

func (*Config) IsFavorite

func (c *Config) IsFavorite(stationID string) bool

func (*Config) Save

func (c *Config) Save() error

Save writes the configuration to disk atomically using temp file + rename.

func (*Config) ToggleFavorite

func (c *Config) ToggleFavorite(stationID string)

type Theme

type Theme struct {
	Background                  string `yaml:"background"`
	Foreground                  string `yaml:"foreground"`
	Borders                     string `yaml:"borders"`
	Highlight                   string `yaml:"highlight"`
	MutedVolume                 string `yaml:"muted_volume"`
	HeaderBackground            string `yaml:"header_background"`
	StationListHeaderBackground string `yaml:"station_list_header_background"`
	StationListHeaderForeground string `yaml:"station_list_header_foreground"`
	HelpBackground              string `yaml:"help_background"`
	HelpForeground              string `yaml:"help_foreground"`
	HelpHotkey                  string `yaml:"help_hotkey"`
	GenreTagBackground          string `yaml:"genre_tag_background"`
	ModalBackground             string `yaml:"modal_background"`
}

Jump to

Keyboard shortcuts

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