Skip to content

Commit

Permalink
Updated p to better reflect play
Browse files Browse the repository at this point in the history
  • Loading branch information
Threpio committed Jul 26, 2021
1 parent 407d949 commit bdabdb5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions internal/p/p.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ func NewCommand() *cobra.Command {

cmd.Flags().String("device-id", "", "device ID from 'spotify device list'")
cmd.Flags().String("playlist", "", "playlist name from 'spotify playlist list'")
cmd.Flags().String("album", "", "album name that you wish to play'")
cmd.Flags().String("album", "", "album name that you wish to play")

return cmd
}

func p(api internal.APIInterface, query, contextQuery, queryType, deviceID string) (string, error) {
if len(query) > 0 {
return play.Play(api, query, "", "track", deviceID)
return play.Play(api, query, contextQuery, queryType, deviceID)
}

playback, err := api.GetPlayback()
Expand Down
6 changes: 2 additions & 4 deletions internal/play/play.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func NewCommand() *cobra.Command {

cmd.Flags().String("device-id", "", "device ID from 'spotify device list'")
cmd.Flags().String("playlist", "", "playlist name from 'spotify playlist list'")
cmd.Flags().String("album", "", "album name that you wish to play'")
cmd.Flags().String("album", "", "album name that you wish to play")

return cmd
}
Expand Down Expand Up @@ -83,9 +83,7 @@ func Play(api internal.APIInterface, query, contextQuery, queryType, deviceID st
}

albums := paging.Albums.Items
if len(albums) > 0 {
return "", errors.New(internal.ErrNoAlbums)
}
//TODO: Implement Checking of no returns of albums

if err := api.Play(deviceID, albums[0].URI); err != nil {
return "", err
Expand Down

0 comments on commit bdabdb5

Please sign in to comment.