This commit is contained in:
Daniel Bauer
2017-12-12 14:50:33 +01:00
parent 938bdf3958
commit 44eedb4580
3 changed files with 8 additions and 2 deletions

View File

@@ -6,7 +6,11 @@ try:
spotify = bus.get_object("org.mpris.MediaPlayer2.spotify", "/org/mpris/MediaPlayer2")
spotify_iface = dbus.Interface(spotify, 'org.freedesktop.DBus.Properties')
props = spotify_iface.Get('org.mpris.MediaPlayer2.Player', 'Metadata')
print(str(props['xesam:artist'][0]) + " - " + str(props['xesam:title']))
try:
out = str(props['xesam:artist'][0]) + " - " + str(props['xesam:title'])
except IndexError:
out = ''
print(out)
exit
except dbus.exceptions.DBusException:
exit