Python module for MOC

Forums:

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: http://pypi.python.org/pypi/MOC
Documentation is in the README file, but if something is missing, feel free to ask me.

It comes with two examples I use everyday:
- lastfmoc.py submits song information to last.fm (via lastfmsubmitd).
- mocstat.py uses dzen2 to show "currently playing" information on the desktop.
This is how it looks for me: http://666kb.com/i/b240g3zy7me5h89i9.png

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?