Podcast Management Scripts for iTunes
This page contains scripts designed to help you manage your iTunes podcast subscriptions, right from your iPod, without having to remember which episode of a given podcast you wanted to delete or save for later. The recommended version requires iTunes 4.9; however, an older version of the script is still available for those using iTunes 4.8 or earlier. Both versions require an Apple computer running OS X, and have been tested on a 12-inch PowerBook running OS X 10.3.
Contents
- Background
- Expire Podcasts 2.0 (Recommended; requires iTunes 4.9 or later.)
- Expire Podcasts 1.0 (For iTunes 4.8 and earlier)
- Technical Notes
- FAQ
Background
With iTunes version 4.9, Apple has integrated support for podcasts into its popular digital jukebox and music store. Right out of the box, the podcast functionality is impressive: you can drag RSS feeds from Safari into iTunes to subscribe or browse a huge directory of podcasts right in iTunes; schedule hourly, daily, or weekly updates; automatically download all episodes or just the most recent one; and synchronize only the podcasts you specify to your iPod. Additionally, you can set iTunes to keep only the most recent few episodes, or to delete episodes after you’ve listened to them.
This last feature was particularly interesting to me, because when I first started listening to podcasts I wrote a script to manage podcasts in a similar way. The difference is that in addition to play count, my script used ratings to determine whether I wanted to keep or delete an episode. I used this feature a lot with, for example, the IT Conversations podcast, of which some episodes fascinated me to no end and others bored me to tears.
iTunes 4.9 has the play count part of that script built in, but not the ratings-based management part. I decided to fix that.
Expire Podcasts version 2.0
This script checks your podcast subscription list in iTunes 4.9 or greater and decides what files to delete or keep based on a combination of play count and ratings. Any podcast episode with a rating of five stars will be kept regardless of play count, and any episode with a rating of one star will be deleted regardless of play count; any episode with no rating or a rating of 2-4 stars will be deleted if its play count is greater than one.
Play count should be automatically incremented any time you reach the end of a track in iTunes or on your iPod. Rating can be set in several places in iTunes, or on any iPod with a screen (i.e., not the iPod shuffle) by pushing the center select button twice and then using the wheel to choose a number of stars.
When using this script, be sure that iTunes is set to “Keep all episodes” in the podcast preferences. This is a complete replacement for the built-in management in iTunes 4.9.
To install: drop the script into ~/Library/iTunes/Scripts (creating this folder if it isn’t already there) and restart iTunes.
Download (4.85KB)
Expire Podcasts version 1.0
This version works exactly like the one above, but instead of looking in the special Podcasts database introduced in iTunes 4.9, it finds its tracks in a user-defined playlist called “Podcasts”. I used it with NetNewsWire, which has the ability to automatically download podcasts and sync them to an iTunes playlist. It still works with iTunes 4.9, but only if your podcasts are in a user-defined playlist, and only if those podcasts are not downloaded by iTunes itself (see the Technical Notes for more on this). Anything synced from an external application or added by hand and residing in a user playlist called “Podcasts” should be recognized by this script. Personally, I highly recommend using iTunes 4.9’s built-in podcast support, but if you’re stuck with a previous version, this is the way to go.
Download (4.17KB)
Technical Notes
I learned a few interesting things while upgrading this script to support iTunes 4.9. For example, in the original version, deleting a track meant removing it from library playlist 1 (which also removed it from any other playlists of which it was a member) and then telling the Finder to delete the physical file. That didn’t work in the new version, because podcasts aren’t members of library playlist 1. Previously, this playlist was the master list of all tracks managed by iTunes, but now podcasts appear to have their own separate database.
I think the reason for this is that the database structure for podcasts is necessarily more complex, because Apple added some really cool features to iTunes podcast subscriptions. Most of these changes are obvious from the layout of the podcast source window, such as:
- Each podcast subscription is actually a container holding several episode files and information about the feed.
- The container as well as each individual episode can carry a text description independent of the file’s ID3 tag.
- An arrow beside the subscription name takes you to the main web site for that podcast.
- Episodes listed in the RSS feed exist in the database even if that particular episode hasn’t been downloaded.
Another cool feature that I didn’t notice at first is that with iTunes 4.9 and a relatively recent iPod, all podcasts are bookmarkable. Previously this was only possible with AAC-encoded podcasts with a file extension of
.m4a(and maybe Windows Media files, but those don’t work natively with iTunes and iPods), but now even plain MP3 files can be picked up wherever you left off. This is extremely useful for some of the longer podcasts out there. I’m willing to bet this feature was the main reason behind putting podcasts into their own database, since bookmarks would be an annoyance in most music tracks but are a nearly essential feature for podcasts. Unfortunately, the bookmark feature doesn’t seem to work with older iPods or with the iPod shuffle; only iPods with color screens, iPods with the newer click wheel, and iPod minis will handle bookmarks … which means I’m going to have to upgrade. I’m sure it’s no coincidence that the iPod line got a price drop and a lineup simplification the day iTunes 4.9 was released.Older iPods still work with iTunes 4.9, of course; they just don’t get a separate database with bookmark capability for podcasts. Podcasts synced to my third-generation iPod are accessible by genre, under “Podcast”.
Some minor niggles: if there’s a way to access bookmark position from AppleScript, or even a boolean value specifying whether or not there is a bookmark in place, I don’t see it. I also can’t find a way to trigger an RSS feed update via AppleScript. Maybe in a future version.
FAQ
Currently only one question qualifies as “frequently asked”:
Is there a way to incorporate this functionality into iTunes for Windows?
Not that I’m aware of, and to be honest, I’m not particularly motivated to find one. If you know of one, please let me know by email: nicholas [at] acetylene [dot] net. I’ll link to it from here for the benefit of future travelers.
