Chibimagic's Weblog

AppleScript ♥ iTunes podcasts

Posted on: March 11, 2009

I have a smart playlist in iTunes called “(Podcasts)” that contains all the podcasts I have not yet listened to. I have a preferred podcast listening order: Mac OS Ken, Apple/Mac podcasts, technology podcasts, news podcasts, tips podcasts, language podcasts, and general interest/trivia podcasts. I realized I was spending way too much time reordering the podcasts, so I wanted to write an AppleScript that sets the order automatically. To set the order:

set theOrder to (every track in playlist "(Podcasts)" whose (album is "Mac OS Ken"))
set theOrder to theOrder & (every track in playlist "(Podcasts)" whose (album is [Apple/Mac Podcast 1]) or (album is [Apple/Mac Podcast 2]) or ... (album is [Apple/Mac Podcast n]))
...
set theOrder to theOrder & (every track in playlist "(Podcasts)" whose (album is [Trivia Podcast 1]) or (album is [Trivia Podcast 2]) or ... (album is [Trivia Podcast n]))

where [something] is the name of a specific podcast. For a regular playlist, you could:

repeat with aTrack in theOrder
duplicate aTrack to playlist "(Podcasts)"
delete aTrack
end repeat

This works because everything in theOrder will be a reference to the specific track in the specific playlist, not the track in your general music library. However, you can’t manually add things to a live-updating smart playlist. So, I wrote the order to the track number instead. Since podcasts are just normal mp3 files and I don’t care about them after they’ve been played, I don’t mind changing the metadata:

set i to 1
repeat with aTrack in theOrder
set track number of aTrack to i
set i to i + 1
end repeat

Set the playlist to autosort by track, and I’m just an applescript away from a perfectly sorted playlist! ♥ @ AppleScript!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


  • None
  • Marketing Consultant: You're an great writer. You have brought up some really interesting insights. Just wanted to say fantastic blogs! I know tons of people see your write
  • optical franchise opportunities: Right now it looks like Wordpress is the preferred blogging platform out there right now. (from what I've read) Is that what you are using on your blo
  • startup speaker: Interesting content. A magnificent article. It is very informative and you are obviously very knowledgeable in this area.

Categories

%d bloggers like this: