22 April 2007

Syncing ratings between Bibble and Picasa

by Anton Piatek

I use Bibble to manage my RAW digital photos. As such doign slideshows is rather limited as Bibble does have a special mode for them and RAW’s are slow to convert. So I export some smaller JPG’s for use in slideshows/screensavers etc. and as such I have a folder of raw images, and a folder of jpg image, both with the same structure and more or less the same images in them.

Picasa does a wonderful job for showing of photos to friends, and is really nice for flagging up favourites however I want those ratings to be transferred back to Bibble. So i started writing a script to do it…

Bibble uses a config file per image that holds rating information, whereas Picasa uses a file per directory. I started parsing the config files by hand, but realised that this was going to be tricky for writing the files back with new ratings (particularly if the files don’t exist yet). So I headed over to CPAN to look for an existing perl module to do this for me… It turns out that the config files are both a very simple .ini format that is handled quickly by Config::Tiny. so I installed the debian package for that (perl modules are packaged in Debian usually with a naming structure of lib-perl, so the package I wanted is called libconfig-tiny-perl).

This package allowed very quick reading and writing of the ratings in the config files. I thought I was done then. The files were being updated as desired, but Picasa refused to show the new ratings… Playing around led to me changing an image and suddenly Picasa found the new rating from the config file. I guess Picasa cache’s the ratings data but if the date/time on the file changes then it reloads it, so after changing a rating in the picasa config I had to “touch” the associated image to get Picasa to reload the data (there is a perl module called File::Touch for that too!)