Saturday, June 02, 2007

Short Attention Span Playlist

I found a cool Dashboard applet on the Cool OSX Apps site called Tunes TEXT that goes and downloads lyrics to songs when they play in iTunes and then saves them to the song file so they show up both in iTunes and on the iPod. The trick is getting all of the songs to play so it goes and downloads the lyrics and saves them, so I wrote a little AppleScript that plays each song in order.

The tricky part is that if you go too fast, the dashboard widget will crash so you need to leave the song playing for about 8 seconds to pretty consistently get the download to succeed.
tell application "iTunes"
repeat while artist of current track ≤ "Zebrahead"
delay 8
next track
end repeat
end tell

It's been running for about 6 hours now and we just passed John Butler Trio. I added the current track artist ≤ "Zebrahead" since they are the last artist in my list and when it is done, I would rather have it finish cleanly than just barf an error when it runs out of songs. I'm sure there's a better way to do it but this certainly works. It also lets me stop and restart it wherever I want since it doesn't really care where it starts, it just keeps going through the list.

While I have muted it during the run, it's kind of fun to let it play out loud - you get up to 8 seconds of each song in your library. It's also funny to watch my Windows Live Messenger blip change every 8 seconds - if you're on my messenger buddy list, you can watch the progress :)

No comments: