Saturday, November 1, 2008

Fixing iTunes 8 Podcast Refresh with AppleScript

I have a problem.[1] I am addicted to podcasts. I blame Leo Laporte whose "netcasts" were some of the first I subscribed to, and who just kept adding more shows to the TWiT network.

But that's not my real problem. My real problem is that Apple added one feature to iTunes 8 when they should have added two, or even three. iTunes 8 let users set the refresh frequency (and other attributes) on a per-podcast basis. This is a reasonable feature as far as it goes, though even daily podcasts tend to be somewhat irregular in their posting time.[2]

The problem is that while I can now tweak the individual podcasts, I can't seem to consistently apply an overall setting for the update frequency. The UI is ambiguous: the "Use Default Settings" checkbox is underneath the "Settings for:" drop down, which has a horizontal rule separating it from the "Check for new episodes:" drop down. Even worse, I can't manually enter a time or date for the update schedule. The whole point of having iTunes update my podcasts automatically is so that I don't have to get up at 5:30 AM and click the damn "Refresh" button myself, not even the first time to get the ball rolling. UI Fail.

Admittedly, a comprehensive UI for configuring various podcast options might end up looking like Cast Away from Wooden Brain Concepts.[2] That might be a bit too much for most users, but the failure of iTunes to include a simple date/time entry box seems pretty stupid.

That said, I did come up with a relatively simple solution using AppleScript and iCal. I did try it first with Automator, but it didn't give me access to podcast updating actions, and recording a "See Me Do" workflow failed because Automator was recording the name of the Podcasts "row" in iTunes and the number of podcasts. So instead of just matching on "Podcasts", it would try to match on "Podcasts (100)", which of course changed every time podcasts were added and deleted. FAIL.

The actual solution was to delve a bit into AppleScript and create the following script:

tell application "iTunes"
end tell

I saved it as an application, then created a new event in iCal which opened this application as an alarm action at 5:35 AM, repeating daily. In theory, I can now create another event to update my iPhone, and this I can do using an Automator workflow.

Now I can sleep soundly at night, knowing that I'll get all my podcast updated before I have to get up for work. At 5:45 AM.

[1] There are many other problems like it, but this one is mine.

[2] And I'm not sure I ever understood the "update hourly" setting for podcasts. Really, you really need to check every hour for something that you might not listen to for days? And if you are listening to something every hour, why isn't it just being streamed? Sounds like some OCD designer/programmed added the option for completeness only.

[3] Playing with Cast Away right now. Lots of interesting features, but nothing obvious for explicitly setting podcast update times.