From 78dc143e4585a3ab5a4d173f50571b4842a4e347 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Mon, 31 Jul 2023 10:23:22 +0200 Subject: implement initial loading of spotify playlists Playlist can now be added to the initial play queue with the -playlists command line flag or the playlists yaml key in the config file. To load a spotify playlist the link obtained when sharing the playlist from spotify is used. --- player.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'player.go') diff --git a/player.go b/player.go index 795978b..b8db8fa 100644 --- a/player.go +++ b/player.go @@ -20,6 +20,7 @@ type Player interface { Pause() Continue() Stop() + LoadPlaylist(playlist string) []*Song } // command struct used to serialize player commands @@ -253,3 +254,11 @@ func (player *MpvPlayer) Search(pattern map[string]string) chan []*Song { return ch } + +func (player *MpvPlayer) LoadPlaylist(playlist string) (songs []*Song) { + if strings.Contains(playlist, "spotify.com") { + songs = player.Backends["spotify"].(*SpotifyBackend).loadPlaylist(playlist) + } + + return +} -- cgit v1.2.3