Thursday, December 25, 2008

Picasa Download Script

First of all, this is a mess. It uses a bunch of junk in 'daveperl', which is like my personal collection of perl idioms. Stuff like cat_file() that I use all the time and hate re-coding. I need to extricate this script from that stuff before it can really be useful to other people.

It used to use some Google Picasa perl library, but I grew really impatient with it. It's coded up in some really weird ways that do things like dynamically create perl objects and functions out of the XML that gets spit back from the Picasa API. It is pretty arcane stuff that I never did get working right mostly because it is a deal project.

The current stuff (I think) depends on the CPAN Picasa library and not the Google stuff any longer. But, there may be a dependency on the Google stuff in a place or two.

It basically goes and finds all the Picasa pictures, then sees if it has local copies. If not, it downloads them and sticks them in a directory. It caches things like the album modification time so it can speed things up not having to download the contents of *each* album during every execution. It uses filenames and exif timestamps to determine uniqueness. I don't do checksums because those change with picture rotation. If anyone finds this compelling or useful, let me know. I'll start trying to clean it up a bit so others might get some more use out of it.


Craig said...

Hey guys...been reading around here for a while. Seems like a lot of people have made some progress with this. I see that some people have come up with a work around for getting pic files where you want them via the Google picasa API. I was wondering if anyone has figured out how to directly write to the card itself. Is curl able to handle this? I apologize if this has previously been covered...

Unknown said...

here's more or less what i use to cat a file in perl:

open(HANDLE, $filename);
my $contents = join('', <$handle>);

i have no idea how fast it is in comparison to an explicit loop though. but it's simple enough to use in-place.