From 3b4c1876465e0385f46020d3cd0aedd2c16b15fe Mon Sep 17 00:00:00 2001 From: Ralph Torres Date: Sat, 11 Apr 2026 10:41:35 +0000 Subject: [PATCH 1/2] add lyrics not found placeholder display a custom message (and block ui nav) when no lyrics are available closes #55 --- lyrics/lyrics.go | 2 ++ ui/ui.go | 12 +++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lyrics/lyrics.go b/lyrics/lyrics.go index dba7cae..443adfa 100644 --- a/lyrics/lyrics.go +++ b/lyrics/lyrics.go @@ -5,6 +5,8 @@ import ( "strings" ) +const NoLyricsPlaceholder = "Hmm. We don't know the lyrics for this one." + type Provider interface { Lyrics(artist, track string) ([]Line, error) } diff --git a/ui/ui.go b/ui/ui.go index a94ba07..41ac04d 100644 --- a/ui/ui.go +++ b/ui/ui.go @@ -79,7 +79,7 @@ func (m *Model) Update(message tea.Msg) (tea.Model, tea.Cmd) { } case "up": - if m.state.Playing && lyrics.Timesynced(m.state.Lines) { + if len(m.state.Lines) == 0 || (m.state.Playing && lyrics.Timesynced(m.state.Lines)) { break } m.state.Index -= 1 @@ -87,7 +87,7 @@ func (m *Model) Update(message tea.Msg) (tea.Model, tea.Cmd) { m.state.Index = 0 } case "down": - if m.state.Playing && lyrics.Timesynced(m.state.Lines) { + if len(m.state.Lines) == 0 || (m.state.Playing && lyrics.Timesynced(m.state.Lines)) { break } m.state.Index += 1 @@ -113,7 +113,13 @@ func (m *Model) View() string { ) } if len(m.state.Lines) == 0 { - return "" + return gloss.PlaceVertical( + m.h, gloss.Center, + m.styleCurrent. + Align(gloss.Center). + Width(m.w). + Render(lyrics.NoLyricsPlaceholder), + ) } curLine := m.styleCurrent. From f331e771e91ae2f2552e1fc47c57bbcbee0717eb Mon Sep 17 00:00:00 2001 From: Ralph Torres Date: Sat, 11 Apr 2026 11:09:41 +0000 Subject: [PATCH 2/2] add showLyricsNotFound config option defaults to true --- config/config.go | 9 +++++---- ui/ui.go | 17 ++++++++++------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/config/config.go b/config/config.go index b7ef697..fe62509 100644 --- a/config/config.go +++ b/config/config.go @@ -34,10 +34,11 @@ func init() { } type Config struct { - Player string `default:"spotify" yaml:"player"` - IgnoreErrors bool `default:"true" yaml:"ignoreErrors"` - TimerInterval int `default:"200" yaml:"timerInterval"` - UpdateInterval int `default:"2000" yaml:"updateInterval"` + Player string `default:"spotify" yaml:"player"` + IgnoreErrors bool `default:"true" yaml:"ignoreErrors"` + ShowLyricsNotFound bool `default:"true" yaml:"showLyricsNotFound"` + TimerInterval int `default:"200" yaml:"timerInterval"` + UpdateInterval int `default:"2000" yaml:"updateInterval"` Style struct { HAlignment string `default:"center" yaml:"hAlignment"` diff --git a/ui/ui.go b/ui/ui.go index 41ac04d..96a1751 100644 --- a/ui/ui.go +++ b/ui/ui.go @@ -113,13 +113,16 @@ func (m *Model) View() string { ) } if len(m.state.Lines) == 0 { - return gloss.PlaceVertical( - m.h, gloss.Center, - m.styleCurrent. - Align(gloss.Center). - Width(m.w). - Render(lyrics.NoLyricsPlaceholder), - ) + if m.Config.ShowLyricsNotFound { + return gloss.PlaceVertical( + m.h, gloss.Center, + m.styleCurrent. + Align(gloss.Center). + Width(m.w). + Render(lyrics.NoLyricsPlaceholder), + ) + } + return "" } curLine := m.styleCurrent.