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"
updateAllPodcasts
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.

2 comments:

Shawn Levasseur said...

"Tunes 8 let users set the refresh frequency (and other attributes) on a per-podcast basis. "

Actually, you can't set the refresh rate on a per podcast basis. In the "Podcast Settings" window, the "Check for new episodes" setting is the only setting that is global only. This is why it sits above the "Settings for:" menu, while the other settings which are capable of being set on a per podcast basis sit below that menu.

As to why one would want to check podcasts hourly?

Well, I subscribe to CNN News Update. A new version is posted every hour.

I have it's custom setting to have the most recent episode download, and only keep the latest episode. Along with hourly updating, I'm always assured of having the latest (or at worst the next-to-latest) edition of the news when I go to listen to it.

Though I've gotten tired of having iTunes check hourly, as there's times I'm on a slow connection when I don't want podcast downloads bogging things down.

Which is what brought me here to this post, as I was looking for an applescript that I could use to activate refreshes on my own schedule (using Quickeys as the agent to trigger the applescript)

So thanks for posting this.

Cain said...

Thank you soo much for this info, it has been a god send. I just hooked it up in Snow Leopard and iTunes 9.

I still can't believe the option isn't in iTunes or Automator.

Thanx again