diff options
-rw-r--r-- | nephilim/plugins/Songinfo.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/nephilim/plugins/Songinfo.py b/nephilim/plugins/Songinfo.py index 4c1e126..c2dbf76 100644 --- a/nephilim/plugins/Songinfo.py +++ b/nephilim/plugins/Songinfo.py @@ -65,8 +65,11 @@ class Songinfo(Plugin): metadata = {} song = self.mpclient.current_song() + if not song: + return self.o.clear() + for tag in self.__tags: - metadata[tag] = song[str(tag)] if song else '' #XXX i don't like the explicit conversion to python string + metadata[tag] = song[tag] if tag in song else '' self.o.set_metadata(metadata) class SonginfoWidget(QtGui.QWidget): @@ -108,6 +111,11 @@ class SonginfoWidget(QtGui.QWidget): for tag in metadata: self.__labels[tag].setText(metadata[tag]) + def clear(self): + """ Clear displayed metadata. """ + for label in self.__labels.values(): + label.clear() + class SettingsWidgetSonginfo(Plugin.SettingsWidget): # private taglist = None |