add case for playlist itme
This commit is contained in:
parent
b569bd5bd6
commit
84b3bd2f90
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user