mirror of
https://github.com/powerline/powerline.git
synced 2025-07-23 13:55:45 +02:00
Make Spotify segment more error-proof
This commit is contained in:
parent
ca4466cd83
commit
5202807269
@ -599,14 +599,16 @@ class NowPlayingSegment(object):
|
|||||||
status = iface.Get(DBUS_IFACE_PLAYER, 'PlaybackStatus')
|
status = iface.Get(DBUS_IFACE_PLAYER, 'PlaybackStatus')
|
||||||
except dbus.exceptions.DBusException:
|
except dbus.exceptions.DBusException:
|
||||||
return
|
return
|
||||||
|
if not info:
|
||||||
|
return
|
||||||
state = self._convert_state(status)
|
state = self._convert_state(status)
|
||||||
return {
|
return {
|
||||||
'state': state,
|
'state': state,
|
||||||
'state_symbol': self.STATE_SYMBOLS.get(state),
|
'state_symbol': self.STATE_SYMBOLS.get(state),
|
||||||
'album': info['xesam:album'],
|
'album': info.get('xesam:album'),
|
||||||
'artist': info['xesam:artist'][0],
|
'artist': info.get('xesam:artist')[0],
|
||||||
'title': info['xesam:title'],
|
'title': info.get('xesam:title'),
|
||||||
'total': self._convert_seconds(info['mpris:length'] / 1e6),
|
'total': self._convert_seconds(info.get('mpris:length') / 1e6),
|
||||||
}
|
}
|
||||||
|
|
||||||
def player_rhythmbox(self):
|
def player_rhythmbox(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user