Help Wizard

Step 1

NEXT STEP

DBus MPRIS interface bug.

Solved!

DBus MPRIS interface bug.

Hey !

 

I'm trying to write a small Python script that checks whether Spotify is running, playing, and if it is, returns some metadata about the track that is being played. For that, I'm using the MPRIS interface.

 

I have no problem getting the metadata, but the playback status is not working.

 

Here's how I try to get it :

 

>>> import dbus
>>> bus = dbus.SessionBus()
>>> spotify_bus = bus.get_object("org.mpris.MediaPlayer2.spotify", "/org/mpris/MediaPlayer2")
>>> properties_interface = dbus.Interface(spotify_bus, 'org.freedesktop.DBus.Properties')
>>> properties_interface.Get('org.mpris.MediaPlayer2.Player', 'PlaybackStatus')

 

The same technique works fine with VLC or to get the metadata, for instance (replacing the appropriate arguments and names of course). I've also seen plenty of code snippets around the web that match what I do. So I'm pretty sure my code is fine.

 

Except it returns this :

 

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.5/site-packages/dbus/proxies.py", line 145, in __call__
    **keywords)
  File "/usr/lib/python3.5/site-packages/dbus/connection.py", line 651, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: 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.

 

And if I launch spotify in a terminal, I get a warning :

 

(spotify:22655): GLib-GIO-WARNING **: Value returned from property 'Get' call for 'PlaybackStatus' should be 's' but is 'a{sv}'

 

This happens using Python 3.5.1 and spotify 1.0.19.106.gb8a7150f.

 

 

I'm hoping someone might shed some light on what's happenning, suggest a solution or workaround, or that the devs might get wind of it and fix it in a (hopefully) not too distant future.

 

Thanks.

Reply

Accepted Solutions
Marked as solution

This is a known bug and it have been known for at least six versions so it might be fixed someday but so far it haven't been.

View solution in original post

2 Replies
Marked as solution

This is a known bug and it have been known for at least six versions so it might be fixed someday but so far it haven't been.

Well, at least it confirms that I can't do a thing about it. I'll find another way to do what I want until this is fixed. Thanks.

Suggested posts