Sunday, February 10, 2013

Flickr to Picasa Web

We have a Toshiba Blu-Ray BDX-2300 player.  It is a Linux based machine tailored for multimedia purposes.  In addition to local media file support, it has support for Internet-based services like Netflix and YouTube for videos, and Picasa Web for photos.  It is the latter service that I am interested in.

I use Flickr Pro to store my many thousand copies of my photos.  I do not want to use Picasa Web but it looks like I would have to store photos there if I want to display on my TV using this Toshiba player.

I have not familiarized myself with Picasa (the desktop software) to manage photos in Picasa Web and the Picasa Web interface seems to lack a feature to auto-resize photos before uploading them.  So, I thought I'd find a tool to transfer photos from Flickr to Picasa Web--my photos in Flickr are already resized.

I found this Python script called "migrate-flickr-to-picasa-nokey.py" that will do just that.  For installation instructions, visit http://www.edparsons.com/2011/06/migrating-from-flickr-to-picasaweb/.  If installing in a Windows environment, you also need to install Python 2.7.3 from http://www.python.org/getit/ first and then "easy_install.exe" which comes from the following package:  http://pypi.python.org/pypi/flickrapi.  Download it, expand it, and run "distribute_setup.py".  The "easy_install.exe" will be found in C:\Python27\Scripts\easy_install.exe.

By default, the migrate-flickr-to-picasa-nokey.py script will transfer everything you have from Flickr to Picasa Web.  I want to transfer only selected ones, so I modified the Python script to allow me to specify the Flickr album name I want to transfer on the command line.  I also hardcoded my Flickr username and password in the script.  I could then execute the script as follows:

migrate-flickr-to-picasa-nokey.py New-Year-Eve-20121231

Well, it works well with only one small issue.  It looks like the script would download each photo from Flickr first then upload it to Picasa Web one at a time.  I thought there was a way to transfer from Flickr to Picasa Web directly through some API calls.  Anyways, it is an unattended process so I guess it's not a big deal.

For anyone interested in the modifications, find below the UNIX diff output between the original and my modifications.  My code is not the most efficient as I have forgotten most of the Python language but it does what I need it to.

25a26,28
> import getopt
> args_opts, album_title_to_move = getopt.getopt(sys.argv[1], '')
> print "Will copy " + album_title_to_move + "..."
115a119
> picasa_username._value = "YOUR_PICASA_USERNAME"
116a121
> picasa_password._value = "YOUR_PICASA_PASSWORD"
118a124
> flickr_api_key._value = "YOUR_FLICKR_API"
119a126
> flickr_api_secret._value = "FLICKR_SECRET_VALUE"
159c166,174
<     sets = FLICKR.photosets_getList().find('photosets').getchildren()
---
>     tmp_sets = FLICKR.photosets_getList().find('photosets').getchildren()
>     sets = []
>     for aset_id in range(len(tmp_sets)): # go through each flickr set
>         aset = tmp_sets[aset_id]
>         set_title = aset.find('title').text
>         # Transfer only this one photo set ...
>       if set_title == album_title_to_move:
>             sets = [ aset ]
>             break
336c351
<
\ No newline at end of file
---
>

Invasion of What?

What are these bugs? I've never seen them before. I saw them at my parents' place the other day. Lots of them in soil or grassy areas.