volume and position tui dont get rate limited

This commit is contained in:
jjohnstondev 2023-01-14 20:59:52 -08:00
parent fe278a3270
commit d66fac3088
2 changed files with 30 additions and 0 deletions

View File

@ -31,6 +31,24 @@ func HandleAlbumRadio(ctx *gctx.Context, client *spotify.Client, id spotify.ID)
}
}
func HandleSeek(ctx *gctx.Context, client *spotify.Client, fwd bool) {
err := commands.Seek(ctx, client, fwd)
if err != nil {
return
}
}
func HandleVolume(ctx *gctx.Context, client *spotify.Client, up bool) {
vol := 10
if !up {
vol = -10
}
err := commands.ChangeVolume(ctx, client, vol)
if err != nil {
return
}
}
func HandleArtistRadio(ctx *gctx.Context, client *spotify.Client, id spotify.ID) {
err := commands.RadioGivenArtist(ctx, client, id)
if err != nil {

View File

@ -457,6 +457,18 @@ func (m mainModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
if msg.String() == "ctrl+c" {
return m, tea.Quit
}
if msg.String() == ">" {
go HandleSeek(m.ctx, m.client, true)
}
if msg.String() == "<" {
go HandleSeek(m.ctx, m.client, false)
}
if msg.String() == "+" {
go HandleVolume(m.ctx, m.client, true)
}
if msg.String() == "-" {
go HandleVolume(m.ctx, m.client, false)
}
// search input
if m.input.Focused() {
search, cmd := m.Typing(msg)