get_enclosures.pl

Normally I’m pretty spastic about releasing unpolished code. I tend to want to hang onto it until I’m proud enough of it to let it out in the wild. I’m making an exception for this thing, my Perl equivalent of Adam Curry’s iPodder AppleScript. You should only download this if you are comfortable running Perl from the command line. If you don’t know what that means, this is not for you I am afraid. For those who can handle that, and who don’t have a problem installing CPAN modules, I present my script get_enclosures.pl.

Read the beginning comments inside that script to get the basics of how to use this. I include a paste of the crontab entry I use to automate this thing firing off twice a day. Anyone can take this and do anything with this. I only ask that if you improve it, please send me a copy of your changes so that I too can benefit from your expertise. As I say, I’m not being a control freak perfectionist and waiting until it is perfect to let it ride. We’re all sharing first drafts here, so keep that perspective in mind as you look at it (ie, don’t judge me harshly by this – this is a unique situation and not indicative of my standard work product.)

Update: As Adam pointed out, the download was boned. I had to zip it up, otherwise my web server was trying to execute the file rather than just serve it out as text. Whoops. Since I’m zipping it up now anyway, I went ahead and included my feeds.txt in there as well.

Update #2: For all of you coming from Adam’s site or anyone that has downloaded this previously, see this post about how to subscribe to the get_enclosure specific feed to keep up with developments (no pun intended.) 0.1 is now available.

4 Replies to “get_enclosures.pl”

  1. I should know better. Once it gets this late, trying to do things like this only cause problems. Now that I zipped it up, it works. Just having the raw .pl file made the web server try to run it rather than send it. Since I had to zip it up anyway, I went ahead and stuck my subscription list in there. Now anyone who has the modules installed can just download it, cd to that directory and run it from the command line and it should work.

  2. It works fine on linux after commenting out the Mac specific lines:

    use Mac::AppleScript qw(RunAppleScript);
    create_playlist($title);
    add_to_playlist($title, $url_file);

    This leaves the .mp3 files on my linux box (either manually running the script or via cron) for manual transfer to iPod via Windows box.

    That’s still a whole lot easier than manually scanning around for those files.

  3. Gordon, Thanks for the feedback. I just realized that if I do an eval or something around the “use Mac::AppleScript” line, I can set a flag based on whether that succeeded or not. If yes, then we are in an AppleScript environment. If not, don’t do any of those calls. If I do it this way, then no one has to comment out anything, it will just work whereever. Thanks for the great idea! I hadn’t even thought beyond the Mac platform, but it would be very little work to make this play nicely for everyone.

Comments are closed.