I’m looking for some functionality within either AppleScript, Cocoa, or Carbon that will allow me to do some event handling for iTunes. Essentially, I would like to know when iTunes plays or stops so that I can use iTunes as a front-end for music on my linux machine. I have gone through the iTunes dictionary, as well as the Python module generated by gensuitemodule.py in MacPython, but haven’t found anything. I know that there must be some sort of a message/event because iTunes has to let the visualizer know when it starts or stops. Running AE Monitor has not provided any information either.
In short: is there an equivalent to OnPlayerPlayEvent and OnPlayerStopEvent from the iTunes COM SDK for Windows? I’ve looked at some scripts that have similar behavior (activation on play/stop) but these seem to sample the iTunes player status at some interval, which seems like a very inefficient way of doing it.