If, like me, you like to make yourself feel all l33t by doing a lot of system and file management on the command line, you'll have been frustrated at least once by failing to be able to add freshly-downloaded MP3s to the iTunes library (once you've salted them away in your carefully-ordered music stash, naturally) via Terminal.
Well, be frustrated no more! Here is a handy-dandy AppleScript I wrote to do just that right in the shell. It takes the path to your newly-minted MP3 folder as an argument, and here's the code:
on run named_folder
set folder_alias to POSIX file named_folder
tell application "iTunes"
add folder_alias to library playlist 1
end tell
end run
On Leopard, save this to a text file with this as the first line:
#!/usr/bin/osascript
Then chmod a+x the script to make it executable, and you can invoke this as you would any shell script:
~/scripts/addToITunesLibrary ~/Music/mp3/_purchased/Malcolm Middleton/
On pre-Leopard systems, you'll need to save it out as a regular AppleScript via Script Editor, and invoke using osascript, thusly:
Mac OS X Hints
http://hints.macworld.com/article.php?story=20080902044037850