From 59bca4426754692ff27e130052d505fe88ccd7df Mon Sep 17 00:00:00 2001 From: WORD559 Date: Mon, 20 Aug 2018 17:44:49 +0100 Subject: [PATCH] Added playback status indicator to spotify module --- bumblebee/modules/spotify.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bumblebee/modules/spotify.py b/bumblebee/modules/spotify.py index f9ffecb..dad0c26 100644 --- a/bumblebee/modules/spotify.py +++ b/bumblebee/modules/spotify.py @@ -7,7 +7,7 @@ Requires the following library: Parameters: * 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.next: Change binding for next song (default is right 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_iface = dbus.Interface(spotify, 'org.freedesktop.DBus.Properties') 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')), title=str(props.get('xesam:title')), 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: self._song = ""