add case for playlist itme
Some checks failed
ci/woodpecker/manual/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline failed

This commit is contained in:
abs3nt 2023-09-26 15:33:11 -07:00
parent b569bd5bd6
commit 84b3bd2f90
Signed by: abs3nt
GPG Key ID: FDC6662313FA9386

View File

@ -2,11 +2,13 @@ package tui
import ( import (
"fmt" "fmt"
"reflect"
"strings" "strings"
"time" "time"
"git.asdf.cafe/abs3nt/gospt/src/commands" "git.asdf.cafe/abs3nt/gospt/src/commands"
"git.asdf.cafe/abs3nt/gospt/src/gctx" "git.asdf.cafe/abs3nt/gospt/src/gctx"
"tuxpa.in/a/zlog/log"
"github.com/atotto/clipboard" "github.com/atotto/clipboard"
"github.com/charmbracelet/bubbles/key" "github.com/charmbracelet/bubbles/key"
@ -93,6 +95,7 @@ type mainModel struct {
func (m *mainModel) PlayRadio() { func (m *mainModel) PlayRadio() {
go m.SendMessage("Starting radio for "+m.list.SelectedItem().(mainItem).Title(), 2*time.Second) go m.SendMessage("Starting radio for "+m.list.SelectedItem().(mainItem).Title(), 2*time.Second)
selectedItem := m.list.SelectedItem().(mainItem).SpotifyItem selectedItem := m.list.SelectedItem().(mainItem).SpotifyItem
log.Info().Msgf("%s", reflect.TypeOf(selectedItem))
switch item := selectedItem.(type) { switch item := selectedItem.(type) {
case spotify.SimplePlaylist: case spotify.SimplePlaylist:
go HandlePlaylistRadio(m.ctx, m.commands, item) go HandlePlaylistRadio(m.ctx, m.commands, item)
@ -121,6 +124,9 @@ func (m *mainModel) PlayRadio() {
case spotify.PlaylistTrack: case spotify.PlaylistTrack:
go HandleRadio(m.ctx, m.commands, item.Track.SimpleTrack) go HandleRadio(m.ctx, m.commands, item.Track.SimpleTrack)
return return
case spotify.PlaylistItem:
go HandleRadio(m.ctx, m.commands, item.Track.Track.SimpleTrack)
return
case spotify.SavedTrack: case spotify.SavedTrack:
go HandleRadio(m.ctx, m.commands, item.SimpleTrack) go HandleRadio(m.ctx, m.commands, item.SimpleTrack)
return return