husk.org / blog. chaff. occasional witterings.

2009-02-01

iPhoto '09, Scripting, and Flickr

computing 17:05:00

Another year, another release of iPhoto. This time, though, I was particularly interested, since two of its three headline features - Flickr integration and maps - tickled my fancy. (We'll see how much I care about Faces, but I tend not to take photos of people all that often, so it's perhaps not much use to me.)

In particular, the promise of two-way Flickr sync was too good to pass up. A year or so ago I made a bit of an effort to work towards this, but I never managed to get it to a state I could use. However, I always suspected that getting iPhoto to know about past photos would be impossible, and it seems from Fraser Speirs post on iPhoto's Flickr integration that I was right.

However, I still thought it was worth an attempt at having a look. My first investigative step was to set up a Flickr album and get some photos into it. Then I opened up Script Editor, and, as Fraser Speirs reported, found the "publised album" type of an album was the only indication you can get from AppleScript that photos are shared, and it's a read-only property, as is the URL that the album is published at.

This means that photos don't have any indication that they're on Flickr at all, and there's no way to find the URL or ID of a particular image. The two-way sync on a published album means that adding a photo in iPhoto creates a new image in Flickr, while adding an existing photo to a set that's been created by iPhoto will cause it to download the original, making a duplicate in your library.

On the wider note, AppleScript has seen no changes that I noticed in the new version. Photos now have faces, places and descriptions; none of them are exposed via the scripting interface. It's also still impossible to assign a keyword via Apple Events unless it already exists in iPhoto, which is deeply annoying (especially given you can in the regular UI).

So, there's no way to retrofit Flickr photos? Well, probably. The one possibility I can see is that iPhoto now uses SQLite (and maybe Core Data?) for its database, so you can open it up and have a look. There are some promising avenues there - there's an SgPublishedAlbum table, containing persistentPhotoData - but first I'll need to figure out how (indeed, if) it's possible to take the binary data stored there and read it, let alone write it. (This avenue might also let me add keywords easily: they're stored in their own SQLite table.)

Ah well. If Apple were perfect, what would we all have to write about?

navigation.