Amarok 2 Now Playing script for XChat

This is a simple Python script for XChat which gets the current Amarok 2 playing track information and posts it. Formatting of the output can easily be edited in the source, and it will also link to a last.fm account if supplied.
It will also print to stdout if XChat is not in use, and can be used with /exec commands in other clients.
This code is released into the public domain.
Comments, bugs, etc may be addressed to Sentynel in #amarok on FreeNode, or emailed to amarok _at_ sentynel _dot_ com.

Usage

You will need the Python plugin for XChat, which should be packaged by default, and the python-dbus library.
Simply place the script in ~/.xchat2/ and it will be loaded automatically on XChat start. Type /playing to post the currently playing track.
To print to stdout, simply execute the script. Use in other clients with /exec -out, which can be bound, e.g. (in irssi at least) /alias np exec -out - /home/myself/xchat-nowplaying.py
The script can be downloaded here.

Valid XHTML 1.0 Transitional