mirror of
https://github.com/aditya-K2/gspt.git
synced 2026-01-09 13:58:05 -05:00
"add" wrappers for spotify
This commit is contained in:
16
gspotify/add.go
Normal file
16
gspotify/add.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package gspotify
|
||||
|
||||
import "github.com/zmb3/spotify/v2"
|
||||
|
||||
func AddAlbumToPlaylist(albumId, playlistId spotify.ID) error {
|
||||
a, err := GetAlbum(albumId)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
t := []spotify.ID{}
|
||||
for _, v := range (*a).Tracks {
|
||||
t = append(t, v.ID)
|
||||
}
|
||||
_, err = Client.AddTracksToPlaylist(ctx(), playlistId, t...)
|
||||
return err
|
||||
}
|
||||
Reference in New Issue
Block a user