I\'m trying to find an API to control iTunes on OS X. I found the following:
http://developer.apple.com/sdk/itunescomsdk.html
I imagine on OS X, what I need
If you are using Cocoa then I would recommend the (non-apple) framework EyeTunes.
Applescript may be your best bet though, either through calling a script directly or the ScriptingBridge framework available for Ruby, Python, and Objective C.
For the documentation, look at iTunes script dictionary (drag the iTunes icon onto the Script Editor icon).