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 LoadQuality() int
- func LoadReplayGain() bool
- func LoadTheme() string
- func SaveARL(arl 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 Model
- type ResumeState
Constants ¶
This section is empty.
Variables ¶
var Version = "0.3.0"
Version is the app version, set from main at startup.
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 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 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 Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the root Bubble Tea model.
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.