New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Control queue and playback #15

Closed
CoDEmanX opened this Issue Mar 26, 2015 · 86 comments

Comments

Projects
None yet
@CoDEmanX

CoDEmanX commented Mar 26, 2015

There's nothing in the Web API to control a user's current queue and playback (including seek time), but Apps have been deprecated on the other hand and Spotify Connect is proprietary. That leaves no option to implement a new PartiQ* - that's a shame.

Can we expect an open Spotify Connect or new Endpoints in the Web API to remote-control Spotify within like a year or should we forget that there was something as nice as PartiQ once?

I'd prefer additional API features over a built-in solution, because community might want to do queuing differently (e.g. let people vote on suggested tracks and play what receives the most votes instead of first-in/first-out, or group suggested tracks by genre and tempo to avoid too hard switches).

But it doesn't end there: one could create a web app that plays what a certain user plays (like a request show in the radio, but without the need to capture audio of the DJ and send it to all listeners). Maybe even play music on multiple wifi speakers in sync? Or a custom last.fm scrobbler...

  • = Former Spotify app that let your party guests decide what music to play in a quite democratic fashion

Edit: Added "including seek time". -@thelinmichael

@thelinmichael

This comment has been minimized.

Show comment
Hide comment
@thelinmichael

thelinmichael Mar 31, 2015

Contributor

Thanks for your feedback @CoDEmanX. I'm going to add the enhancement label to this issue since it's a very valid feature request, but I can not make any promises that this feature will be available regardless of timespan and scope.

Contributor

thelinmichael commented Mar 31, 2015

Thanks for your feedback @CoDEmanX. I'm going to add the enhancement label to this issue since it's a very valid feature request, but I can not make any promises that this feature will be available regardless of timespan and scope.

@markbrouch

This comment has been minimized.

Show comment
Hide comment
@markbrouch

markbrouch May 19, 2015

+1 I would love to see this implemented.

+1 I would love to see this implemented.

@Eastborn

This comment has been minimized.

Show comment
Hide comment
@Eastborn

Eastborn Jun 5, 2015

+1 this would be great

Eastborn commented Jun 5, 2015

+1 this would be great

@xeno

This comment has been minimized.

Show comment
Hide comment
@xeno

xeno Jun 30, 2015

+1 I neeeed this please. :)

xeno commented Jun 30, 2015

+1 I neeeed this please. :)

@sashaperigo

This comment has been minimized.

Show comment
Hide comment
@sashaperigo

sashaperigo Jul 22, 2015

+1 I would love access to a user's queue!

+1 I would love access to a user's queue!

@Hagfjall

This comment has been minimized.

Show comment
Hide comment
@Hagfjall

Hagfjall Jul 24, 2015

+1 I would love this, to be able to control the playback for a user.

+1 I would love this, to be able to control the playback for a user.

@auhsor

This comment has been minimized.

Show comment
Hide comment
@auhsor

auhsor Aug 19, 2015

Please add this support!

auhsor commented Aug 19, 2015

Please add this support!

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Aug 31, 2015

+1 And be quick about it.

ghost commented Aug 31, 2015

+1 And be quick about it.

@nicohvi

This comment has been minimized.

Show comment
Hide comment

nicohvi commented Sep 5, 2015

+1

@hunterbridges

This comment has been minimized.

Show comment
Hide comment

+1

@petermakowski

This comment has been minimized.

Show comment
Hide comment

+1

@command3r

This comment has been minimized.

Show comment
Hide comment
@command3r

command3r Sep 13, 2015

I am working on party playlists for my wedding, and as a developer I would love to use my premium account on spotify just for streaming while I can have custom interfaces and options, like manually defined crossfade for different songs and more, all of which I can work on my own. So, +1

I am working on party playlists for my wedding, and as a developer I would love to use my premium account on spotify just for streaming while I can have custom interfaces and options, like manually defined crossfade for different songs and more, all of which I can work on my own. So, +1

@alairock

This comment has been minimized.

Show comment
Hide comment

alairock commented Oct 9, 2015

+1

@NinnOgTonic

This comment has been minimized.

Show comment
Hide comment

+1

@kevinweber

This comment has been minimized.

Show comment
Hide comment

+1

@Clarkinator

This comment has been minimized.

Show comment
Hide comment
@Clarkinator

Clarkinator Nov 16, 2015

