Today I published a new project, the Uploadr in BitBucket.
Introduction
Uploadr is a little command line tool written in Java which is able to upload fotos to flickr. Well, Uploadr isn’t that little because I wanted to have some more features so it now is a kind of universal extendable upload tool.
The intention to create Uploadr was the lack of any flickr upload service in my Synology 212j Network Attached Storage. In my usecase my Internt upload speed is low and I wanted to organize my images in a folder structure on the NAS quickly and the NAS should sync the folder structure with flickr.
I never hat written Java code for a machine with that low CPU resources than the 212j has, so I was very surprised how well Uploadr works (ok, it takes some time until Uploadr starts a Command…).
Uploadr Overview
Uploadr contains of three main parts:
- the Uploadr core which call Commands
- the Commands, which call ExternalUploadrs
- the ExternalUploadrs which to the upload work
Use Uploadr
Using Uploadr is quite simple. You just need Java 1.7 installed on your machine and you are ready to go.
- Download it from here and unzip the ZIP file. The ZIP file contains start scripts for Windows and Linux machines.
- Move to the bin folder and give uploadr help
Uploadr shows all available commands and how to use them.
Uploadr and flickr
Currently there only is an ExternalUploadr implemented for flickr. First step of using Uploadr and flickr is to authenticate Uploadr against flickr.
flickr Authentication
This only works if you get an flickr API key for your account and put it into
conf/flickr.properties
The properties file can have any name but flickr must be contained in the filename.
Put the flickr API key into the property flickr.api.key and the secret key into flickr.shared.secret.
flickr.api.key= {flickr API key} flickr.shared.secret={flickr secure API key}
After this step Uploadr must be authenticated against your flickr account. This only works properly if you run the next step on a system with installed browser because the Uploadr flickr authentication process needs to open a browser window in which in the end flickr.oauth.verifier is given.
Run
uploadr oauth flickr.properties
flickr is opened in your webbrowser and asks for delete access rights. Please grant the deletion right. After that step flickr opens a page in which a verification key. Put the verification key into flickr.oauth.verifier
flickr.oauth.token={automatically set by Uploadr} flickr.oauth.secret={automatically set by Uploadr} flickr.oauth.verifier={the verification number from the last authentication step}
Uploadr is now authenticated against flickr.
Set folders which are synchronized
Uploadr is able to synchronize multiple folders. Each folder given is processed recoursively. The folder list can be given as comma separated list.
basefolders=/volume1/flickr_photos,/home/user/photos
Synchronize with flickr
Starting the synchronization is quite easy now, just run
uploadr upload flickr.properties
Uploadr now sweeps through the given folders and checks, if the image was already uploaded. The check is done against a built in database and is based on the MD5 hashsum of the file.
- If the file never was uploaded, it is uploaded to flickr.
- If the file was updated, the existing file in flickr is deleted and the updated file is uploaded to flickr.
- If the file was deleted, the file is deleted in flickr.
Uploadr not only uploads the file but it creates an flickr album. The album is named like the folder path to the image, i.e.
Common/Parties/Christmas 2012
Not the absolute path to the file is used but the relative path to the given basefolders.
Conclusion
In my tests Uploadr works quite nicely and has a lot of potential to be extended like to provide support for Google+, Facebook, Picasa, 500px and so on.
If something does not work like expected, please create an issue on BitBucket. Feel free to clone the project and create your own extensions. Please don’t forget to create a Pull request, so your changes can flow back into the sources.
Happy uploading!