Added playback status indicator to spotify module
This commit is contained in:
parent
5239e3ecf7
commit
59bca44267
1 changed files with 4 additions and 2 deletions
|
@ -7,7 +7,7 @@ Requires the following library:
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
* spotify.format: Format string (defaults to "{artist} - {title}")
|
* spotify.format: Format string (defaults to "{artist} - {title}")
|
||||||
Available values are: {album}, {title}, {artist}, {trackNumber}
|
Available values are: {album}, {title}, {artist}, {trackNumber}, {playbackStatus}
|
||||||
* spotify.previous: Change binding for previous song (default is left click)
|
* spotify.previous: Change binding for previous song (default is left click)
|
||||||
* spotify.next: Change binding for next song (default is right click)
|
* spotify.next: Change binding for next song (default is right click)
|
||||||
* spotify.pause: Change binding for toggling pause (default is middle click)
|
* spotify.pause: Change binding for toggling pause (default is middle click)
|
||||||
|
@ -65,10 +65,12 @@ class Module(bumblebee.engine.Module):
|
||||||
spotify = bus.get_object("org.mpris.MediaPlayer2.spotify", "/org/mpris/MediaPlayer2")
|
spotify = bus.get_object("org.mpris.MediaPlayer2.spotify", "/org/mpris/MediaPlayer2")
|
||||||
spotify_iface = dbus.Interface(spotify, 'org.freedesktop.DBus.Properties')
|
spotify_iface = dbus.Interface(spotify, 'org.freedesktop.DBus.Properties')
|
||||||
props = spotify_iface.Get('org.mpris.MediaPlayer2.Player', 'Metadata')
|
props = spotify_iface.Get('org.mpris.MediaPlayer2.Player', 'Metadata')
|
||||||
|
playback_status = str(spotify_iface.Get('org.mpris.MediaPlayer2.Player', 'PlaybackStatus'))
|
||||||
self._song = self._format.format(album=str(props.get('xesam:album')),
|
self._song = self._format.format(album=str(props.get('xesam:album')),
|
||||||
title=str(props.get('xesam:title')),
|
title=str(props.get('xesam:title')),
|
||||||
artist=','.join(props.get('xesam:artist')),
|
artist=','.join(props.get('xesam:artist')),
|
||||||
trackNumber=str(props.get('xesam:trackNumber')))
|
trackNumber=str(props.get('xesam:trackNumber')),
|
||||||
|
playbackStatus=u"\u25B6" if playback_status=="Playing" else u"\u258D\u258D" if playback_status=="Paused" else "",)
|
||||||
except Exception:
|
except Exception:
|
||||||
self._song = ""
|
self._song = ""
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue