Patti (whipartist) wrote,
Patti
whipartist

I am a geek

I am a geek, and when I get ass-deep in code nothing is going to stop me... not even a need for sleep.

The thing is this... I have a shit-ton of images on Flickr. Unfortunately, I've forgotten to put artist/copyright information into the tags in the files. I want to add that info to the existing images, but I don't want to have to do 1262 images by hand.

Enter the Flickr API. I whipped up a python script that would find an image, suck down the full-size original, edit the exif tags to add artist/copyright information, then replace the original image with the newly-edited one. This required working in a language that I'm barely familiar with, using an API that I'm even less familiar with, and hunting down just the right tool for editing exif information in images.

The code I have no is ugly but it works. I need to tidy it up, then wrap something around it that walks through a set and fixes up each of the images. That's the easy part, though, and it can wait 'til later. I got the meaty part of the project solved.

Back when I was in college and writing tons of code, I'd get buried in a project and not come up for air for hours. Often I'd start coding early in the evening, then take a break for a White Castle run around 4 a.m. I kinda miss that level of focus.


As an aside, I've always hated API documentation. It's nearly always organized in a reference format rather than a task-oriented one. If you already know your way around the API, and you just need to check the details of something, that works really well. However, if you're coming into an API cold it's usually a bitch to deal with, because you have no idea where to start or how to put it all together. Examples help tremendously, though they're often not much more helpful than the rest of the muck.

For example, here are the Flickr calls for dealing with photos:

* flickr.photos.addTags
* flickr.photos.delete
* flickr.photos.getAllContexts
* flickr.photos.getContactsPhotos
* flickr.photos.getContactsPublicPhotos
* flickr.photos.getContext
* flickr.photos.getCounts
* flickr.photos.getExif
* flickr.photos.getFavorites
* flickr.photos.getInfo
* flickr.photos.getNotInSet
* flickr.photos.getPerms
* flickr.photos.getRecent
* flickr.photos.getSizes
* flickr.photos.getUntagged
* flickr.photos.getWithGeoData
* flickr.photos.getWithoutGeoData
* flickr.photos.recentlyUpdated
* flickr.photos.removeTag
* flickr.photos.search
* flickr.photos.setContentType
* flickr.photos.setDates
* flickr.photos.setMeta
* flickr.photos.setPerms
* flickr.photos.setSafetyLevel
* flickr.photos.setTags

Quick, off the top of your head. If you want to download a specific photo, what do you do? Grabbing a particular image seems like a really common thing to want to do, and yet the method for doing so is entirely non-obvious. Yes, I figured it out, but that required me to make a couple of educated guesses and then read through the XML sample responses to see if I was right.
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 4 comments