Automatically upload a folder's photos to Flickr
I love Flickr, but I'm terrible at uploading pics to my Flickr account. It's not that there aren't already a lot of great tools for getting photos into Flickr (there are); but I need a way to monitor my pictures folder to upload everything I dump in there. Call me lazy, but I just don't want to take the extra steps if I don't have to.Luckily a cross-platform script called uploadr.py can watch a folder of your choice for new pictures, then automatically upload them to your Flickr account. Here's how to set up uploadr.py.
What you'll need
Python: The script we're using is called uploadr.py, which is written in the Python programming language. If you don't have Python installed on your computer, you'll need to grab it here (I know Windows users will need it - I think my Mac came with Python installed, but just in case, Mac users can get it there, too).
Uploadr.py: Uploadr.py is a Python script written by Cameron Mallory. When you click the Uploadr.py link, you'll be taken to the text of the script. Create a new folder anywhere you like and call it something like Uploadr. Then create a new text file in that folder, copy and paste all the contents of uploadr.py, then rename your text file to uploadr.py (extension and all).
XMLTramp.py: This little Python module is required to run uploadr.py, so—just like you did with uploadr.py—copy and paste the text of the XMLTramp link to a new file in your Uploadr folder and name it xmltramp.py.
Configure Uploadr.py
Now that you've installed Python and you've set up both uploadr.py and xmltramp in a folder, it's time to configure uploadr.py, so open it up in your favorite text editor and let's get busy.
- First, set the folder you want uploadr.py to monitor for new pictures. Find the line containing
IMAGE_DIR =
, and inside quotation marks paste the full path to your to-be-monitored folder. For example:
Windows:IMAGE_DIR = "C:/adam/images"
Mac:IMAGE_DIR = "/Users/adam/images/"
- Now let's tweak your Flickr upload data—i.e., the title, description, tags, and privacy settings for the photos. Find the "Flickr settings" section (which should be just below the IMAGE_DIR section you just edited). It should look something like the screenshot. By default, the picture is set as public with the tag, "auto-upload" assigned to it. You can change any of these settings if you have different preferences. If you leave title blank, it will default to the name of your picture.
Test it out
Running uploadr.py varies slightly between Windows and Mac, so I'll separate them.
Windows: Fire up your command line and navigate to your uploadr directory. For example, run cmd.exe, and enter cd "C:\adam\uploadr"
(or wherever your uploadr directory is). Now just type in uploadr.py and hit Enter.
Mac: Run Terminal and navigate to your uploadr folder—something like cd /Users/adam/uploadr/
(tweaked to match your directory). Type in python uploadr.py
and hit Enter.
When uploadr.py runs for the first time, it needs to get permission from Flickr to upload pictures to your account. It'll launch the proper web page, and all you have to do is click the button labeled, "OK, I'LL ALLOW IT." Go back to the command line and confirm that you've allowed uploadr.py to access your Flickr account. Next time you run uploadr.py, if there are any new pictures in your images folder, they'll automatically be uploaded to Flickr. Give it a try to make sure it's working for you.
Set up persistent folder monitoring on Windows
You could stop there and just run the uploadr.py script whenever you wanted to upload new pictures from your images folder to Flickr, but for me the whole reason for using uploadr.py is so I can set it to monitor my images folder and let it take care of the rest whenever a new image shows up. Windows users, here's how you can do that:
First, rename your uploadr.py file to uploadr.pyw. The new .pyw extension will run the script in the background without opening a command window. Next, create a shortcut to uploadr.pyw (Right-click -> Create Shortcut). Then right-click your new shortcut and select Properties. We need to pass a parameter to our script so it knows that we want it to continue running and monitoring our folder instead of running once and quitting.
To do so, in the Target text box, add -d
to the end of the target. Now when you run uploadr.py via your new shortcut, you won't see anything. However, try dropping a new pic into your monitored folder, and within a minute you should see your pics up on Flickr. Handy, right?
Now just add the shortcut to your Windows startup folder and you should be set.
Persistent folder monitoring on your Mac
If you're on a Mac, you can set up uploadr.py to persistently monitor your images folder by passing the -d parameter in Terminal like so: python uploadr.py -d
(also see screenshot above). To be honest, though, I don't know how to best set up uploadr.py on a Mac so you can run it at startup the same way as I've done with Windows without putting together a second Applescript or something along those lines, so if you do know how, please share it in the comments or drop me an email and I'll update the post ASAP!
UPDATE: We've got a couple of great suggestions for setting it up on your Mac. The first involves creating a system level startup item, while the second takes advantage of one simple line of AppleScript. Thanks a lot, folks!
I take pictures sparingly, and I remove my least favorites before I even transfer the photos to my computer, so I actually monitor the folder that all of my pictures go into. If you're more prolific than I am, you'll probably want to set up a separate folder for your Flickr uploads. Either way, if you're a Flickr junkie, uploadr.py could be a real timesaver for you.
Adam Pash is a senior editor for Lifehacker who's very keen on automation. His special feature Hack Attack appears every Tuesday on Lifehacker. Subscribe to the Hack Attack RSS feed to get new installments in your newsreader.
Source: lifehacker.com
No comments:
Post a Comment