February 11, 2005

Flickr Uploader Folder Action for OSX

A couple of months ago I had the idea that it would be possible to use the OSX Finder to automatically (or "automagically," as the old Sysadmin term went) upload photos to Flickr when my camera was attached to my Mac, with no involvement from me. The logic went like this:

  • Flickr can get uploads from a UNIX command line
  • AppleScript can issue UNIX commands
  • the Mac Finder can automatically execute AppleScripts when a new object appears in a folder (a Folder Action)
  • Folders are created in the /Volumes directory whenever a new volume--such as my camera--is mounted

This chain of reasoning led me to calling on Josh Ellithorpe, who I asked to stitch together the Apple sample backup Folder Action to the Folder Action that fspiers, a Flickr user had put together.

Here's the standalone script, which does the same thing as the folder action, but without having to be invoked as a folder action, and here's the folder action.

It's still a rough proof of concept, but it works.

Here are Josh's instructions for installation:

property flickrmedia : "Flickr Media"
property subdir : "DCIM"
property eject_when_done : true
property emailaddy : "quest@mac.com"
property thepass : "YOURPASS"

flickrmedia - the name a folder in your Application Support directory. This is where you put an alias to the memorysticks or drives you want to auto upload.

subdir - on my camera it puts everything in DCIM... so
/Volumes/MEMORYSTICK/DCIM/Photodir1/photo.jpg. I figured yours would
have a similar layout, if not the exact same folder name.

[in my case it's /Volumes/SANDISK/DCIM/100PENTX/photo.jpg --mk]

The other options are painfully obvious.

Ok, so for my setup this is how everything works. Create the folder "Flickr Media" in "/Users/YOURUSER/Library/Application Support/". Inside that folder put an alias to any drive you wish to upload on mount. This is exactly how the Backup script works but not in your homedir which I thought was bad design.

The standalone is simple. If the alias is in your flickrmedia folder then you mount it (hookup the camera) and double click the file. Then it searches your memorystick/drive for /Volumes/MEMORYSTICK/SUBDIR where subdir is the folder you define in the applescript. So in my case it was /Volumes/Untitled/DCIM/. Then it lists the files in all folders in that subdir, my cam has many folders. Then it uploads them, and displays a dialog saying how many files it uploaded. Then the disk gets ejected if you set eject_when_done to true.

The folder action is installed exactly like the backup script.

The script is definitely a first generation pre-alpha thing. It doesn't tell you how much has been updated, it doesn't keep track of what's been updated and what hasn't, the Finder pretty much freezes while it's running (which can be quite a while) and, in general, it's not Flickr Uploadr, but if the goal is to experiment with making transparent technology--and that's what this is--it works.

So go and use this in health.

Posted by mikek at February 11, 2005 02:18 PM | TrackBack
Post a comment

Remember personal info?