05 June 2007

The Next Aperture Script

Recently I talked about the Applescript I worked on to add extra EXIF metadata to the Aperture database. It works great for me, but a couple people that have tried it have had problems with it, mainly because they use some options in Aperture that I don't that causes problems. Most of those problems, if not all, would be solved by doing the metadata extraction at import, when I know the name of the source file and the reference to the file in the Aperture database.

The basic principle was not very hard, in fact, it came together a lot quicker than I ever would have expected. But it took a while to bring it to a state that I would want the rest of the world to see it. I can put up with some things that I am sure others wouldn't, and I had to make it easy for the end user to use it in their own way - which meant taking out all the hardcoded paths and stuff...

Then I had to get all fancy. As I have mentioned in the past, I am a big proponent of geotagging, either with a direct connection between the camera and a GPS or software that syncs GPS track logs with photos via the time stamps. Since I was working on all this metadata (thanks to exiftool) on the front-end of the import process, and I have the GPS EXIF data available, why not query the GeoNames database and write the City, State & Country IPTC tags as well?

I was all ready to write my own parser of the GeoNames, but somehow I stumbled across the Geo::GeoNames perl module on CPAN. That sure made things easy.

The perl part came together pretty fast, but the Applescript part was slower - Applescript is probably the most readable language I have ever seen, but the elegance (if you want to call it that) of it is only in the finally working code. There are seriously some major syntax gymnastics going on when I try to figure out how to put things together. I think the open-endedness of the syntax is what makes it so hard. I think that anything should work, or that what I wrote originally is just the same as what I eventually got to work.

In the end, I cobbled together something that works great for me. Yeah, there are some rough edges I would like to work on, but for now, I need to live with what I have and spend some more time with my wife.

If you are interested in learning more, or using it for your own needs, or you just want to criticize my sloppy code, you can find more info, and a download link, here.

Labels: , , ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home