2024-02-18 15:04:34 -08:00
|
|
|
package commands
|
|
|
|
|
|
|
|
import "github.com/zmb3/spotify/v2"
|
|
|
|
|
|
|
|
func (c *Commander) Playlists(page int) (*spotify.SimplePlaylistPage, error) {
|
2024-02-18 23:33:32 -08:00
|
|
|
return c.Client().CurrentUsersPlaylists(c.Context, spotify.Limit(50), spotify.Offset((page-1)*50))
|
2024-02-18 15:04:34 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (c *Commander) PlaylistTracks(playlist spotify.ID, page int) (*spotify.PlaylistItemPage, error) {
|
2024-02-18 23:33:32 -08:00
|
|
|
return c.Client().GetPlaylistItems(c.Context, playlist, spotify.Limit(50), spotify.Offset((page-1)*50))
|
2024-02-18 15:04:34 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (c *Commander) DeleteTracksFromPlaylist(tracks []spotify.ID, playlist spotify.ID) error {
|
2024-02-18 23:33:32 -08:00
|
|
|
_, err := c.Client().RemoveTracksFromPlaylist(c.Context, playlist, tracks...)
|
2024-02-18 15:04:34 -08:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *Commander) TrackList(page int) (*spotify.SavedTrackPage, error) {
|
2024-02-18 23:33:32 -08:00
|
|
|
return c.Client().CurrentUsersTracks(c.Context, spotify.Limit(50), spotify.Offset((page-1)*50))
|
2024-02-18 15:04:34 -08:00
|
|
|
}
|