jishi / node-sonos-http-api

An HTTP API bridge for Sonos easing automation. Hostable on any node.js capable device, like a raspberry pi or similar.
http://jishi.github.io/node-sonos-http-api/
MIT License
1.83k stars 462 forks source link

Spotify Podcast Episodes error 500 #893

Open bpratt107 opened 1 month ago

bpratt107 commented 1 month ago

Trying to get an automation setup for my son, to play some podcast episodes of thomas the train.

Standard calls to spotify work for any album based track. (music etc)

but any sort of podcast play returns: URL Call: http://192.168.1.27:5005/[RoomName]/spotify/now/7iFmGKpRo0FOCaMfH47Spv

{"status":"error","error":"Got status 500 when invoking /MediaRenderer/AVTransport/Control","stack":"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 /app/lib/actions/spotify.js:33:36\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"}

I noticed on Spotify's URL's, when a podcast episode is playing, it says "episode" "https://open.spotify.com/episode/7iFmGKpRo0FOCaMfH47Spv" but when a song/album is playing, it says "track" "https://open.spotify.com/track/4PTG3Z6ehGkBFwjybzWkR8"

Thoughts on why I might be getting this error 500? I'm inclined to believe it's due to this episode/track inconsistency

bpratt107 commented 1 month ago

More notes,

When I make the call: http://192.168.1.27:5005/LivingRoom/spotify/now/spotify:episode:31PQ6wMS34oRG7DFQa8zkX

This will output success, and the state of the zone will report the correct episode playing, but the state is STOPPED. I have tried seeking track, and well as play, in the zone, to no avail.

Below is the state of the livingroom player after the above call.

{"volume":2,"mute":false,"equalizer":{"bass":3,"treble":0,"loudness":true,"speechEnhancement":true,"nightMode":false},"currentTrack":{"artist":"Gullane (Thomas) Limited.","title":"Christmas Animals Special: Animal Families - Thomas & Friends™ Storytime","album":"Thomas & Friends™ Storytime (UK)","albumArtUri":"/getaa?s=1&u=x-sonos-spotify%3aspotify%253aepisode%253a31PQ6wMS34oRG7DFQa8zkX%3fsid%3d9%26flags%3d8%26sn%3d5","duration":1844,"uri":"x-sonos-spotify:spotify%3aepisode%3a31PQ6wMS34oRG7DFQa8zkX?sid=9&flags=8&sn=5","trackUri":"x-sonos-spotify:spotify%3aepisode%3a31PQ6wMS34oRG7DFQa8zkX?sid=9&flags=8&sn=5","type":"track","stationName":"","absoluteAlbumArtUri":"http://192.168.1.44:1400/getaa?s=1&u=x-sonos-spotify%3aspotify%253aepisode%253a31PQ6wMS34oRG7DFQa8zkX%3fsid%3d9%26flags%3d8%26sn%3d5"},"nextTrack":{"artist":"","title":"","album":"","albumArtUri":"","duration":0,"uri":""},"trackNo":1,"elapsedTime":0,"elapsedTimeFormatted":"00:00:00","playbackState":"STOPPED","playMode":{"repeat":"none","shuffle":true,"crossfade":true},"sub":{"gain":7,"crossover":0,"polarity":0,"enabled":true}}

bpratt107 commented 1 month ago

When casting from spotify, the JSON uri is

"x-sonos-spotify:spotify:episode:3YjxbPjCYKkTQrXVUehIOA?sid=9&flags=0&sn=5"

but when cast via the above link, the JSON uri: is: "x-sonos-spotify:spotify%3aepisode%3a31PQ6wMS34oRG7DFQa8zkX?sid=9&flags=8&sn=5"

It seems to be adding in %3 in place of the colons on episode direct calls?