MPRIS play-pause results in bad request errors
This is what I get on play-pause,
response: Response { url: "https://api.spotify.com/v1/me/player/currently-playing", status: BadRequest, headers: {"Content-Type": "text/html; charset=UTF-8", "Referrer-Policy": "no-referrer", "Content-Length": "1555", "Date": "Thu, 21 Jun 2018 22:32:44 GMT"} }
content: "<!DOCTYPE html>\n<html lang=en>\n <meta charset=utf-8>\n <meta name=viewport content=\"initial-scale=1, minimum-scale=1, width=device-width\">\n <title>Error 400 (Bad Request)!!1</title>\n <style>\n *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}\n </style>\n <a href=//www.google.com/><span id=logo aria-label=Google></span></a>\n <p><b>400.</b> <ins>That’s an error.</ins>\n <p>Your client has issued a malformed or illegal request. <ins>That’s all we know.</ins>\n"
parameters: Object({})
response: Response { url: "https://api.spotify.com/v1/me/player/play?device_id=Spotifyd@giant", status: NotFound, headers: {"Content-Type": "application/json; charset=utf-8", "Cache-Control": "private, max-age=0", "Access-Control-Allow-Origin": "*", "Access-Control-Allow-Headers": "Accept, Authorization, Origin, Content-Type, Retry-After", "Access-Control-Allow-Methods": "GET, POST, OPTIONS, PUT, DELETE, PATCH", "Access-Control-Allow-Credentials": "true", "Access-Control-Max-Age": "604800", "Date": "Thu, 21 Jun 2018 22:32:44 GMT", "Via": "1.1 google", "Alt-Svc": "clear", "Transfer-Encoding": "chunked"} }
content: "{\n \"error\" : {\n \"status\" : 404,\n \"message\" : \"Device not found\"\n }\n}"
I am able to control it using the web client and android app. Unrelated to this, song information is not exported via MPRIS or it isn't working as I get no indication in Plasma about it.
Next and previous media keys don't log anything but they don't work either.
@j605 try this command, it works for me: dbus-send --print-reply --dest="org.mpris.MediaPlayer2.spotifyd" "/org/mpris/MediaPlayer2" "org.mpris.MediaPlayer2.Player.PlayPause"
But I can confirm that Metadata (current_user_playing_track) request doesn't work. From the error message it seems that the URL is correct and according to the API wiki the only header parameter should be user token so problem probably lies there (assuming that the API itself is working correctly)
Your command works but I found the error from Plasma in the logs:
kde.dataengine.mpris: "org.mpris.MediaPlayer2.spotifyd" does not implement org.freedesktop.DBus.Properties correctly Error message was "org.freedesktop.DBus.Error.NoReply" "Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken."
edit: this might be a Plasma issue so I have filed a bug there after discussion with them.
Okay, I've found an actual solution to the problem: delete file Cargo.lock and in Cargo.toml change 'rspotify = "0.1.2"' to 'rspotify = "0.2.3"' works like a charm now
Thanks @zv0n for finding that. I've bumped the version of rspotify and a new release had been uploaded.
Even after updating, I get
response: Response { url: "https://api.spotify.com/v1/me/player/next?device_id=Spotifyd@giant", status: NotFound, headers: {"Content-Type": "application/json; charset=utf-8", "Cache-Control": "private, max-age=0", "Access-Control-Allow-Origin": "*", "Access-Control-Allow-Headers": "Accept, Authorization, Origin, Content-Type, Retry-After", "Access-Control-Allow-Methods": "GET, POST, OPTIONS, PUT, DELETE, PATCH", "Access-Control-Allow-Credentials": "true", "Access-Control-Max-Age": "604800", "Date": "Sun, 24 Jun 2018 12:17:21 GMT", "Via": "1.1 google", "Alt-Svc": "clear", "Transfer-Encoding": "chunked"} }
Jun 24 14:17:21 giant spotifyd[14866]: content: "{\n \"error\" : {\n \"status\" : 404,\n \"message\" : \"Device not found\"\n }\n}"
Anything more I could do to debug this?