diff options
author | Anton Khirnov <wyskas@gmail.com> | 2010-04-30 07:43:09 +0200 |
---|---|---|
committer | Anton Khirnov <wyskas@gmail.com> | 2010-04-30 07:43:09 +0200 |
commit | c6e0c356b0daaa51d3fcd3da4b89c89eee907b22 (patch) | |
tree | d5f3e4e18a8c17995bc44c7729f58a7d3287e219 | |
parent | 3c5c94bc0ede813d97f044c4a7cd84c53e712311 (diff) |
Songinfo: simplify setting tags.
-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 |