AppleScript ♥ iTunes podcasts
March 11, 2009
chibimagic
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!
Entry Filed under: Uncategorized
Leave a Comment
Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
Trackback this post | Subscribe to comments via RSS Feed