[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:
Tobias Witek 2017-05-27 13:29:08 +02:00
parent 764ab2e199
commit bbe43dccf4

View file

@ -14,7 +14,6 @@ import bumblebee.engine
try:
import dbus
from dbus.exceptions import DBusException
except ImportError:
pass
@ -36,7 +35,7 @@ class Module(bumblebee.engine.Module):
spotify_iface = dbus.Interface(spotify, 'org.freedesktop.DBus.Properties')
props = spotify_iface.Get('org.mpris.MediaPlayer2.Player', 'Metadata')
self._song = (str(props['xesam:artist'][0]) + " - " + str(props['xesam:title']))
except DBusException:
except Exception:
self._song = ""
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4