summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nephilim/plugins/Songinfo.py44
-rw-r--r--nephilim/plugins/__init__.py2
2 files changed, 45 insertions, 1 deletions
diff --git a/nephilim/plugins/Songinfo.py b/nephilim/plugins/Songinfo.py
new file mode 100644
index 0000000..84ed8cc
--- /dev/null
+++ b/nephilim/plugins/Songinfo.py
@@ -0,0 +1,44 @@
+from PyQt4 import QtGui, QtCore
+
+from ..plugin import Plugin
+
+class Songinfo(Plugin):
+ o = None
+ def _load(self):
+ self.o = SonginfoWidget(self)
+
+ def _unload(self):
+ self.o = None
+
+ def info(self):
+ return 'Provides information about a song.'
+
+ def _get_dock_widget(self):
+ return self._create_dock(self.o)
+
+
+class SonginfoWidget(QtGui.QWidget):
+ plugin = None
+ labels = {}
+
+ def __init__(self, plugin):
+ QtGui.QWidget.__init__(self)
+ self.plugin = plugin
+
+ self.setLayout(QtGui.QVBoxLayout())
+
+ for item in 'track', 'title', 'album', 'disc', 'artist', 'composer', 'date', 'genre', 'file':
+ self.labels[item] = QtGui.QLabel('<b>%s</b>:'%item)
+ self.labels[item].setWordWrap(True)
+ self.layout().addWidget(self.labels[item])
+
+ self.connect(self.plugin.mpclient(), QtCore.SIGNAL('song_changed'), self.on_song_change)
+
+ def on_song_change(self):
+ song = self.plugin.mpclient().current_song()
+ if not song:
+ for item in self.labels:
+ self.labels[item].setText('<b>%s</b>:'%item)
+
+ for item in self.labels:
+ self.labels[item].setText('<b>%s</b>: %s'%(item, unicode(song.tag(item))))
diff --git a/nephilim/plugins/__init__.py b/nephilim/plugins/__init__.py
index 84aa2e5..0d33fce 100644
--- a/nephilim/plugins/__init__.py
+++ b/nephilim/plugins/__init__.py
@@ -2,7 +2,7 @@ import sys
import logging
__all__ = ['AlbumCover', 'Filebrowser', 'Library', 'Lyrics', 'Notify', 'PlayControl',
- 'Playlist', 'Systray']
+ 'Playlist', 'Songinfo', 'Systray']
class Plugins:
_plugins = None