[modules/spotify] fix song not shown issue

the previous commit accidentially removed the song display. re-add that
and also add a bit of logging for troubleshooting.
This commit is contained in:
tobi-wan-kenobi 2020-09-06 14:27:17 +02:00
parent 3a5365a2c3
commit b79c19b616

View file

@ -25,6 +25,8 @@ import core.input
import core.decorators import core.decorators
import util.format import util.format
import logging
class Module(core.module.Module): class Module(core.module.Module):
def __init__(self, config, theme): def __init__(self, config, theme):
super().__init__(config, theme, []) super().__init__(config, theme, [])
@ -63,8 +65,7 @@ class Module(core.module.Module):
} }
widget.set("state", "next") widget.set("state", "next")
elif widget_name == "spotify.song": elif widget_name == "spotify.song":
widget.set("state", "song") pass
widget.full_text(self.__song)
else: else:
raise KeyError( raise KeyError(
"The spotify module does not have a {widget_name!r} widget".format( "The spotify module does not have a {widget_name!r} widget".format(
@ -111,8 +112,12 @@ class Module(core.module.Module):
widget.set("state", "playing") widget.set("state", "playing")
else: else:
widget.set("state", "paused") widget.set("state", "paused")
elif widget.name == "spotify.song":
widget.set("state", "song")
widget.full_text(self.__song)
except Exception as e: except Exception as e:
logging.exception(e)
self.__song = "" self.__song = ""
@property @property