Mac::iTunes

Last night I got my own hand-rolled version of the same kind of script that Adam Curry did with his iPodder AppleScript. Here’s how mine is different – it is in Perl, and uses LWP::Simple, XML::Simple, and Mac::Applescript to get files, parse them, and then control iTunes. The biggest difference is that I keep a cache file that has a record of which enclosure URLs have been downloaded and when. That way, if you delete a file after having downloaded it and listened to, it will not be downloaded again. It also uses the LWP::Simple “mirror” function, so even if you delete your cache and rerun everything such that the cache file doesn’t exist but the data file does, it will not be redownloaded unless the timestamps or file size on the server is different that your copy. That solves the thing that bugs me most about iPodder – the fact that iTunes keeps being reset to an exact mirror of the RSS feed. Delete it all, and the next time the script runs it all comes back. I set my script up on cron, so we’ll see if I catch my audioblog post from a few minutes ago. The next run is at 6 PM, so it should automatically show up in my playlist then.

Last night as I was trying to hack this script together, I was installing a number of Perl modules with CPAN on this iBook. I installed a few myself, and maybe 30 or so that were prerequistes for other modules. One and only one had problems, and that was Mac::iTunes. This module is written by Brian D Foy, who is a fairly big name in the Perl community. He edits Perl writings and has a high profile. I’m surprised that the module he authored and is up on CPAN gaks so competely and totally on this system. A bunch of the tests failed – like 25% of them – and the module wouldn’t have installed except with the “ignore failed tests, force install anyway” option. You kind of expect better from the big names, especially considering that I had been installing modules all night and didn’t have failure one from any of them. As the kids say, “what’s up with that?”