mirror of
https://github.com/aditya-K2/gspt.git
synced 2026-01-09 13:58:05 -05:00
Refactoring
This commit is contained in:
@@ -12,7 +12,7 @@ func AddTracksToPlaylist(playlistId spotify.ID, t ...spotify.ID) error {
|
||||
return err
|
||||
}
|
||||
|
||||
func addToQueue(ids ...spotify.SimpleTrack) error {
|
||||
func QueueTracks(ids ...spotify.SimpleTrack) error {
|
||||
count := 0
|
||||
_ctx := ctx()
|
||||
for _, v := range ids {
|
||||
@@ -32,7 +32,7 @@ func QueueAlbum(id spotify.ID) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := addToQueue(*album.Tracks...); err != nil {
|
||||
if err := QueueTracks(*album.Tracks...); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
|
||||
@@ -305,6 +305,6 @@ func TransferPlayback(deviceId spotify.ID) error {
|
||||
return Client.TransferPlayback(ctx(), deviceId, true)
|
||||
}
|
||||
|
||||
func GetFullPlaylist(id *spotify.ID) (*spotify.FullPlaylist, error) {
|
||||
return Client.GetPlaylist(ctx(), *id)
|
||||
func GetFullPlaylist(id spotify.ID) (*spotify.FullPlaylist, error) {
|
||||
return Client.GetPlaylist(ctx(), id)
|
||||
}
|
||||
|
||||
14
spt/play.go
14
spt/play.go
@@ -17,23 +17,23 @@ func PlaySong(uri spotify.URI) error {
|
||||
})
|
||||
}
|
||||
|
||||
func PlaySongWithContext(context *spotify.URI, position int) error {
|
||||
func PlaySongWithContext(context spotify.URI, position int) error {
|
||||
return play(&spotify.PlayOptions{
|
||||
PlaybackContext: context,
|
||||
PlaybackContext: &context,
|
||||
PlaybackOffset: &spotify.PlaybackOffset{Position: &position},
|
||||
})
|
||||
}
|
||||
|
||||
func PlaySongWithContextURI(context, uri *spotify.URI) error {
|
||||
func PlaySongWithContextURI(context, uri spotify.URI) error {
|
||||
return play(&spotify.PlayOptions{
|
||||
PlaybackContext: context,
|
||||
PlaybackOffset: &spotify.PlaybackOffset{URI: *uri},
|
||||
PlaybackContext: &context,
|
||||
PlaybackOffset: &spotify.PlaybackOffset{URI: uri},
|
||||
})
|
||||
}
|
||||
|
||||
func PlayContext(context *spotify.URI) error {
|
||||
func PlayContext(context spotify.URI) error {
|
||||
return play(&spotify.PlayOptions{
|
||||
PlaybackContext: context,
|
||||
PlaybackContext: &context,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user