Skip to content
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

Spotify Playlist URL #632

Open
iceweb-ch opened this issue Jul 20, 2018 · 12 comments
Open

Spotify Playlist URL #632

iceweb-ch opened this issue Jul 20, 2018 · 12 comments

Comments

@iceweb-ch
Copy link

iceweb-ch commented Jul 20, 2018

Hi there,

thanks for this API really cool.

Can someone help me with spotify playlist URL?

I want to play the following playlist
https://open.spotify.com/user/spotify/playlist/37i9dQZF1DWZ0OzPeadl0h

I tried
http://localhost:5005/wohnzimmer/spotify/now/spotify:user:spotify:playlist:37i9dQZF1DWZ0OzPeadl0h

which gives me
{"status":"error","error":"Got status 500 when invoking /MediaRenderer/AVTransport/Control","stack":"Error\n at Object.invoke (/home/pi/sonos/node_modules/sonos-discovery/lib/helpers/soap.js:94:10)\n at Player.nextTrack (/home/pi/sonos/node_modules/sonos-discovery/lib/models/Player.js:399:15)\n at player.coordinator.addURIToQueue.then (/home/pi/sonos/lib/actions/spotify.js:28:38)\n at process._tickCallback (internal/process/next_tick.js:68:7)"}

With next
http://localhost:5005/wohnzimmer/spotify/next/spotify:user:spotify:playlist:37i9dQZF1DWZ0OzPeadl0h

This gives me
{"firsttracknumberenqueued":"1","numtracksadded":"75","newqueuelength":"491"}
but does not play anything. If I put a followup command with /wohnzimmer/play I get an error.
{"status":"error","error":"Got status 500 when invoking /MediaRenderer/AVTransport/Control","stack":"Error\n at Object.invoke (/home/pi/sonos/node_modules/sonos-discovery/lib/helpers/soap.js:94:10)\n at Player.play (/home/pi/sonos/node_modules/sonos-discovery/lib/models/Player.js:379:15)\n at Object.play (/home/pi/sonos/lib/actions/playpause.js:11:28)\n at handleAction (/home/pi/sonos/lib/sonos-http-api.js:110:35)\n at HttpAPI.requestHandler (/home/pi/sonos/lib/sonos-http-api.js:87:5)\n at /home/pi/sonos/server.js:80:13\n at Server.finish (/home/pi/sonos/node_modules/node-static/lib/node-static.js:111:13)\n at finish (/home/pi/sonos/node_modules/node-static/lib/node-static.js:170:14)\n at /home/pi/sonos/node_modules/node-static/lib/node-static.js:144:17\n at FSReqWrap.oncomplete (fs.js:158:21)"}

I tried many variations just dont get this working :(

@iceweb-ch
Copy link
Author

anyone? :)

@jishi
Copy link
Owner

jishi commented Jul 27, 2018

So it seems like it manages to actually add the tracks to queue. What does it look like in the Sonos Controller after you've added the playlist? And can you start playback of these tracks from the official controller?

FYI, now will append the tracks onto current queue and then move the queue position, however that shouldn't matter if the queue is already empty.

The 500 error is from the player, and that indicates that it actually doesn't know what to do when you invoke play.

@iceweb-ch
Copy link
Author

Hey Jishi,
thanks for the response.
Is there a way to clear the current queue?

@jishi
Copy link
Owner

jishi commented Aug 16, 2018

Yes, just invoke /player_name/clearqueue

@acatoire
Copy link

Hi,
I have the same issue trying to start a playlist with

http://192.xxx.xxx.xxx:5005/spotify/now/spotify:playlist:5p0Mw9D1i1EjkJyIafFsvH

Album works great

http://192.xxx.xxx.xxx:5005/spotify/now/spotify:album:5lFcL4pj96ZRsoIiHpFl79

I have this error:
"Error: Got status 500 when invoking /MediaRenderer/AVTransport/Control\n at Object.invoke (/app/node_modules/sonos-discovery/lib/helpers/soap.js:99:10)\n at Player.addURIToQueue (/app/node_modules/sonos-discovery/lib/models/Player.js:616:15)\n at promise.then (/app/lib/actions/spotify.js:37:33)"

I try to execute a /clearqueue before the /spotify/now/spotify:xxx with the same error.

Does anybody succeeded to use playlist on spotify?

@weidaj
Copy link

weidaj commented Aug 2, 2019

Yes, I am seeing the same thing with playlists. Album, song, station all work with Spotify, but playlist does not. And I agree, super cool API, thank you for this.

@DavidDeSloovere
Copy link
Contributor

@acatoire
To start a playlist, you need this format
http://192.168.0.201:5005/kitchen/spotify/now/spotify:user:spotify:playlist:37i9dQZF1DWUI9wBgUr4BH

The spotify:user: part is requird as prefix to spotify:playlist:37i9dQZF1DWUI9wBgUr4BH

@iceweb-ch
Your playlist/url works for me, not in yourliving room but in my kitchen 😸
http://192.168.0.201:5005/kitchen/spotify/now/spotify:user:spotify:playlist:37i9dQZF1DWZ0OzPeadl0h

Maybe something was corrupt locally?

@weidaj
Copy link

weidaj commented Aug 18, 2019

It works! Thanks @DavidDeSloovere! Did I miss this in the doc somewhere? I did not see this format on the webpage:
.../spotify:user:spotify:playlist:...

Regarding the status 500 error, it seems like it might be related to me playing to Sonos from the Spotify App on my phone, then later trying to use the API, but I can't reproduce it 100%. I'll try to get the steps to reproduce. When it was happening I noticed the player on my phone says "Last played from Spotify /Resume /End Session". I did something to clear the issue, but I don't know what did it.

@DavidDeSloovere
Copy link
Contributor

Created this PR yesterday to update the docs.
#712

@acatoire
Copy link

acatoire commented Sep 4, 2019

Great, it works, thanks

@KogResten
Copy link

KogResten commented Mar 4, 2021

I was banging my head against this issue as well in a case where my kitchen speaker would work fine, but the living room speaker would throw an error.

I resolved the issue by going to the Sonos App on my phone and ending the session which was started from Spotify on my living room speaker.

Is there any way to end a session via the API?

@ucdscott
Copy link

ucdscott commented Aug 22, 2024

Is there any way to end a session via the API?

@KogResten I asked the same question: Repeat of Grouped Zones Returns Error #854

The inability to End Session is a 5+ year-old gaping hole in this project.

@DavidDeSloovere You seem smart. Any idea on how to craft a URI to End Session?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants