Weblog Navigation

First Previous Index Next Last

I'm a l33t IRC h4x0r now

Sunday, March 9th, 2003

So I was chatting on IRC, and everybody's got these script things that automatically send the title and artist of whatever MP3 they're currently listening to into the IRC channel for everybody else to see. Not wanting to be left out, I started thinking: how might I get that to work myself, grabbing the ID3 info from the currently playing song in iTunes and making it show up in xchat?

So I started poking around, and came up with a very simple solution. When I type /mp3 it sends something like

[iTunes] Beethoven - Symphony #9 - Adagio molto e cantabile

To set this up, in xchat, go to Settings, User Commands, click the Add New button, on the left side type “mp3” and on the right side enter this (all on one line):

/exec -o osascript -e 'tell application "iTunes" to return "[iTunes] " & artist of current track & " - " & album of current track & " - " & name of current track' 2>/dev/null

If you know anything about AppleScript, it should be fairly easy to understand this. The 2>/dev/null redirects STERR to /dev/null so it won't display any errors, since for some reason Component Manager always complains about finding symbols or something.

It's not really THAT cool, but I was pretty impressed that I figured out how to do this without too much trouble. Mac OS X is pretty neat.


Weblog Navigation

First Previous Index Next Last