Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
2 changes: 2 additions & 0 deletions lyrics/lyrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
13 changes: 11 additions & 2 deletions ui/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@ 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
if m.state.Index < 0 {
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
Expand All @@ -113,6 +113,15 @@ func (m *Model) View() string {
)
}
if len(m.state.Lines) == 0 {
if m.Config.ShowLyricsNotFound {
return gloss.PlaceVertical(
m.h, gloss.Center,
m.styleCurrent.
Align(gloss.Center).
Width(m.w).
Render(lyrics.NoLyricsPlaceholder),
)
}
return ""
}

Expand Down