Mission Accomplished

So, I was home tonight and I got my little script working in Squeak this evening.

Two things:

  1. I didn’t need to do authentication. I misread the API docs. Also, an MD5 class is available in the Cryptography package
  2. Mark Baker is right, the Flickr API could be improved. In particular, it would be a lot simpler if flickr.photoset.getPhotos returns the URLs to the photos, instead of a PhotoID.

The reason why an intermediate PhotoID step is required is because each photo can be in many different sizes. So a subsequent call to flickr.photo.getSizes is needed to get the URLs. I think it wouldn’t be a bad idea to add an optional argument to photoset.getPhotos to specify the desired photo size. That way, I only need to do 1 call instead of n + 1 calls, which takes quite a long time to run.

One thing that is really nice when working with Squeak is the automatic object persistence. As I was running my script, my home network had a hiccup and somehow the script stopped. Instead of restarting the download scratch, I was able to inspect the state of the download and add a new method to resume it.

The code is pretty crufty right now, but I might spend a little time to clean it up. Ideally, I’ll be aiming for an API like this:

FlickrClient new

  downloadSet: setID

  key: apiKey

  to: directoryName.

Leave a comment