node-sonos-http-api icon indicating copy to clipboard operation
node-sonos-http-api copied to clipboard

Pandora thumbsup / thumbsdown not working

Open manonstreet opened this issue 8 years ago • 11 comments
trafficstars

When calling thumbsup or thumbsdown, I always receive the following error: "ERROR The music that is playing is not a Pandora station"

Examining lib/actions/pandora.js shows that it first checks to ensure the uri starts with pndrradio-http, and then inspects the uri to extract the stationToken and trackToken.

When playing a pandora station to Basement, and then looking at: http://<node-sonos-http-api-ip>:5005/Basement/state

I see the uri parameter contains the following: uri":"pndrradio:xxxxxxxxxxxxxxxxxx?sn=2"

Since it doesn't start with the necessary prefix, it returns the error. Additionally, the additional details are not present within the uri. However the uri for the nextTrack does contain the expected prefix and the stationToken and trackToken details.

Not sure what the issue is exactly, but it appears the metadata returned via state / zones for the current track does not contain enough information to make this feature function.

manonstreet avatar Dec 04 '16 00:12 manonstreet

Ping?

manonstreet avatar Dec 17 '16 17:12 manonstreet

Could you please post example of the currentTrack uri and the nextTrack uri? I did change what currentTrack uri contains, because I wanted the uri that would allow resuming of the radio station if I changed source. I don't think the pndrradio-http would allow that (but not sure). It's at least true for tunein and a few other sources.

Because of that, I can't just restore the old functionality, and as you said, you need stationToken and trackToken apparently. Gonna need a way to get that in another way. I don't have or can't use pandora personally (they aren't available in Sweden) so I have limited possibilities to test this.

Maybe @jplourde5 has some good input?

jishi avatar Dec 19 '16 20:12 jishi

The Pandora Thumbs logic tests to see if the currently playing track's uri starts with "pndrradio-http" before it sends the command to the Pandora API. The check will fail if something changed with the what the uri starts with, or if there is another option for what a Pandora uri starts with. I suspect that the fix will be to either change what my logic is checking for or to add what ever the additional option that it might be to the check in line 117 of pandora.js.

jplourde5 avatar Dec 20 '16 21:12 jplourde5

Looking above, it sounds like the "-http" is no longer there. I'll make a quick fix.

jplourde5 avatar Dec 20 '16 21:12 jplourde5

The fix has been submitted

jplourde5 avatar Dec 20 '16 21:12 jplourde5

Need to test to confirm, but I suspect this will not be sufficient to fix the issue. Even if it passes the first test on the prefix, the logic will not be able to extract the stationToken and trackToken because they are not present. And as noted above, oddly, it is present when looking at the next track in the state endpoint but not the currently playing track.

manonstreet avatar Dec 21 '16 00:12 manonstreet

Example current and next track:

{ "currentTrack":{ "artist":"Houndmouth", "title":"For No One", "album":"For No One (Single)", "albumArtUri":"http://mediaserver-cont-dc6-1-v4v6.pandora.com/images/public/gracenote/albumart/5/7/3/6/800056375_500W_500H.jpg", "duration":231, "uri":"pndrradio:2797398370103110686?sn=5", "type":"radio", "stationName":"QuickMix", "absoluteAlbumArtUri":"http://mediaserver-cont-dc6-1-v4v6.pandora.com/images/public/gracenote/albumart/5/7/3/6/800056375_500W_500H.jpg" }, "nextTrack":{ "artist":"Pink Floyd", "title":"Comfortably Numb", "album":"The Wall", "albumArtUri":"http://mediaserver-cont-ch1-2-v4v6.pandora.com/images/public/rovi/albumart/9/2/3/4/724383124329_500W_500H.jpg", "duration":0, "uri":"pndrradio-http://t1-2.p-cdn.com/access/2819363458305417606?version=5&lid=289451038&token=<removed>&a=http%3a%2f%2fmediaserver-cont-ch1-2-v4v6.pandora.com%2fimages%2fpublic%2frovi%2falbumart%2f9%2f2%2f3%2f4%2f724383124329_500W_500H.jpg&m=<removed>&f=1&r=0&g=-0.84&x=0003f35a", "absoluteAlbumArtUri":"http://mediaserver-cont-ch1-2-v4v6.pandora.com/images/public/rovi/albumart/9/2/3/4/724383124329_500W_500H.jpg" }, "volume":48, "mute":true, "trackNo":2, "elapsedTime":3, "elapsedTimeFormatted":"00:00:03", "playbackState":"PLAYING", "playMode":{ "repeat":"none", "shuffle":false, "crossfade":false } }

