WARNING: Out of Date

This code has not been modified since mid-2010, and I stopped using most of it in 2013 when I ceased regular usage of Flickr. Since then changes have doubtless occurred. For one thing, Smugmug purchased Flickr in 2018 and has likely changed things since then.

Flickr::API Scripts

A set of simple scripts using the Perl Flickr::API module that I've written to supplement the Oragnizr for managing my photos. These require that you get your own API key (free), so it is not a distributed app, but more of a sample of using the module.

Start with flickrapirc.sample, edit in your key then use flickr-getfrob and flickr-gettoken to authenticate your app. (Tip: app name on flickr is associated with the API key, not with the code for the app.)

The way I use these is to select some stuff in the Organizr and apply a temporary tag to them there, like RESETDATE, then use flickr-search to fetch the ids of those. Then I can look at the list to make sure things are right (did I forget to remove the RESETDATE tag from last time?), extract just the ids and finally process them. Example workflow:


  $ flickr-search --tsv tags RESETDATE > resetlist.txt
  ##  check resetlist.txt for accuracy
  $ cut -f 1 resetlist.txt > resetids.txt
  # the 'now-' keyword posts the photos in the order they are in the
  # file, each set 1 second earlier than the previous.
  $ flickr-posted now- resetids.txt
  ...
  $ flickr-removetag RESETDATE resetids.txt
  ...
  $ flickr-addtags newtag '"a tag with spaces"' moretags -- resetids.txt
  ...
  # settify will use the first image as the set thumbnail
  $ flickr-settify "New Set Name" resetids.txt
  ...
  $ flickr-imgmod 742 resetids.txt
  ...
  # add to 10 Million Photos
  $ flickr-addtogroup 20759249@N00 resetids.txt
flickrapirc.sample
Sample config file. Looked for as $FLICKR_API_RC, $HOME/.flickrapirc, or flickrapirc
flickr-getfrob
Starts the authentication process.
flickr-gettoken
Gets a reusable authentication token.
flickr-addtags
Add tags to images.
flickr-addtogroup
Add photos to a group.
flickr-addtoset
Add images to an existing set.
flickr-apitest
Test an API call.
flickr-collectioneditsets
Edit the sets in a collection (which sets in which order).
flickr-collectioninfo
Get information about a particular collection.
flickr-collectionremoveset
Remove a set from a collection.
flickr-cropper
Find a note with a particular message in it, then use the notes box as a crop guide. Uses several external programs.
flickr-editsetinfo
Set set metadata (name and description).
flickr-edittag
Apply a regular expression search and replace to tags.
flickr-email
Formats image for email upload. Provide your own mailer (eg, sendmail). Does not use the Flickr::API module.
flickr-getmethods
Use the getMethods method to list all methods.
flickr-imgmod
Change image permissions chmod style.
flickr-listcollections
List collections and the sets within.
flickr-listgroups
List groups subscribed to.
flickr-listsets
List your sets (id and name).
flickr-posted
Set the posted date (use to reorder images in stream).
flickr-removetag
Remove one tag at a time from an image.
flickr-renamer
Change image titles.
flickr-search
Bare bones search interface.
flickr-setimgorder
Edit the images in a set (which images in which order).
flickr-setinfo
Display set information.
flickr-setorder
Reorder sets (any sets left out get dumped at end).
flickr-settify
Create a set and put images in it.
flickr-takendate
Change the image creation date.

A couple of programs not by me.

flickr-upload
Flickr::Upload uploader script. Needs the Flickr::Upload package.
flickr-replace
Based on flickr-upload, but uses the replace image API.

Bonus: flickr-orderallsets: a shell script to reorder all sets based on how they are sorted in ouy collections. An example of using the undocumented API calls for collections.

© 2009 Eli the Bearded