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