I'm trying to learn some more command line stuff lately, mostly because I think it makes me look badass -- in much the same way as smoking or bear claws makes one look badass. After the recent announcement of GoogleCL that allows you to do a bunch of Google-related stuff on the command line, I found this explanation on Lifehacker of how to upload a folder of photos to Picasa.
While Picasa looks nice, I didn't think the storage upgrade options are as good as Flickr's unlimited storage with a pro account which I'm planning to buy instead.
So I set out to see if anyone had figured out a way to upload a folder full o' fotos to Flickr using the command line. That brought me to this 2007 Lifehacker article about a python script called 'Uploadr'. Some deeper digging brought me to a more recent version on Github from Martin Kleppmann. This is the one that worked for me.
I proceeded to pick through the instructions of the afore-mentioned resources, both of which are not entirely straightforward if you're not so technically minded. So I'll try to summarize here below in plain English.
Step 1: Drop the uploader.py and XMLtramp.py files (from Kleppmann's repository) into a folder of your choice. I like to drag a shortcut to this folder to the top of my Mac's Finder window for quick access.
Wicked handy tip: Now rather than just send one folder's photos to Flickr, I thought I'd actually set up one folder for public images and one for private images. If you'd like to control whether images are public or private, you can perform this sequence once for each folder.
Step2: Using your favorite text editor, specify the image directory and fill out the Flickr settings. Below are the settings that I filled out for my public folder. If you're not sure of yours, just drag that folder into Terminal (assuming you're on a Mac). Note that if you want photos kept private, fill in a '0' after 'is public'. Multiple tags can be added with commas.
Step 3: Get a Flickr API key and input it just below the "You shouldn't need to modify anything below here" line. Yes, really... And follow the syntax you see below too, because the syntax in the original file didn't fly for me. I've redacted my key, because I really wanted to use the word 'redacted' in a sentence...
Step 4: From the command line, run uploadr.py. If you're using terminal, just navigate to the folder you specified (using 'cd' to change directories) and type 'python uploadr.py'. Windows users see Lifehacker for steps. This step will launch Flickr in the browser prompting you to give uploadr.py access to your account. Go ahead and grant it. When you run uploadr.py the next time, any photos that you have in that folder will be uploaded to Flickr automatically.
Bonus Step 5: Create an Applescript to run uploadr.py in terminal. Lifehacker mentioned something about an Applescript in their article, but the link was unfortunately dead. So I whipped up the following Applescript that I can access from my menubar.
tell application "Terminal" do script "python /Users/rickmartin/Pictures/FlickrPublic/uploadr.py" end tell
You can copy it and throw it into the AppleScript Editor, save it to the Scripts folder (perhaps under a new 'Flickr' subfolder?) and run it from the menu bar whenever you've added new photos. Be sure to replace my file path with your own. As you can see below, I made two scripts: one to trigger uploads from my public folder and one for my private folder. I'm not sure if all these steps are the best way to pull this off, so if anyone has suggested improvements drop me a line in the comments. I did get a "DeprecationWarning: the md5 module is deprecated; use hashlib instead" warning, but nothing 'sploded so I'm ok.
Update: Takaaki asks "Can you make it automatic using a folder action? http://bit.ly/aMXFa3". This is something I'll definitely have to check out. It certainly seems like an improvement on the Applescript.
Related reading: Unix command cheat sheet