spotifyd icon indicating copy to clipboard operation
spotifyd copied to clipboard

MPRIS returns an empty array

Open mtshrmn opened this issue 5 years ago • 4 comments

Description

This is a follow up to #503 In the issue, it is instructed to use your own Spotify client id when running spotifyd.

I've followed the instructions by creating a new id and setting the SPOTIFYD_CLIENT_ID environment variable. however, the error still persists.

To Reproduce

run: SPOTIFY_CLIENT_ID=ID spotifyd --no-daemon (in fish that's how you set the environment variable)

Expected behavior

should not show the error

Logs

Click to show logs https://pastebin.com/AGzczd5e

I've downloaded using AUR: https://aur.archlinux.org/packages/spotifyd-dbus-mpris/

Versions (please complete the following information):

  • OS: Arch on kernel 5.7.10
  • Spotifyd: 0.2.24
  • cargo: 1.45.0

mtshrmn avatar Jul 25 '20 13:07 mtshrmn

The issue had a template for a reason. You didn't provide any log files or information about the system you are running. Why do people ignore my templates... 🤦 It's like the first thing people do is to ctrl-a-delete the content 😔

mainrs avatar Jul 25 '20 13:07 mainrs

You're right, I'm sorry, updating the issue.

mtshrmn avatar Jul 25 '20 13:07 mtshrmn

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jan 13 '21 14:01 stale[bot]

I just tried to make add a set method to the volume property. In doing so, I discovered more issues on the dbus, such as the one described here.

if I try: dbus-send --session --print-reply --dest=org.mpris.MediaPlayer2.spotifyd /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata'

I get: method return time=1647187893.258206 sender=:1.1051 -> destination=:1.1052 serial=9 reply_serial=2 variant array [ ]

@eladyn stated here #1047 that this may be because of an expired token.

I think that this is another problem, but not the main one

Because even if the token is not expired, an empty array will be returned. This seems to be the case because the response from the Spotify API is in a different format from what Rspotify expects.

Err(ErrorMessage { msg: "convert result failed, reason: Error(\"unknown variant collection, expected one of artist, album, track, playlist, user\", line: 8, column: 25); content: [\"{\\n \\\"timestamp\\\" : 1647187889280,\\n \\\"context\\\" : {\\n \\\"external_urls\\\" : {\\n \\\"spotify\\\" : \\\"https://open.spotify.com/collection/tracks\\\"\\n },\\n \\\"href\\\" : \\\"https://api.spotify.com/v1/me/tracks\\\",\\n \\\"type\\\" : \\\"collection\\\",\\n \\\"uri\\\" : \\\"spotify:user:<username>:collection\\\"\\n },\\n \\\"progress_ms\\\" : 74502,\\n \\\"item\\\" : {\\n \\\"album\\\" : {\\n \\\"album_type\\\" : \\\"album\\\",\\n \\\"artists\\\" : [ {\\n \\\"external_urls\\\" : {\\n \\\"spotify\\\" : \\\"https://open.spotify.com/artist/6nS5roXSAGhTGr34W6n7Et\\\"\\n },\\n \\\"href\\\" : \\\"https://api.spotify.com/v1/artists/6nS5roXSAGhTGr34W6n7Et\\\",\\n \\\"id\\\" : \\\"6nS5roXSAGhTGr34W6n7Et\\\",\\n \\\"name\\\" : \\\"Disclosure\\\",\\n \\\"type\\\" : \\\"artist\\\",\\n \\\"uri\\\" : \\\"spotify:artist:6nS5roXSAGhTGr34W6n7Et\\\"\\n } ],\\n \\\"available_markets\\\" : [ \\\"AD\\\", \\\"AE\\\", \\\"AG\\\", \\\"AL\\\", \\\"AM\\\", \\\"AO\\\", \\\"AR\\\", \\\"AT\\\", \\\"AU\\\", \\\"AZ\\\", \\\"BA\\\", \\\"BB\\\", \\\"BD\\\", \\\"BE\\\", \\\"BF\\\", \\\"BG\\\", \\\"BH\\\", \\\"BI\\\", \\\"BJ\\\", \\\"BN\\\", \\\"BO\\\", \\\"BR\\\", \\\"BS\\\", \\\"BT\\\", \\\"BW\\\", \\\"BY\\\", \\\"BZ\\\", \\\"CD\\\", \\\"CG\\\", \\\"CH\\\", \\\"CI\\\", \\\"CL\\\", \\\"CM\\\", \\\"CO\\\", \\\"CR\\\", \\\"CV\\\", \\\"CW\\\", \\\"CY\\\", \\\"CZ\\\", \\\"DE\\\", \\\"DJ\\\", \\\"DK\\\", \\\"DM\\\", \\\"DO\\\", \\\"DZ\\\", \\\"EC\\\", \\\"EE\\\", \\\"EG\\\", \\\"ES\\\", \\\"FI\\\", \\\"FJ\\\", \\\"FM\\\", \\\"FR\\\", \\\"GA\\\", \\\"GB\\\", \\\"GD\\\", \\\"GE\\\", \\\"GH\\\", \\\"GM\\\", \\\"GN\\\", \\\"GQ\\\", \\\"GR\\\", \\\"GT\\\", \\\"GW\\\", \\\"GY\\\", \\\"HK\\\", \\\"HN\\\", \\\"HR\\\", \\\"HT\\\", \\\"HU\\\", \\\"ID\\\", \\\"IE\\\", \\\"IL\\\", \\\"IN\\\", \\\"IQ\\\", \\\"IS\\\", \\\"IT\\\", \\\"JM\\\", \\\"JO\\\", \\\"JP\\\", \\\"KE\\\", \\\"KG\\\", \\\"KH\\\", \\\"KI\\\", \\\"KM\\\", \\\"KN\\\", \\\"KR\\\", \\\"KW\\\", \\\"KZ\\\", \\\"LA\\\", \\\"LB\\\", \\\"LC\\\", \\\"LI\\\", \\\"LK\\\", \\\"LR\\\", \\\"LS\\\", \\\"LT\\\", \\\"LU\\\", \\\"LV\\\", \\\"LY\\\", \\\"MA\\\", \\\"MC\\\", \\\"MD\\\", \\\"ME\\\", \\\"MG\\\", \\\"MH\\\", \\\"MK\\\", \\\"ML\\\", \\\"MN\\\", \\\"MO\\\", \\\"MR\\\", \\\"MT\\\", \\\"MU\\\", \\\"MV\\\", \\\"MW\\\", \\\"MX\\\", \\\"MY\\\", \\\"MZ\\\", \\\"NA\\\", \\\"NE\\\", \\\"NG\\\", \\\"NI\\\", \\\"NL\\\", \\\"NO\\\", \\\"NP\\\", \\\"NR\\\", \\\"NZ\\\", \\\"OM\\\", \\\"PA\\\", \\\"PE\\\", \\\"PG\\\", \\\"PH\\\", \\\"PK\\\", \\\"PL\\\", \\\"PS\\\", \\\"PT\\\", \\\"PW\\\", \\\"PY\\\", \\\"QA\\\", \\\"RO\\\", \\\"RS\\\", \\\"RU\\\", \\\"RW\\\", \\\"SA\\\", \\\"SB\\\", \\\"SC\\\", \\\"SE\\\", \\\"SG\\\", \\\"SI\\\", \\\"SK\\\", \\\"SL\\\", \\\"SM\\\", \\\"SN\\\", \\\"SR\\\", \\\"ST\\\", \\\"SV\\\", \\\"SZ\\\", \\\"TD\\\", \\\"TG\\\", \\\"TH\\\", \\\"TJ\\\", \\\"TL\\\", \\\"TN\\\", \\\"TO\\\", \\\"TR\\\", \\\"TT\\\", \\\"TV\\\", \\\"TW\\\", \\\"TZ\\\", \\\"UA\\\", \\\"UG\\\", \\\"UY\\\", \\\"UZ\\\", \\\"VC\\\", \\\"VE\\\", \\\"VN\\\", \\\"VU\\\", \\\"WS\\\", \\\"XK\\\", \\\"ZA\\\", \\\"ZM\\\", \\\"ZW\\\" ],\\n \\\"external_urls\\\" : {\\n \\\"spotify\\\" : \\\"https://open.spotify.com/album/7bdjtx1RTkWoSoOaIl7a8E\\\"\\n },\\n \\\"href\\\" : \\\"https://api.spotify.com/v1/albums/7bdjtx1RTkWoSoOaIl7a8E\\\",\\n \\\"id\\\" : \\\"7bdjtx1RTkWoSoOaIl7a8E\\\",\\n \\\"images\\\" : [ {\\n \\\"height\\\" : 640,\\n \\\"url\\\" : \\\"https://i.scdn.co/image/ab67616d0000b273786201dca187d2b0c956c24b\\\",\\n \\\"width\\\" : 640\\n }, {\\n \\\"height\\\" : 300,\\n \\\"url\\\" : \\\"https://i.scdn.co/image/ab67616d00001e02786201dca187d2b0c956c24b\\\",\\n \\\"width\\\" : 300\\n }, {\\n \\\"height\\\" : 64,\\n \\\"url\\\" : \\\"https://i.scdn.co/image/ab67616d00004851786201dca187d2b0c956c24b\\\",\\n \\\"width\\\" : 64\\n } ],\\n \\\"name\\\" : \\\"Settle (Special Edition)\\\",\\n \\\"release_date\\\" : \\\"2013-06-03\\\",\\n \\\"release_date_precision\\\" : \\\"day\\\",\\n \\\"total_tracks\\\" : 37,\\n \\\"type\\\" : \\\"album\\\",\\n \\\"uri\\\" : \\\"spotify:album:7bdjtx1RTkWoSoOaIl7a8E\\\"\\n },\\n \\\"artists\\\" : [ {\\n \\\"external_urls\\\" : {\\n \\\"spotify\\\" : \\\"https://open.spotify.com/artist/6nS5roXSAGhTGr34W6n7Et\\\"\\n },\\n \\\"href\\\" : \\\"https://api.spotify.com/v1/artists/6nS5roXSAGhTGr34W6n7Et\\\",\\n \\\"id\\\" : \\\"6nS5roXSAGhTGr34W6n7Et\\\",\\n \\\"name\\\" : \\\"Disclosure\\\",\\n \\\"type\\\" : \\\"artist\\\",\\n \\\"uri\\\" : \\\"spotify:artist:6nS5roXSAGhTGr34W6n7Et\\\"\\n }, {\\n \\\"external_urls\\\" : {\\n \\\"spotify\\\" : \\\"https://open.spotify.com/artist/14L5rpGTLVUz1pD8fUeJB1\\\"\\n },\\n \\\"href\\\" : \\\"https://api.spotify.com/v1/artists/14L5rpGTLVUz1pD8fUeJB1\\\",\\n \\\"id\\\" : \\\"14L5rpGTLVUz1pD8fUeJB1\\\",\\n \\\"name\\\" : \\\"Eliza Doolittle\\\",\\n \\\"type\\\" : \\\"artist\\\",\\n \\\"uri\\\" : \\\"spotify:artist:14L5rpGTLVUz1pD8fUeJB1\\\"\\n }, {\\n \\\"external_urls\\\" : {\\n \\\"spotify\\\" : \\\"https://open.spotify.com/artist/6nxWCVXbOlEVRexSbLsTer\\\"\\n },\\n \\\"href\\\" : \\\"https://api.spotify.com/v1/artists/6nxWCVXbOlEVRexSbLsTer\\\",\\n \\\"id\\\" : \\\"6nxWCVXbOlEVRexSbLsTer\\\",\\n \\\"name\\\" : \\\"Flume\\\",\\n \\\"type\\\" : \\\"artist\\\",\\n \\\"uri\\\" : \\\"spotify:artist:6nxWCVXbOlEVRexSbLsTer\\\"\\n } ],\\n \\\"available_markets\\\" : [ \\\"AD\\\", \\\"AE\\\", \\\"AG\\\", \\\"AL\\\", \\\"AM\\\", \\\"AO\\\", \\\"AR\\\", \\\"AT\\\", \\\"AU\\\", \\\"AZ\\\", \\\"BA\\\", \\\"BB\\\", \\\"BD\\\", \\\"BE\\\", \\\"BF\\\", \\\"BG\\\", \\\"BH\\\", \\\"BI\\\", \\\"BJ\\\", \\\"BN\\\", \\\"BO\\\", \\\"BR\\\", \\\"BS\\\", \\\"BT\\\", \\\"BW\\\", \\\"BY\\\", \\\"BZ\\\", \\\"CD\\\", \\\"CG\\\", \\\"CH\\\", \\\"CI\\\", \\\"CL\\\", \\\"CM\\\", \\\"CO\\\", \\\"CR\\\", \\\"CV\\\", \\\"CW\\\", \\\"CY\\\", \\\"CZ\\\", \\\"DE\\\", \\\"DJ\\\", \\\"DK\\\", \\\"DM\\\", \\\"DO\\\", \\\"DZ\\\", \\\"EC\\\", \\\"EE\\\", \\\"EG\\\", \\\"ES\\\", \\\"FI\\\", \\\"FJ\\\", \\\"FM\\\", \\\"FR\\\", \\\"GA\\\", \\\"GB\\\", \\\"GD\\\", \\\"GE\\\", \\\"GH\\\", \\\"GM\\\", \\\"GN\\\", \\\"GQ\\\", \\\"GR\\\", \\\"GT\\\", \\\"GW\\\", \\\"GY\\\", \\\"HK\\\", \\\"HN\\\", \\\"HR\\\", \\\"HT\\\", \\\"HU\\\", \\\"ID\\\", \\\"IE\\\", \\\"IL\\\", \\\"IN\\\", \\\"IQ\\\", \\\"IS\\\", \\\"IT\\\", \\\"JM\\\", \\\"JO\\\", \\\"JP\\\", \\\"KE\\\", \\\"KG\\\", \\\"KH\\\", \\\"KI\\\", \\\"KM\\\", \\\"KN\\\", \\\"KR\\\", \\\"KW\\\", \\\"KZ\\\", \\\"LA\\\", \\\"LB\\\", \\\"LC\\\", \\\"LI\\\", \\\"LK\\\", \\\"LR\\\", \\\"LS\\\", \\\"LT\\\", \\\"LU\\\", \\\"LV\\\", \\\"LY\\\", \\\"MA\\\", \\\"MC\\\", \\\"MD\\\", \\\"ME\\\", \\\"MG\\\", \\\"MH\\\", \\\"MK\\\", \\\"ML\\\", \\\"MN\\\", \\\"MO\\\", \\\"MR\\\", \\\"MT\\\", \\\"MU\\\", \\\"MV\\\", \\\"MW\\\", \\\"MX\\\", \\\"MY\\\", \\\"MZ\\\", \\\"NA\\\", \\\"NE\\\", \\\"NG\\\", \\\"NI\\\", \\\"NL\\\", \\\"NO\\\", \\\"NP\\\", \\\"NR\\\", \\\"NZ\\\", \\\"OM\\\", \\\"PA\\\", \\\"PE\\\", \\\"PG\\\", \\\"PH\\\", \\\"PK\\\", \\\"PL\\\", \\\"PS\\\", \\\"PT\\\", \\\"PW\\\", \\\"PY\\\", \\\"QA\\\", \\\"RO\\\", \\\"RS\\\", \\\"RU\\\", \\\"RW\\\", \\\"SA\\\", \\\"SB\\\", \\\"SC\\\", \\\"SE\\\", \\\"SG\\\", \\\"SI\\\", \\\"SK\\\", \\\"SL\\\", \\\"SM\\\", \\\"SN\\\", \\\"SR\\\", \\\"ST\\\", \\\"SV\\\", \\\"SZ\\\", \\\"TD\\\", \\\"TG\\\", \\\"TH\\\", \\\"TJ\\\", \\\"TL\\\", \\\"TN\\\", \\\"TO\\\", \\\"TR\\\", \\\"TT\\\", \\\"TV\\\", \\\"TW\\\", \\\"TZ\\\", \\\"UA\\\", \\\"UG\\\", \\\"UY\\\", \\\"UZ\\\", \\\"VC\\\", \\\"VE\\\", \\\"VN\\\", \\\"VU\\\", \\\"WS\\\", \\\"XK\\\", \\\"ZA\\\", \\\"ZM\\\", \\\"ZW\\\" ],\\n \\\"disc_number\\\" : 1,\\n \\\"duration_ms\\\" : 282812,\\n \\\"explicit\\\" : false,\\n \\\"external_ids\\\" : {\\n \\\"isrc\\\" : \\\"GBUM71303827\\\"\\n },\\n \\\"external_urls\\\" : {\\n \\\"spotify\\\" : \\\"https://open.spotify.com/track/3W2ZcrRsInZbjWylOi6KhZ\\\"\\n },\\n \\\"href\\\" : \\\"https://api.spotify.com/v1/tracks/3W2ZcrRsInZbjWylOi6KhZ\\\",\\n \\\"id\\\" : \\\"3W2ZcrRsInZbjWylOi6KhZ\\\",\\n \\\"is_local\\\" : false,\\n \\\"name\\\" : \\\"You & Me - Flume Remix\\\",\\n \\\"popularity\\\" : 76,\\n \\\"preview_url\\\" : \\\"https://p.scdn.co/mp3-preview/c05c8ea6de99d9a85b3614c0d45c47c8b9b41611?cid=2c1ea588dfbc4a989e2426f8385297c3\\\",\\n \\\"track_number\\\" : 34,\\n \\\"type\\\" : \\\"track\\\",\\n \\\"uri\\\" : \\\"spotify:track:3W2ZcrRsInZbjWylOi6KhZ\\\"\\n },\\n \\\"currently_playing_type\\\" : \\\"track\\\",\\n \\\"actions\\\" : {\\n \\\"disallows\\\" : {\\n \\\"skipping_prev\\\" : true,\\n \\\"toggling_repeat_track\\\" : true\\n }\\n },\\n \\\"is_playing\\\" : true\\n}\"]" })

Rspotify has just added this "collection" variant: https://github.com/ramsayleung/rspotify/pull/306

However, the current release of Rspotify breaks compatibility with the currently used version.

This phenomenon btw also applies to the other methods with similar implementations - such as the volume property, which always returns the default value of 0.

BTW, this issue does not affect metadata which is fetched for the properties changed notifications because it used a different method. instead of requesting information of the currently playing track, it uses the track_id provided by librespot PlayerEvent to fetch metadata for this particular track id.

It would be great if a new version of Rspotify would be implemented.

NNEU-1 avatar Mar 13 '22 16:03 NNEU-1

So rspotify is now on the newest version, can anyone confirm or deny that this problem does no longer occur?

eladyn avatar Sep 09 '22 14:09 eladyn

For me it works fine now.

bartlibert avatar Sep 09 '22 16:09 bartlibert

Thanks for the feedback, going to close this. If anyone runs into this problem again, feel free to reopen!

eladyn avatar Sep 09 '22 16:09 eladyn