app

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadOrSetupConfig

func LoadOrSetupConfig(r io.Reader, w io.Writer) (*config.Config, error)

LoadOrSetupConfig loads the config file. If no config exists, it runs first-time setup by prompting the user via the provided reader and writer. Pass nil for r/w to use os.Stdin/os.Stdout.

func Run

func Run() error

Run is the main application entry point. It loads config, authenticates, starts services, and runs the TUI. Returns an error on startup or runtime failure.

func SetupLog

func SetupLog() func()

SetupLog configures the global logger to write to debug.log in the config directory. Returns a cleanup function that closes the log file.

Types

type AuthSession

type AuthSession struct {
	Client *spotify.Client
}

AuthSession holds the result of auth bootstrap.

func Bootstrap

func Bootstrap(rc RuntimeConfig) (*AuthSession, error)

Bootstrap authenticates with Spotify and returns a ready-to-use session. If no saved token exists, it runs the interactive login flow.

type LibrespotServices

type LibrespotServices struct {
	Options []ui.ModelOption
	Cleanup func()
}

LibrespotServices holds the result of librespot/audio startup.

func StartLibrespot

func StartLibrespot(rc RuntimeConfig, client *spotify.Client) *LibrespotServices

StartLibrespot starts the librespot process and audio pipe reader if enabled by the config. Returns UI model options and a cleanup function. If librespot is not enabled, returns nil.

type RuntimeConfig

type RuntimeConfig struct {
	*config.Config
	ResolvedRedirectURL string
	ResolvedDeviceName  string
}

RuntimeConfig holds the resolved configuration with defaults applied. ResolvedRedirectURL and ResolvedDeviceName are the final values after applying defaults — use these instead of the raw Config fields.

func ResolveRuntime

func ResolveRuntime(cfg *config.Config) RuntimeConfig

ResolveRuntime applies defaults to the raw config and returns a RuntimeConfig ready for use by the rest of the application.

Jump to

Keyboard shortcuts

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