+1 I'd love to be able to queue tracks in the API, that would save me a hell of a lot of hassle with what I'm currently working on.

+1 I'd love to be able to queue tracks in the API, that would save me a hell of a lot of hassle with what I'm currently working on.

@calvin-evans

This comment has been minimized.

Show comment
Hide comment
@calvin-evans

calvin-evans Nov 17, 2015

+1 for queueing tracks via the API

+1 for queueing tracks via the API

@mexitalian

This comment has been minimized.

Show comment
Hide comment

+1

@forstermatth

This comment has been minimized.

Show comment
Hide comment
@forstermatth

forstermatth Jan 20, 2016

+1 I'd love to use a feature like this to create a slack chat script to control music in the office

+1 I'd love to use a feature like this to create a slack chat script to control music in the office

@Gavinator98

This comment has been minimized.

Show comment
Hide comment

+1

@gartnera

This comment has been minimized.

Show comment
Hide comment

+1

@m4w

This comment has been minimized.

Show comment
Hide comment

m4w commented Feb 28, 2016

+1

@bash

This comment has been minimized.

Show comment
Hide comment

bash commented Feb 29, 2016

+1

@ericwebster

This comment has been minimized.

Show comment
Hide comment

+1

@JoshCheek

This comment has been minimized.

Show comment
Hide comment
@JoshCheek

JoshCheek Apr 4, 2016

Looks like you can get some reasonable functionality with applescript

I played around and figured out how to do some of the things. Note that I do not know AppleScript, I just looked at the examples and the docs.

Choosing content

# A track
$ osascript -e 'tell app "Spotify" to play track "spotify:track:4KWntZBFeQOdoYNgPwcEGe"'

# A playlist
$ osascript -e 'tell app "Spotify" to play track "spotify:user:josh_cheek:playlist:3WfJpjKmq84WjORNHHsZMk"'

Playing / pausing

# Resume playback
$ osascript -e 'tell app "Spotify" to pause'

# Pause playback
$ osascript -e 'tell app "Spotify" to play'

# Toggle play/pause
$ osascript -e 'tell app "Spotify" to playpause'

Current Track

