Commission Music

Commission Music
Bespoke Noise!!

Monday, 2 August 2004

Script for Photo Feed

My script isn't in great shape, but it appears to be working now, so I'm posting it for your perusal. The first part of it uses a bit of perl to look for the </html> tag and add above it an <address> section which links back to my blog. I could use all sorts of pattern matching to change the HTML pages generated by iphoto, but I mostly want a link. there doesn't seem to be a way to modify the template that iphoto uses. The next part of the script creates the XML feed. The script takes as an argument the number of the first new photo. If you add new photos starting from 1036, then it will create a link to that photo, whose number you supplied as an argument. Iphoto counts from zero, so 1 is subtracted from your argument. That number is also used to generate a unique ID tage. You'll note that a whole bunch of stuff points to blogger. I dunno what that stuff does. I'm just a hacker.

If you want to use this script, you will need to edit it with your URLs instead of mine. also, before you run it the first time:

echo "</feed>" > old_atom.xml
so that the closing tag you need is there. So here is the script and the header. This is provided as-is with no warranty. It might not work for you. It works for me. Feel free to do whatever you want with it.

No comments: