diff -urP empty/__init__.py xterm/__init__.py --- empty/__init__.py 1969-12-31 19:00:00.000000000 -0500 +++ xterm/__init__.py 2005-05-12 10:18:00.000000000 -0400 @@ -0,0 +1,3 @@ +import xterm +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-12 10:18:48.000000000 -0400 @@ -0,0 +1,16 @@ +import events, plugin, config, sys, item, os, re + +class xtermconfig(config.configsection): + songformat = config.configstring('%(artist)s - %(title)s') + term = os.getenv('TERM') + termre = re.compile('(screen|xterm-*)') + +class xtermplugin(plugin.plugin): + def start(self): + self.channel.subscribe(events.playbackinfochanged, self.playbackinfochanged) + + def playbackinfochanged(self, event): + if event.playbackinfo and self.config.termre.match(self.config.term): + sys.stdout.write('\033]0;' + (event.playbackinfo.iscrossfading() and "-> " or "") + item.song.format(event.playbackinfo.song, self.config.songformat) + '\007') + +# vim:ts=4:sw=4