You can get some info about the current track like this (there's more info you can get, open the AppleScript Editor and go to File -> Open Dictionary -> Spotify -> Track)

$ osascript -e 'tell application "Spotify"
       (artist of current track as string) & "\n" & (album of current track as string) & "\n" & (name of current track) & "\n" & (spotify url of current track as string)
   end tell'

Next and Prev track

$ osascript -e 'tell application "Spotify" to next track'
$ osascript -e 'tell application "Spotify" to previous track'

Volume

$ osascript -e 'tell application "Spotify"
     get sound volume
   end tell'

$ osascript -e 'tell application "Spotify"
     set sound volume to 50
   end tell'

Find out if its playing/paused/stopped

$ osascript -e 'tell application "Spotify"
     get player state
   end tell'

Position within the track

$ osascript -e 'tell application "Spotify"
     get player position
   end tell'

$ osascript -e 'tell application "Spotify"
     set player position to 30
   end tell'

Shuffling

Is it on / turn it on

$  osascript -e 'tell application "Spotify"
     get shuffling
   end tell'

$  osascript -e 'tell application "Spotify"
     set shuffling to true
   end tell'

Example

Here's a remote control script I wrote in Ruby, using most/all of these things. You run it and press p, q, h, H, j, k, l, L, -, + to command the player (map is at the bottom of the file)

Looks like you can get some reasonable functionality with applescript

I played around and figured out how to do some of the things. Note that I do not know AppleScript, I just looked at the examples and the docs.

Choosing content

# A track
$ osascript -e 'tell app "Spotify" to play track "spotify:track:4KWntZBFeQOdoYNgPwcEGe"'

# A playlist
$ osascript -e 'tell app "Spotify" to play track "spotify:user:josh_cheek:playlist:3WfJpjKmq84WjORNHHsZMk"'

Playing / pausing

# Resume playback
$ osascript -e 'tell app "Spotify" to pause'

# Pause playback
$ osascript -e 'tell app "Spotify" to play'

# Toggle play/pause
$ osascript -e 'tell app "Spotify" to playpause'

Current Track

You can get some info about the current track like this (there's more info you can get, open the AppleScript Editor and go to File -> Open Dictionary -> Spotify -> Track)

$ osascript -e 'tell application "Spotify"
       (artist of current track as string) & "\n" & (album of current track as string) & "\n" & (name of current track) & "\n" & (spotify url of current track as string)
   end tell'

Next and Prev track

$ osascript -e 'tell application "Spotify" to next track'
$ osascript -e 'tell application "Spotify" to previous track'

Volume

$ osascript -e 'tell application "Spotify"
     get sound volume
   end tell'

$ osascript -e 'tell application "Spotify"
     set sound volume to 50
   end tell'

Find out if its playing/paused/stopped

$ osascript -e 'tell application "Spotify"
     get player state
   end tell'

Position within the track

$ osascript -e 'tell application "Spotify"
     get player position
   end tell'

$ osascript -e 'tell application "Spotify"
     set player position to 30
   end tell'

Shuffling

Is it on / turn it on

$  osascript -e 'tell application "Spotify"
     get shuffling
   end tell'

$  osascript -e 'tell application "Spotify"
     set shuffling to true
   end tell'

Example

Here's a remote control script I wrote in Ruby, using most/all of these things. You run it and press p, q, h, H, j, k, l, L, -, + to command the player (map is at the bottom of the file)

@alairock

This comment has been minimized.

Show comment
Hide comment
@alairock

alairock Apr 4, 2016

@JoshCheek This is excellent work!

I want to also put out there, that this "bandaid" isn't a sufficient enough solution to mark this as resolved. Native controls through an official REST-API is really the solution most of us would need to give the flexibility we are looking for.

alairock commented Apr 4, 2016

@JoshCheek This is excellent work!

I want to also put out there, that this "bandaid" isn't a sufficient enough solution to mark this as resolved. Native controls through an official REST-API is really the solution most of us would need to give the flexibility we are looking for.

@mateusmaso

This comment has been minimized.

Show comment
Hide comment

+1

@NinnOgTonic

This comment has been minimized.

Show comment
Hide comment
@NinnOgTonic

NinnOgTonic Apr 6, 2016

@JoshCheek Still, play queue control is one of the major issues. Doesn't look like your script can control that?

@JoshCheek Still, play queue control is one of the major issues. Doesn't look like your script can control that?

@psrivast

This comment has been minimized.

Show comment
Hide comment

psrivast commented Apr 6, 2016

+1

@JoshCheek

This comment has been minimized.

Show comment
Hide comment
@JoshCheek

JoshCheek Apr 7, 2016

@overnine it uses the AppleScript API, so if the app is on a Mac, and its the same computer as the program that is trying to control it, then it can, otherwise it cannot. Obviously this should be readded to the API, but for now, its enough to build a jukebox for my stereo, I'll put a frontend on it and allow my students to hit it to change songs and things.

@overnine it uses the AppleScript API, so if the app is on a Mac, and its the same computer as the program that is trying to control it, then it can, otherwise it cannot. Obviously this should be readded to the API, but for now, its enough to build a jukebox for my stereo, I'll put a frontend on it and allow my students to hit it to change songs and things.

@matthewdias

This comment has been minimized.

Show comment
Hide comment
@matthewdias

matthewdias Apr 7, 2016

This issue more refers to the control of a user's queue, eg. adding songs to queue, reordering, etc. This isn't possible right now with AppleScript.

This issue more refers to the control of a user's queue, eg. adding songs to queue, reordering, etc. This isn't possible right now with AppleScript.

@oskaremilsson

This comment has been minimized.

Show comment
Hide comment

+1

@ferm10n

This comment has been minimized.

Show comment
Hide comment

ferm10n commented Apr 17, 2016

+1

@LazyTarget

This comment has been minimized.

Show comment
Hide comment

+1

@greeny

This comment has been minimized.

Show comment
Hide comment
@greeny

greeny Oct 5, 2016

Just a fallback solution for some of the ideas I have seen here:

Create a playlist, get its identifier and add songs to that playlist instead. Let the device play from that playlist. Added songs to playlist would be this way added to "currently playing queue", which is basically whole playlist. (dont forget to turn off shuffle mode)

This does not solve the issue we are talking about, but it is at least some solution for us non-Applers, who cannot use that AppleScript thingy.

greeny commented Oct 5, 2016

Just a fallback solution for some of the ideas I have seen here:

Create a playlist, get its identifier and add songs to that playlist instead. Let the device play from that playlist. Added songs to playlist would be this way added to "currently playing queue", which is basically whole playlist. (dont forget to turn off shuffle mode)

This does not solve the issue we are talking about, but it is at least some solution for us non-Applers, who cannot use that AppleScript thingy.

@udany

This comment has been minimized.

Show comment
Hide comment
@udany

udany Oct 5, 2016

I thought about doing this but wasn't sure how it would behave if the
playlist changed after it started playing it, good to know that works.

But it's still not a solution to what I need it to do which would be a
voting system, I'd need to be able to skip the current song and set the
next one just before the current one ends to give it as much voting time as
possible...

I'm considering creating a user script to work with the web player, that
might work.

On Oct 5, 2016 9:47 AM, "Tomáš Blatný" notifications@github.com wrote:

Just a fallback solution for some of the ideas I have seen here:

Create a playlist, get its identifier and add songs to that playlist
instead. Let the device play from that playlist. Added songs to playlist
would be this way added to "currently playing queue", which is basically
whole playlist. (dont forget to turn off shuffle mode)

This does not solve the issue we are talking about, but it is at least
some solution for us non-Applers, who cannot use that AppleScript thingy.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#15 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AGIMJeZ48i7rLr5Hww2aHaHhVt7YOC1Dks5qw5x-gaJpZM4D1E02
.

udany commented Oct 5, 2016

I thought about doing this but wasn't sure how it would behave if the
playlist changed after it started playing it, good to know that works.

But it's still not a solution to what I need it to do which would be a
voting system, I'd need to be able to skip the current song and set the
next one just before the current one ends to give it as much voting time as
possible...

I'm considering creating a user script to work with the web player, that
might work.

On Oct 5, 2016 9:47 AM, "Tomáš Blatný" notifications@github.com wrote:

Just a fallback solution for some of the ideas I have seen here:

Create a playlist, get its identifier and add songs to that playlist
instead. Let the device play from that playlist. Added songs to playlist
would be this way added to "currently playing queue", which is basically
whole playlist. (dont forget to turn off shuffle mode)

This does not solve the issue we are talking about, but it is at least
some solution for us non-Applers, who cannot use that AppleScript thingy.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#15 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AGIMJeZ48i7rLr5Hww2aHaHhVt7YOC1Dks5qw5x-gaJpZM4D1E02
.

@TigerC10

This comment has been minimized.

Show comment
Hide comment
@TigerC10

TigerC10 Oct 5, 2016

The other fallback that I was working on was leveraging https://github.com/jonas-lundqvist/vlc-spotify to queue up songs in VLC. The only problem with that was that you have to get a special app key from spotify to be able to get libspotify to work. Unfortunately, spotify doesn't issue such keys anymore (though, if you're clever enough, you can still find the page to generate one).

However, after getting libspotify to compile I'm still having trouble getting vlc-spotify to compile on Mac. I could probably get it to compile on Linux just fine, maybe I should set up a VM and see if I can get it working the way I expect.

TigerC10 commented Oct 5, 2016

The other fallback that I was working on was leveraging https://github.com/jonas-lundqvist/vlc-spotify to queue up songs in VLC. The only problem with that was that you have to get a special app key from spotify to be able to get libspotify to work. Unfortunately, spotify doesn't issue such keys anymore (though, if you're clever enough, you can still find the page to generate one).

However, after getting libspotify to compile I'm still having trouble getting vlc-spotify to compile on Mac. I could probably get it to compile on Linux just fine, maybe I should set up a VM and see if I can get it working the way I expect.

@jscholes

This comment has been minimized.

Show comment
Hide comment
@jscholes

jscholes Oct 5, 2016

@udany

I'd need to be able to skip the current song and set the next one just before the current one ends to give it as much voting time as possible...

This is pretty much what Last.fm do with their Spotify Remote Control Bridge integration. There is no way, even with that control interface, to queue up a song, so instead they listen for an event to be fired that says a song has just finished, then send a play command with the next URI on their list. A bit hacky, but it generally works. You could also constantly monitor the current playback time and trigger your own queue advancement when a song is about to finish.

I won't go into any detail about the interface, as it's unsupported and not publically documented (by Spotify at least). To my knowledge the only way to gain access to the official docs is to become a Spotify partner. But if you're going to start hacking around with user scripts, you might want to give this a look instead. You could easily create a headless app and UI to do what you're after.

jscholes commented Oct 5, 2016

@udany

I'd need to be able to skip the current song and set the next one just before the current one ends to give it as much voting time as possible...

This is pretty much what Last.fm do with their Spotify Remote Control Bridge integration. There is no way, even with that control interface, to queue up a song, so instead they listen for an event to be fired that says a song has just finished, then send a play command with the next URI on their list. A bit hacky, but it generally works. You could also constantly monitor the current playback time and trigger your own queue advancement when a song is about to finish.

I won't go into any detail about the interface, as it's unsupported and not publically documented (by Spotify at least). To my knowledge the only way to gain access to the official docs is to become a Spotify partner. But if you're going to start hacking around with user scripts, you might want to give this a look instead. You could easily create a headless app and UI to do what you're after.

@crwgregory

This comment has been minimized.

Show comment
Hide comment
@crwgregory

crwgregory Oct 6, 2016

Adding songs to a playlist while playing the playlist does not work. I tried it. The desktop app does not live refresh when a song gets added to the playlist using the web API, it has to go through a process of 'rebooting' to then retrieve it's new songs.

I created a functioning Spotify Music app that anyone could connect to on the local network and add songs to a playlist. The songs on the playlist could be voted on by any user and the number of votes a song would have would determine it's position on the playlist.

The hardest part of getting this app to work was exactly what this issue represents. I tried compiling v8 libspotify libraries to use during runtime and control the client. However libspotify is so out of date that any library built on top of it only compiles with node 0.12, so good luck getting a modern node server to run it.

The hack that I implemented was making spotify believe that I was it's browser brother and making requests to play (the same way open.spotify works). The spotify desktop client runs a server on one of the 4*** ports that you can utilize. I would save the queue of songs in my app, then get the duration of the song I was about to play, then simply set a timeout for that duration. Once that was up I would just make a request with the next song in my playlist.

My app was 100% functional and was used everyday at my company. There is a library out there that I used to make this happen (the requests to the spotify client). I'm not going to link it here for obvious reasons. But if your clever you can find it.

Adding songs to a playlist while playing the playlist does not work. I tried it. The desktop app does not live refresh when a song gets added to the playlist using the web API, it has to go through a process of 'rebooting' to then retrieve it's new songs.

I created a functioning Spotify Music app that anyone could connect to on the local network and add songs to a playlist. The songs on the playlist could be voted on by any user and the number of votes a song would have would determine it's position on the playlist.

The hardest part of getting this app to work was exactly what this issue represents. I tried compiling v8 libspotify libraries to use during runtime and control the client. However libspotify is so out of date that any library built on top of it only compiles with node 0.12, so good luck getting a modern node server to run it.

The hack that I implemented was making spotify believe that I was it's browser brother and making requests to play (the same way open.spotify works). The spotify desktop client runs a server on one of the 4*** ports that you can utilize. I would save the queue of songs in my app, then get the duration of the song I was about to play, then simply set a timeout for that duration. Once that was up I would just make a request with the next song in my playlist.

My app was 100% functional and was used everyday at my company. There is a library out there that I used to make this happen (the requests to the spotify client). I'm not going to link it here for obvious reasons. But if your clever you can find it.

@thelinmichael thelinmichael changed the title from Control queue and playback? to Control queue and playback Oct 15, 2016

@Neo-Desktop

This comment has been minimized.

Show comment
Hide comment
@Neo-Desktop

Neo-Desktop Oct 24, 2016

Ticket #272 was closed out as a duplicate of this ticket

@CoDEmanX would it be possible to add "controlling the seek time" to this request?

Ticket #272 was closed out as a duplicate of this ticket

@CoDEmanX would it be possible to add "controlling the seek time" to this request?

@thelinmichael

This comment has been minimized.

Show comment
Hide comment
@thelinmichael

thelinmichael Oct 24, 2016

Contributor

@Neo-Desktop, added seek time to the original post.

Contributor

thelinmichael commented Oct 24, 2016

@Neo-Desktop, added seek time to the original post.

@RWOverdijk

This comment has been minimized.

Show comment
Hide comment

👍

@jordanranson

This comment has been minimized.

Show comment
Hide comment
@jordanranson

jordanranson Nov 4, 2016

The lack of audio control/playback is keeping me from reviving my app I made for Rdio. A shame they had to go out of business. Any update on this?

The lack of audio control/playback is keeping me from reviving my app I made for Rdio. A shame they had to go out of business. Any update on this?

@lilalinux

This comment has been minimized.

Show comment
Hide comment
@lilalinux

lilalinux Nov 17, 2016

+1
It's unbelievable that the most important function for a music streaming service "playing music" isn't supported by the API.

+1
It's unbelievable that the most important function for a music streaming service "playing music" isn't supported by the API.

@brandoncornel

This comment has been minimized.

Show comment
Hide comment

+1

@pinetrees

This comment has been minimized.

Show comment
Hide comment

+1

@AnderssonPeter

This comment has been minimized.

Show comment
Hide comment
@AnderssonPeter

AnderssonPeter Dec 22, 2016

@thelinmichael are there any news on this?
Im currently on a Windows 10 Mobile and the Spotify app there does not support controlling other devices if you where to add this functionality we could make our own Spotify remote app.
This way we Windows 10 Mobile users can enjoy Spotify radios and the likes!

AnderssonPeter commented Dec 22, 2016

@thelinmichael are there any news on this?
Im currently on a Windows 10 Mobile and the Spotify app there does not support controlling other devices if you where to add this functionality we could make our own Spotify remote app.
This way we Windows 10 Mobile users can enjoy Spotify radios and the likes!

@drsounds

This comment has been minimized.

Show comment
Hide comment
@drsounds

drsounds Jan 4, 2017

I am afraid there is a specific reason why we haven't seen any playback API for the desktop and that is that people have made apps such Eternify, where artists could crowdsource streams in order to get more money. I think it's because this Spotify are not providing playback control interface to the public. On mobile the risk is much less that is happen, since mobiles can't be used as a server.
Playback control api on desktop could be abused for a lot of reasons, which could be costly for Spotify and I think it's the reason Spotify has chosen to not provide that functionality to the public.

drsounds commented Jan 4, 2017

I am afraid there is a specific reason why we haven't seen any playback API for the desktop and that is that people have made apps such Eternify, where artists could crowdsource streams in order to get more money. I think it's because this Spotify are not providing playback control interface to the public. On mobile the risk is much less that is happen, since mobiles can't be used as a server.
Playback control api on desktop could be abused for a lot of reasons, which could be costly for Spotify and I think it's the reason Spotify has chosen to not provide that functionality to the public.

@daweedm

This comment has been minimized.

Show comment
Hide comment

daweedm commented Jan 11, 2017

+1

@DeckardKane

This comment has been minimized.

Show comment
Hide comment
@DeckardKane

DeckardKane Feb 15, 2017

@drsounds That sounds like a plausible reason for Spotify to not implement this. Could they just confirm it in a statement saying "We are not implementing this feature and [x reason] is why not". I have been tearing my hair out looking for this functionality, but if it is confirmed to not be a planned feature, I will find another service to use. Just tell us please!

@drsounds That sounds like a plausible reason for Spotify to not implement this. Could they just confirm it in a statement saying "We are not implementing this feature and [x reason] is why not". I have been tearing my hair out looking for this functionality, but if it is confirmed to not be a planned feature, I will find another service to use. Just tell us please!

@TigerC10

This comment has been minimized.

Show comment
Hide comment
@TigerC10

TigerC10 Feb 22, 2017

@DeckardKane / @drsounds - There's at least partial playback control since you can open up a track/playlist/album while one's already going. So, even if the argument is that playback control can be abused - well so what? It can already be abused.

Since libspotify isn't a thing anymore, it'd be really great to at least get this finished out.

@DeckardKane / @drsounds - There's at least partial playback control since you can open up a track/playlist/album while one's already going. So, even if the argument is that playback control can be abused - well so what? It can already be abused.

Since libspotify isn't a thing anymore, it'd be really great to at least get this finished out.

@drsounds

This comment has been minimized.

Show comment
Hide comment
@drsounds

drsounds Feb 22, 2017

@brongracz

This comment has been minimized.

Show comment
Hide comment
@brongracz

brongracz Mar 5, 2017

They dont understand that they are missing a market like this. That is automation. Siri can play music. Google can play music. If spotify added that playback control API, it would become automaticly a default playback service for smart homes etc. from brands other than apple and google. Also the spotify connect with playback api could help smartify various devices to make part of automated ecosystems. Making spotify connect a sort of a standard for audio streaming in smart homes etc. equivalent to zigbee ZLL protocol for lightning control.
"You want your smart home to talk to all audio devices, choose a device with spotify connect support" is for now not the case. In fact this could make me look for another subscription.

They dont understand that they are missing a market like this. That is automation. Siri can play music. Google can play music. If spotify added that playback control API, it would become automaticly a default playback service for smart homes etc. from brands other than apple and google. Also the spotify connect with playback api could help smartify various devices to make part of automated ecosystems. Making spotify connect a sort of a standard for audio streaming in smart homes etc. equivalent to zigbee ZLL protocol for lightning control.
"You want your smart home to talk to all audio devices, choose a device with spotify connect support" is for now not the case. In fact this could make me look for another subscription.

@drsounds

This comment has been minimized.

Show comment
Hide comment
@drsounds

drsounds Mar 5, 2017

drsounds commented Mar 5, 2017

@kfrz

This comment has been minimized.

Show comment
Hide comment
@kfrz

kfrz Mar 19, 2017

Hey guys! I want to chime in because I've been using Spotify Premium for much longer than I've been involved in software development, but I've always wanted to write an extension to shuffle by album, so I can pick fifteen albums or playlists and shuffle but play the whole record before shuffling to a different record. Lo and I see, it's not really possible.

If anyone has suggestions on how it may be possible, I'm still interested in writing this, I just don't think it'll work with the current Web API.

kfrz commented Mar 19, 2017

Hey guys! I want to chime in because I've been using Spotify Premium for much longer than I've been involved in software development, but I've always wanted to write an extension to shuffle by album, so I can pick fifteen albums or playlists and shuffle but play the whole record before shuffling to a different record. Lo and I see, it's not really possible.

If anyone has suggestions on how it may be possible, I'm still interested in writing this, I just don't think it'll work with the current Web API.

@iangilman

This comment has been minimized.

Show comment
Hide comment
@iangilman

iangilman Mar 20, 2017

@kfrz I know this is a poor substitute for an actual playback API, but the workaround I've been using for my app (http://www.letsfathom.com/) is to have my app make a new playlist and fill it with whatever I want (e.g. 15 albums in random order). I then listen to that playlist once and delete it.

Like I said, it's not as great as an actual playback API, but when you start thinking in terms of these single-use playlists, there's actually a lot of interesting things you can do.

@kfrz I know this is a poor substitute for an actual playback API, but the workaround I've been using for my app (http://www.letsfathom.com/) is to have my app make a new playlist and fill it with whatever I want (e.g. 15 albums in random order). I then listen to that playlist once and delete it.

Like I said, it's not as great as an actual playback API, but when you start thinking in terms of these single-use playlists, there's actually a lot of interesting things you can do.

@jscholes

This comment has been minimized.

Show comment
Hide comment
@jscholes

jscholes Mar 20, 2017

I've always wanted to write an extension to shuffle by album, so I can pick fifteen albums or playlists and shuffle but play the whole record before shuffling to a different record.

The availability of an API to control Spotify's playback queue might indeed help with this, but it's not the only way. You just have to think a little bit outside the box, and watch out for rate limits. For example, you could:

  1. Create a new playlist via the Web API.
  2. Create a hash table/dict/whatever your language of choice refers to it as, use it to store your album/playlist objects.
  3. For each album/playlist, fetch the list of tracks using the Web API and store them in an array which will be a value in your dictionary - this is the part which might bite you if you don't take care to avoid Spotify's rate limiting. Once this bit is done, you should have a hash table with Spotify album/playlist URIs for the keys, and lists of matching tracks for the values.
  4. Once you have an ordered list of tracks for each album/playlist, shuffle the dictionary, rather than the track lists. This will give you the albums/playlists in a random order, but the tracks of each won't be shuffled.
  5. Flatten the whole lot to a list of tracks and add them all to the playlist you created in step 1.

You might extend it by caching the track lists locally for albums/playlists that you listen to a lot. Or to make it more flexible, you could do something like:

  1. Create a new playlist in the Spotify client.
  2. Search for the albums/playlists you want to include, again in the client, and drag the tracks for all of them into your new playlist.
  3. Write a script to fetch the entire playlist from the Web API (which will include the album URI for each track), shuffle the tracks based on what album they belong to and then store the shuffled lot into a new playlist or the same one.

The second approach has the downside that you can only shuffle by album, not by playlist. As with many things in software development you have to decide what your priorities are and go from there. This is especially important when developing against a third party system that you don't control.

jscholes commented Mar 20, 2017

I've always wanted to write an extension to shuffle by album, so I can pick fifteen albums or playlists and shuffle but play the whole record before shuffling to a different record.

The availability of an API to control Spotify's playback queue might indeed help with this, but it's not the only way. You just have to think a little bit outside the box, and watch out for rate limits. For example, you could:

  1. Create a new playlist via the Web API.
  2. Create a hash table/dict/whatever your language of choice refers to it as, use it to store your album/playlist objects.
  3. For each album/playlist, fetch the list of tracks using the Web API and store them in an array which will be a value in your dictionary - this is the part which might bite you if you don't take care to avoid Spotify's rate limiting. Once this bit is done, you should have a hash table with Spotify album/playlist URIs for the keys, and lists of matching tracks for the values.
  4. Once you have an ordered list of tracks for each album/playlist, shuffle the dictionary, rather than the track lists. This will give you the albums/playlists in a random order, but the tracks of each won't be shuffled.
  5. Flatten the whole lot to a list of tracks and add them all to the playlist you created in step 1.

You might extend it by caching the track lists locally for albums/playlists that you listen to a lot. Or to make it more flexible, you could do something like:

  1. Create a new playlist in the Spotify client.
  2. Search for the albums/playlists you want to include, again in the client, and drag the tracks for all of them into your new playlist.
  3. Write a script to fetch the entire playlist from the Web API (which will include the album URI for each track), shuffle the tracks based on what album they belong to and then store the shuffled lot into a new playlist or the same one.

The second approach has the downside that you can only shuffle by album, not by playlist. As with many things in software development you have to decide what your priorities are and go from there. This is especially important when developing against a third party system that you don't control.

@kfrz

This comment has been minimized.

Show comment
Hide comment
@kfrz

kfrz Mar 20, 2017

@jscholes -- thanks, that was a great response. I figured I could do something like build a playlist on the fly, so that's probably the way I'll approach it.

kfrz commented Mar 20, 2017

@jscholes -- thanks, that was a great response. I figured I could do something like build a playlist on the fly, so that's probably the way I'll approach it.

@asmitter

This comment has been minimized.

Show comment
Hide comment
@asmitter

asmitter Mar 31, 2017

Member

Thanks everyone for the patience, input and workarounds on these ideas.
We're very pleased to release the following set of endpoints for interacting with playback via Connect: https://developer.spotify.com/web-api/web-api-connect-endpoint-reference/

As they align pretty closely with the discussion here, I'll close this issue. This thread did evolve though, so please open new issues if these new endpoints don't do the trick.

Member

asmitter commented Mar 31, 2017

Thanks everyone for the patience, input and workarounds on these ideas.
We're very pleased to release the following set of endpoints for interacting with playback via Connect: https://developer.spotify.com/web-api/web-api-connect-endpoint-reference/

As they align pretty closely with the discussion here, I'll close this issue. This thread did evolve though, so please open new issues if these new endpoints don't do the trick.

@dreszczyk

This comment has been minimized.

Show comment
Hide comment
@dreszczyk

dreszczyk Apr 13, 2017

Is there a library that covers the last changes?

dreszczyk commented Apr 13, 2017

Is there a library that covers the last changes?

@lodev09

This comment has been minimized.

Show comment
Hide comment
@lodev09

lodev09 Apr 20, 2017

@dreszczyk here's my sbotify bot using the new playback stuff :)
https://github.com/lodev09/sbotify

lodev09 commented Apr 20, 2017

@dreszczyk here's my sbotify bot using the new playback stuff :)
https://github.com/lodev09/sbotify

@tjhrulz

This comment has been minimized.

Show comment
Hide comment
@tjhrulz

tjhrulz May 15, 2017

@asmitter Any chance we chould get a playpause command added to it? That way the command does not have to worry about changing itself based on the state of the player

Also will this endpoint ever be available to non premium users even if it is more limited?

tjhrulz commented May 15, 2017

@asmitter Any chance we chould get a playpause command added to it? That way the command does not have to worry about changing itself based on the state of the player

Also will this endpoint ever be available to non premium users even if it is more limited?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment