Still Yet Another Digital Picture Frame (Linux) by mikedahlgren

Step 9: Updated (Picasa script / hack)

kuva 151.jpg
So a few people have been asking for the script I have been using to download pictures from picasa. The reason why I didn't include it before was It's about as ugly as it gets and will definitely break as soon as picasaweb changes anything with their web page.

The frustration comes from the lack of any feed to their "featured" photos, and instead I had to download their web page, parse out the lines I'm looking for and replace the links to the thumbnails with the actual links. This is made more complicated since the URL's change with each image as well as the server that is hosting the content.

Thankfully they have a system to group images of different resolutions. In my case I prefer to just grab the originals and let the picture frame scale them appropriately. To make things clearer look at the following links

Thumbnail from picasaweb.google.com/lh/explore# currently 144x144 resolution
http://lh5.ggpht.com/_4TrPwfUulu0/Sd0qLrsV_bI/AAAAAAAACTM/yhbSPhcyh8Y/s144-c/kuva%20151.jpg

Same link with a picture scaled to 800x? In this case 800x536.
http://lh5.ggpht.com/_4TrPwfUulu0/Sd0qLrsV_bI/AAAAAAAACTM/yhbSPhcyh8Y/s800/kuva%20151.jpg

Original photo at 1600x1071 resolution.
http://lh5.ggpht.com/_4TrPwfUulu0/Sd0qLrsV_bI/AAAAAAAACTM/yhbSPhcyh8Y/kuva%20151.jpg

In the code I'm using sed to delete "s144-c" from the URL to download the originals but it works just as well to replace it with images of the desired size.

Also I wrote this script with the intention of it running inside of a folder called "picasa" in my home folder. If you wish to put it somewhere else then you will need to update it accordingly.

This script also needs to be called by something else. I have added the following in my personal crontab to run the script every morning at 4am.

computername$ crontab -l
0 4 * * * ~/picasa/download_favorits >> ~/picasa/cront_out.txt

The basic idea is it will attempt to download all 12 images on the page except if it's already there then it will skip it.

I hope that helps explain it, if you have any other questions please feel free to post them in the comments.

#!/bin/bash
#Mike Dahlgren 2009

HOME=~
wget -O $HOME/picasa/explore.html http://picasaweb.google.com/lh/explore#
mkdir -p $HOME/picasa/pics

cat ~/picasa/explore.html | grep 'style="width' | awk '{print $2 " " $6}' | sed 's/s144-c/d/' > $HOME/picasa/pics_list.txt

cd $HOME/picasa/pics

exec < ../pics_list.txt
while read line
do
echo $line
wget -nc $line
done

rm $HOME/picasa/explore.html
rm $HOME/picasa/pics_list.txt
 
Remove these adsRemove these ads by Signing Up
jmalone68 says: Apr 16, 2009. 4:14 PM
Thanks for that. I'll have to look at it a bit more closely. I think I've got phpFlickr, with PHP, to work with a script, so now I've got two options. I certainly appreciate the update.
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!