diff -urP empty/__init__.py xterm/__init__.py --- empty/__init__.py 1969-12-31 19:00:00.000000000 -0500 +++ xterm/__init__.py 2005-05-11 21:30:55.000000000 -0400 @@ -0,0 +1,6 @@ +import xterm + +# A plugin package has to provide two classes: the plugin itself and its config. +# The latter has to be a subclass of config.configsection +plugin = xterm.xtermplugin +config = xterm.xtermconfig diff -urP empty/xterm.py xterm/xterm.py --- empty/xterm.py 1969-12-31 19:00:00.000000000 -0500 +++ xterm/xterm.py 2005-05-11 22:04:12.000000000 -0400 @@ -0,0 +1,14 @@ +import events, plugin, config, log, sys, item + +class xtermconfig(config.configsection): + songformat = config.configstring("%(artist)s - %(title)s") + +class xtermplugin(plugin.plugin): + def start(self): + self.channel.subscribe(events.playbackinfochanged, self.playbackinfochanged) + + def playbackinfochanged(self, event): + if event.playbackinfo is not None: + sys.stdout.write("\033]0;" + item.song.format(event.playbackinfo.song, self.config.songformat) + "\007") + +# vim:ts=4:sw=4