manonstreet avatar Dec 21 '16 00:12 manonstreet

Did you test the fix? The tokens should be taken care of by the Anesidora library.

jplourde5 avatar Dec 21 '16 17:12 jplourde5

Just gave this a try. Returns the following error:

{"status":"error","error":"An unexpected error occurred [0]","stack":"Error: An unexpected error occurred [0]\n at Request._callback (/Users/manonstreet/Applications/echo-sonos/node_modules/anesidora/anesidora.js:39:33)\n at Request.self.callback (/Users/manonstreet/Applications/echo-sonos/node_modules/request/request.js:187:22)\n at emitTwo (events.js:106:13)\n at Request.emit (events.js:191:7)\n at Request. (/Users/manontreet/Applications/echo-sonos/node_modules/request/request.js:1044:10)\n at emitOne (events.js:96:13)\n at Request.emit (events.js:188:7)\n at IncomingMessage. (/Users/manonstreet/Applications/echo-sonos/node_modules/request/request.js:965:12)\n at emitNone (events.js:91:20)\n at IncomingMessage.emit (events.js:185:7)\n at endReadableNT (_stream_readable.js:974:12)\n at _combinedTickCallback (internal/process/next_tick.js:74:11)\n at process._tickCallback (internal/process/next_tick.js:98:9)"}

manonstreet avatar Dec 23 '16 18:12 manonstreet

Is there a fix in the works for this? Would LOVE this functionality!

taddat avatar Jan 11 '18 16:01 taddat

Is the Pandora thumbsup/thumbsdown functionality still not working? I have encountered this same problem and would like to know if I should stop banging my head against this wall... here are my error messages:

pandoraAPI station.addFeedback {"stationToken":"(removed)","trackToken":"VC1","isPositive":true,"userAuthToken":"(removed)","syncTime":1734679435} ERROR: {} 2024-12-20T07:23:57.760Z ERROR Error: An unexpected error occurred [0] at Request._callback (/home/(removed)/node-sonos-http-api/node_modules/anesidora/anesidora.js:39:33) at self.callback (/home/(removed)/node-sonos-http-api/node_modules/request/request.js:185:22) at Request.emit (node:events:524:28) at Request.emit (node:domain:489:12) at Request. (/home/(removed)/node-sonos-http-api/node_modules/request/request.js:1154:10) at Request.emit (node:events:524:28) at Request.emit (node:domain:489:12) at IncomingMessage. (/home/(removed)/node-sonos-http-api/node_modules/request/request.js:1076:12) at Object.onceWrapper (node:events:638:28) at IncomingMessage.emit (node:events:536:35) at IncomingMessage.emit (node:domain:489:12) at endReadableNT (node:internal/streams/readable:1698:12) at process.processTicksAndRejections (node:internal/process/task_queues:90:21)

and this:

{"status":"error","error":"An unexpected error occurred [0]","stack":"Error: An unexpected error occurred [0]\n at Request._callback (/home/(removed)/node-sonos-http-api/node_modules/anesidora/anesidora.js:39:33)\n at self.callback (/home/(removed)/node-sonos-http-api/node_modules/request/request.js:185:22)\n at Request.emit (node:events:524:28)\n at Request.emit (node:domain:489:12)\n at Request. (/home/(removed)/node-sonos-http-api/node_modules/request/request.js:1154:10)\n at Request.emit (node:events:524:28)\n at Request.emit (node:domain:489:12)\n at IncomingMessage. (/home/(removed)/node-sonos-http-api/node_modules/request/request.js:1076:12)\n at Object.onceWrapper (node:events:638:28)\n at IncomingMessage.emit (node:events:536:35)\n at IncomingMessage.emit (node:domain:489:12)\n at endReadableNT (node:internal/streams/readable:1698:12)\n at process.processTicksAndRejections (node:internal/process/task_queues:90:21)"}

Otherwise, Pandora play radio station works fine. Thanks!

jksalvo avatar Dec 20 '24 18:12 jksalvo