Documentation
¶
Overview ¶
Package ui implements the Bubbletea TUI for the CLIAMP terminal music player.
Index ¶
- func AttachNotifier(notifier playback.Notifier) tea.Msg
- func ReservedKeys() map[string]bool
- type ConfigSaver
- type EQPreset
- type Model
- func (m Model) EQPresetName() string
- func (m Model) Init() tea.Cmd
- func (m *Model) RegisterLuaVisualizers(names []string, renderer ui.LuaVisRenderer)
- func (m *Model) ResumePlaylist(name string, tracks []playlist.Track)
- func (m Model) ResumeState() (path string, secs int, playlist string)
- func (m *Model) SetAutoPlay(v bool)
- func (m *Model) SetCompact(v bool)
- func (m *Model) SetEQPreset(name string, bands *[10]float64)
- func (m *Model) SetInitialDirectory(dir string)
- func (m *Model) SetLoadedPlaylist(name string)
- func (m *Model) SetLowPower(v bool)
- func (m *Model) SetPendingURLs(urls []string)
- func (m *Model) SetResume(path string, secs int)
- func (m *Model) SetSeekStepLarge(d time.Duration)
- func (m *Model) SetTheme(name string) bool
- func (m *Model) SetVisVolumeLinked(linked bool)
- func (m *Model) SetVisualizer(name string) bool
- func (m *Model) StartInProvider()
- func (m Model) ThemeName() string
- func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m Model) View() tea.View
- func (m *Model) VisualizerName() string
- type PluginQueueMsg
- type ProvAuthURLMsg
- type ProviderEntry
- type SetEQPresetMsg
- type ShowStatusMsg
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReservedKeys ¶
ReservedKeys returns a fresh copy of the core-reserved key set. Handed to the Lua plugin manager at startup so it can reject conflicting plugin binds.
Types ¶
type ConfigSaver ¶
ConfigSaver persists individual config key-value pairs. Satisfied by config.SaveFunc (the default) or a test stub.
type EQPreset ¶
EQPreset is a named 10-band EQ curve.
func EQPresetByName ¶
EQPresetByName looks up a built-in preset by case-insensitive name.
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the Bubbletea model for the CLIAMP TUI.
func New ¶
func New(p player.Engine, pl *playlist.Playlist, providers []ProviderEntry, defaultProvider string, localProv playlist.Provider, themes []theme.Theme, luaMgr *luaplugin.Manager, cs ConfigSaver) Model
New creates a Model wired to the given player and playlist. providers is the ordered list of available providers (Radio, Navidrome, Spotify, Jellyfin, etc.). defaultProvider is the config key of the provider to select initially. localProv is an optional direct reference to the local provider for write ops.
func (Model) EQPresetName ¶
EQPresetName returns the current preset name, or "Custom".
func (*Model) RegisterLuaVisualizers ¶
func (m *Model) RegisterLuaVisualizers(names []string, renderer ui.LuaVisRenderer)
RegisterLuaVisualizers adds Lua visualizer plugins to the visualizer cycle.
func (*Model) ResumePlaylist ¶
ResumePlaylist loads a playlist into the model for session resume.
func (Model) ResumeState ¶
ResumeState returns the track path, playback position, and playlist name captured at exit. Called after prog.Run() returns (player already closed).
func (*Model) SetAutoPlay ¶
SetAutoPlay makes the player start playback immediately on Init.
func (*Model) SetCompact ¶
SetCompact enables compact mode which caps the frame width at 80 columns.
func (*Model) SetEQPreset ¶
SetEQPreset sets the preset by name. If it matches a built-in preset, those bands are applied. Otherwise the name is used as a custom label. If bands is non-nil, they are applied regardless of whether the name matches.
func (*Model) SetInitialDirectory ¶
SetInitialDirectory sets the initial directory for the file browser.
func (*Model) SetLoadedPlaylist ¶
SetLoadedPlaylist records that the live queue exactly mirrors a local saved playlist, allowing path-based write-backs such as bookmarks and removals.
func (*Model) SetLowPower ¶
SetLowPower lowers UI cadences without affecting normal mode.
func (*Model) SetPendingURLs ¶
SetPendingURLs stores remote URLs (feeds, M3U) for async resolution after Init.
func (*Model) SetResume ¶
SetResume registers a path+position to seek to when that track first plays.
func (*Model) SetSeekStepLarge ¶
SetSeekStepLarge configures the Shift+Left/Right seek jump amount.
func (*Model) SetVisVolumeLinked ¶
SetVisVolumeLinked controls whether the visualizer scales samples by the current volume before FFT analysis, making bar height follow volume.
func (*Model) SetVisualizer ¶
SetVisualizer sets the visualizer mode by name (case-insensitive). Returns true if a valid mode name was recognized. Does not modify state if the name is not found, matching the SetTheme guard pattern.
func (*Model) StartInProvider ¶
func (m *Model) StartInProvider()
StartInProvider configures the model to begin in the provider browse view. Call this from main when no CLI tracks or pending URLs were given.
func (*Model) VisualizerName ¶
VisualizerName returns the current visualizer mode's display name.
type PluginQueueMsg ¶
type PluginQueueMsg struct {
Op string // "add" | "jump" | "remove" | "move"
Path string // add
Index int // jump, remove, move (from)
To int // move (to)
}
PluginQueueMsg is sent by Lua plugins (cliamp.queue.*) to mutate the queue. Mutations are routed through the Update loop rather than applied directly from the plugin goroutine so the model's derived state (cursor, current index, playback) stays consistent. Indices are 0-based.
type ProvAuthURLMsg ¶
type ProvAuthURLMsg struct{ URL string }
ProvAuthURLMsg carries the OAuth URL produced by a provider's interactive auth flow so the TUI can display it. Used as a fallback when the launched browser doesn't reach the user (e.g. inside containers or headless envs).
type ProviderEntry ¶
type ProviderEntry struct {
Key string // config key: "radio", "navidrome", "spotify"
Name string // display name: "Radio", "Navidrome", "Spotify"
Provider playlist.Provider // nil if not configured
}
ProviderEntry pairs a display name with a key and provider implementation.
type SetEQPresetMsg ¶
type SetEQPresetMsg struct {
Name string
Bands *[10]float64 // nil = use built-in preset bands or keep current
}
SetEQPresetMsg is sent by Lua plugins to change the EQ preset by name. If Bands is non-nil, the bands are applied and the name becomes a custom label.
type ShowStatusMsg ¶
ShowStatusMsg is sent by Lua plugins to display a message in the status bar. Duration <= 0 falls back to the default status TTL.
Source Files
¶
- audio.go
- commands.go
- eq_presets.go
- filebrowser.go
- init.go
- inline_overlays.go
- inline_overlays_nav.go
- jump.go
- keymap.go
- keys.go
- keys_nav.go
- keys_radio.go
- keys_spotify_search.go
- lyrics.go
- model.go
- notifications.go
- overlays.go
- pl_picker.go
- playback.go
- playback_state.go
- plugin_events.go
- plugin_queue.go
- preload.go
- providers.go
- scroll.go
- search.go
- seek.go
- state.go
- styles.go
- textinput.go
- tick.go
- title.go
- update.go
- view.go
- view_helpers.go
- view_nav.go
- view_overlays.go
- ytdl_batch.go