Python module for MOC


I hacked together a Python module which connects to MOC via the file socket and listens for events. At the moment, it just gathers status information about the currently playing song, like artist, album, title, track, etc. It seems stable to me, but since I had to extract the client-server-communication out of the C source and I don't like C, it's actually very unstable. Additionally, I'm new to Python and this is my first code that does anything productive.

You can download it from here:
Documentation is in the README file, but if something is missing, feel free to ask me.

It comes with two examples I use everyday:
- submits song information to (via lastfmsubmitd).
- uses dzen2 to show "currently playing" information on the desktop.
This is how it looks for me:

Is there a way to only do something when something changes?
In the readme, you suggest using
<br /> for something_happens in moc:<br /> if something_happened:<br /> foo()<br />

This means foo() is called continuously, even if nothing has changed (the current song just continued playing). Is there a way to only call foo() when the song is stopped/paused/changed?