[modules/spotify] More generic error handling
OK - I admit it: Mostly for the benefit of Travis and automated testing, which complains about the DBusException, move to a more generic exception. However, this is probably a good idea anyhow, because independently of the error, setting the song to an empty string is probably the best bet.
This commit is contained in:
parent
764ab2e199
commit
bbe43dccf4
1 changed files with 1 additions and 2 deletions
|
@ -14,7 +14,6 @@ import bumblebee.engine
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import dbus
|
import dbus
|
||||||
from dbus.exceptions import DBusException
|
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -36,7 +35,7 @@ class Module(bumblebee.engine.Module):
|
||||||
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')
|
||||||
self._song = (str(props['xesam:artist'][0]) + " - " + str(props['xesam:title']))
|
self._song = (str(props['xesam:artist'][0]) + " - " + str(props['xesam:title']))
|
||||||
except DBusException:
|
except Exception:
|
||||||
self._song = ""
|
self._song = ""
|
||||||
|
|
||||||
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
||||||
|
|
Loading…
Reference in a new issue