Skip to content

Flickr_Up is a ruby script that can be used to find all photos from a target directory recursively and automatically upload them to Flickr. It also stores the MD5 checksum of the uploaded files in a local file in order to save the progress and not to upload suspected duplicates.

Notifications You must be signed in to change notification settings

peyanski/Flickr_Up

Repository files navigation

Flickr_Up
====================

Flickr_Up is a ruby script that can be used to find all photos from a target directory recursively and automatically upload them to Flickr. It also stores the MD5 checksum of the uploaded files in a local file in order to save the progress and not to upload suspected duplicates. 

For more detailed instructions about this script go to - http://kupemo.blogspot.com/2013/06/flickrup-or-how-to-upload-all-of-your.html

Flickr_Up will create the following files during its run:

uploaded_files.yml - that contains full path and the filename of the uploaded photos and their MD5 checksum
skipped_files.yml - all files that are skipped due to a restriction in config.yml or something else 
exceptions.yml - store all exception during the run of the Flickr_Up(Timeout::Error, Filesize was zero, etc.) 

## Prerequisites

* A Flickr account - of course
* Ruby 
	- For Windows go to http://rubyinstaller.org/ 
	- For Ubuntu type '$ sudo apt-get install ruby' 
	- For OpenWRT type '# opkg install ruby*'
* flickraw: 
	- Go to - https://github.com/hanklords/flickraw 
	- or try 'gem install flickraw' from command window
* Yaml - standard Ruby module

## Tested on

* Windows 7 Professional SP1 32-bit & rubyinstaller-1.9.3-p429.exe
* Windows 8 Pro 64-bit & rubyinstaller-1.9.3-p429.exe
* TP-Link TL-WR1043ND router - OpenWRT 12.09 Attitude Adjustment (12.09, r36088) & ruby 1.9.3p429

## Getting started

### Flickr API Key

To run the script, you'll need an API key from your Flickr account.
You can find and create your API keys associated with your account at http://www.flickr.com/services/api/keys/

You'll need your "API Key" and "Shared Secret" to run the script.

Please, follow the steps described below to get the Flickr_Up working.

### 1. Authenticate the script with Flickr

run `ruby authenticate.rb` to get your "access_token" and "access_secret"

    $ ruby authenticate.rb
    Open this url in your process to complete the authication process : http://www.flickr.com/services/oauth/authorize?oauth_token=AAAAAAAAAAAAAAAAA-bbbbbbbbbbbb&perms=delete
    Copy here the number given when you complete the process.
    123-456-789
    You are now authenticated as peyanski with token CCCCCCCCCCCCCCCCC-ddddddddddddddddd and secret eeeeeeeeeeeeeeee
    
You can now add token (access_token) and (access_secret) secret to your 'config.yml' check "3. Configure Flickr_Up" how to do it.

### 2. Fetch your Set ID

You will have to choose an existing Flickr Set to upload your files. You can use 'get_phtotsets.rb' script to fetch all existing Flickr sets and to get the ID you want form the generated "photosets.yml" file. Or you can log on to Flickr and enter to the set that you want to use and after that to copy the ID from the URL in your browser (as example: http://www.flickr.com/photos/your_user/sets/72157631234567890/ - copy only the digits - 72157631234567890)
	
    $ ruby get_photosets.rb 
    You are now authenticated as peyanski
    photosets.yml saved.
	
You can now add photoset_id in your 'config.yml' check "3. Configure Flickr_Up" how to do it.
	
### 3. Configure Flickr_Up

Copy 'config.yml.default' to 'config.yml' and add all of the parameters described below:

Configuration file reference:
* api_key: flickr API key
* shared_secret: flickr shared secret
* access_token: flickr access token
* access_secret: flickr access secret 
* target_dir: where to find files to upload. Default value is './photo/'
* allowed_ext: filter files to upload by extension
* is_public:  '0' to set it to private, 1 to set viewing permissions for the photo‘s location data to public. Default value is '0' 
* is_friend: '0' to set it to private, '1' to set viewing permissions for the photo‘s location data to friends. Default value is '0' 
* is_family: '0' to set it to private, '1' to set viewing permissions for the photo‘s location data to family. Default value is '0' 
* hidden: Default value is '2' which means that the photo is hidden from search engines.
* photoset_id: Flickr Set ID (example: 72157631234567890). Default value is '' 


### Running Flickr_Up

Example: Uploading the IMG_0046.JPG located in ./photo/ folder: 

C:\Users\kpeyanski\Dropbox\K\git\Flickr_Up>ruby Flickr_Up.rb
Your 'uploaded_files.yml' is empty or doesn't exist...
Creating 'uploaded_files.yml' file!
Start uploading IMG_0046.JPG ...
         upload done.
Adding ./photo/IMG_0046.JPG to uploaded_files.yml
Congrats!
		
### TODO

* add support for video files
* add support for RAW files (*.NEF, *.DNG, *.CR2)


### Licence

Flickr_Up is released under the MIT license:

* [http://www.opensource.org/licenses/MIT](http://www.opensource.org/licenses/MIT)

About

Flickr_Up is a ruby script that can be used to find all photos from a target directory recursively and automatically upload them to Flickr. It also stores the MD5 checksum of the uploaded files in a local file in order to save the progress and not to upload suspected duplicates.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages