I want to write a small web app which does this things:
No big deal, the only part I can't estimate is if it's possible to access the current song of iTunes, TRAKTOR and if possible Cog from a ruby on rails application.
It would be especially nice if I can access the playlist, too to display the following song, too.
I would use applescript via the command-line. I don't have Traktor Pro or Coq, but you can look at what objects are available via the AppleScript Dictionary viewer in OS X's Script Editor. For iTunes, the command would be:
osascript -e 'tell application "iTunes" to get name of current track'
osascript -e 'tell application "iTunes" to get name of every track of current playlist'
You would execute the command from your rails app (which would need to be running as your user account) like this:
def show
@current_track = `osascript -e 'tell application "iTunes" to get name of current track'`
end
...
<h1>The current track is: <%= @current_track -%></h1>