Documentation
¶
Overview ¶
Package ui is the Bubble Tea TUI for OpenDeezer: a menu/list browser with an always-visible now-playing footer. Network calls run as tea.Cmds.
Index ¶
- Variables
- func LoadARL() string
- func LoadAudioDevice() string
- func LoadCrossfadeMS() int
- func LoadDiscordAppID() string
- func LoadGapless() bool
- func LoadLastPeer() string
- func LoadQuality() int
- func LoadReplayGain() bool
- func LoadTheme() string
- func SaveARL(arl string) error
- func SaveAudioDevice(id string) error
- func SaveCrossfadeMS(ms int) error
- func SaveGapless(v bool) error
- func SaveLastPeer(addr string) error
- func SaveQuality(level int) error
- func SaveReplayGain(v bool) error
- func SaveResume(t deezer.Track, positionMS int64) error
- func SaveTheme(name string) error
- type ControlConfig
- type Model
- type ResumeState
Constants ¶
This section is empty.
Variables ¶
var Version = version.Number
Version is the app version, set from main at startup (defaults to the release number so library users get the right value without main).
Functions ¶
func LoadARL ¶
func LoadARL() string
LoadARL resolves the Deezer ARL from, in order: $DEEZER_ARL, then ~/.config/opendeezer/arl.txt. Returns "" if neither is set.
func LoadAudioDevice ¶ added in v0.4.0
func LoadAudioDevice() string
LoadAudioDevice / SaveAudioDevice persist the selected output device id.
func LoadCrossfadeMS ¶ added in v0.4.0
func LoadCrossfadeMS() int
LoadCrossfadeMS / SaveCrossfadeMS persist the crossfade duration in ms.
func LoadDiscordAppID ¶ added in v1.0.0
func LoadDiscordAppID() string
LoadDiscordAppID returns the Discord application id for Rich Presence, from $OPENDEEZER_DISCORD_APP_ID or ~/.config/opendeezer/discord-app-id.txt. Empty disables the feature.
func LoadGapless ¶ added in v0.4.0
func LoadGapless() bool
LoadGapless / SaveGapless persist the gapless toggle (default: on).
func LoadLastPeer ¶ added in v1.0.0
func LoadLastPeer() string
LoadLastPeer / SaveLastPeer remember the last remote-control peer address so the connect screen can prefill it.
func LoadQuality ¶
func LoadQuality() int
LoadQuality reads the persisted quality level: 0=Normal, 1=High, 2=HiFi.
func LoadReplayGain ¶ added in v0.3.0
func LoadReplayGain() bool
LoadReplayGain / SaveReplayGain persist the loudness-normalization toggle.
func LoadTheme ¶ added in v0.3.0
func LoadTheme() string
LoadTheme returns the saved theme name ("" if none).
func SaveAudioDevice ¶ added in v0.4.0
func SaveCrossfadeMS ¶ added in v0.4.0
func SaveGapless ¶ added in v0.4.0
func SaveLastPeer ¶ added in v1.0.0
func SaveReplayGain ¶ added in v0.3.0
func SaveResume ¶ added in v0.3.0
SaveResume writes the current track + position to resume.json. Positions in the first few seconds are treated as "start over" and clear the state.
Types ¶
type ControlConfig ¶ added in v1.0.0
type ControlConfig struct {
Enabled bool
Addr string // host:port; "" -> 127.0.0.1:7654
Token string // bearer token ("" = no auth, localhost only)
SameAccount bool // require a matching Deezer account when no token (LAN)
}
ControlConfig holds the control-API settings (remote control + MCP).
func LoadControl ¶ added in v1.0.0
func LoadControl() ControlConfig
LoadControl reads the control-API config: $OPENDEEZER_CONTROL ("1"/addr) + $OPENDEEZER_CONTROL_TOKEN, else ~/.config/opendeezer/{control.txt,control-token.txt}.
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the root Bubble Tea model.
func (*Model) Init ¶
Init kicks off login + the UI tick. The update check runs alongside them in the background (see updatecheck.go) and never delays startup.
func (*Model) StartControl ¶ added in v1.0.0
StartControl starts the control API (remote control + MCP) if enabled in the config. Commands arrive as controlCmdMsg via send so they run on the update loop; status is served from an atomic snapshot refreshed by publishControl. Returns nil (no error) when the API is disabled. Call after tea.NewProgram.
func (*Model) StartMedia ¶
StartMedia wires OS media controls (MPRIS) to the running program. Commands from the desktop are delivered as mediaCmdMsg via the program's Send so they run on the Bubble Tea update loop. Call after tea.NewProgram, before Run.
type ResumeState ¶ added in v0.3.0
type ResumeState struct {
ID string `json:"id"`
Name string `json:"name"`
ArtistLine string `json:"artistLine"`
AlbumName string `json:"albumName"`
ArtworkURL string `json:"artworkUrl"`
DurationMS int64 `json:"durationMs"`
PositionMS int64 `json:"positionMs"`
}
ResumeState is the last-played track plus the position to resume from.
func LoadResume ¶ added in v0.3.0
func LoadResume() *ResumeState
LoadResume reads the saved resume state, or nil if none/invalid.
func (ResumeState) Track ¶ added in v0.3.0
func (r ResumeState) Track() deezer.Track
Track reconstructs a deezer.Track from the saved state.