Sunday, 4 March 2007
An AppleScript to update podcasts and your iPod
These days nearly 100% of my iPod listening is podcasts, and iTunes’ iPod-syncing podcast support is decent but lacking in a few areas.
One issue that bugs me is that, after connecting my iPod, I must update podcasts then update the iPod again in order for the already-listened episodes to disappear from the iPod. While the play counts update on the first, automatic iPod sync, the associated action (removing the corresponding episodes) doesn’t happen until you do another podcast update.
Another issue is the update timeout—after a few days if you haven’t played an episode of a podcast, it’ll stop updating. For people like my father who abandon their iPod for months at a time (hi, Dad!) it is a great bandwidth-conserving idea, but for me, with video podcasts and a non-video iPod, I like to accumulate episodes to watch when I’m exercising at home.
One of Doug’s AppleScripts for iTunes handily solves the second issue, and I’ve written a script to deal with the first. iTunes doesn’t let you query its iPod update status, so I instead wait for iTunes to unmount the iPod. I found this script which periodically checks the iPod disk space usage, but it fails for me, probably because iSync takes a long time to often do nothing.
Embedding this bash script into AppleScript was a real pain, what with do shell script‘s many and varied limitations, as I had to remove line breaks, indentation, my use of extended globs and even the while loop, because iTunes failed to finish updating the iPod while the script was executing. I think I will be checking out the newly revived PyOSA so I can do all this in Python instead.
Download the AppleScript, unzip it and place it in ~/Library/iTunes/Scripts.
(Note: this script is only tested on my Mac with my 3G FireWire-connected iPod; it definitely won’t work if you have iPod disk mode turned on, and may not work on other configurations.)
This is a great Applescript. How would the same script work with a single playlist instead of all podcasts? I have tried editing your script without luck. I would like to be able to plug an iPod into my computer and automatically have a running applescript push a certain playlist to the iPod and then automatically eject the iPod when done (just as your script does). Thanks!
James – you have your iPod set to manually sync? I’m not sure if it’s possible to programmatically copy things to the iPod, so my script wouldn’t be easy to adapt.
(Sorry, I missed your comment while I was on vacation!)