To be able to use the script, you must follow these steps:
Don't get scared by the steps below, using the script is actually quite easy but I like explaining everything in detail.
1. Install the following packages:
sudo apt-get install inotify-tools libnotify-bin
2. Download GoogleCL and install it (it comes with .deb files)
3. Create a new file and paste the following code:
#!/bin/sh
# 1. Watch ~/Pictures/PicasaWeb folder.
# 2. Upload new file to Picasa using Google CLI.
# 3. Launch the browser to the direct Picasa URL.
#
#change the variable below with the folder you want this script to watch for new images:
WATCHED_DIR=~/Pictures/PicasaWeb
#change the variable below with exact name of the PicasaWeb album you want to upload the images to:
PICASA_ALBUM="Drop Box"
while [ 1 ]
do
echo 'Watching directory: '$WATCHED_DIR 'for new files'
while file=$(inotifywait -q -e create "$WATCHED_DIR" --format "%f")
do
echo 'New file to upload to PicasaWeb:' $file
notify-send -i "gtk-go-up" "Picasa Web Monitor" "Uploading image $file"
google picasa post --title $PICASA_ALBUM "$WATCHED_DIR/$file"
url=$(google picasa list url-direct --title $PICASA_ALBUM | grep "$file" | sed -e "s/$file\,//g")
echo 'Picasa url: ' $url
notify-send -i "gtk-home" "Picasa Web Monitor" "Image uploaded. Launching browser."
xdg-open $url
done
done
Then you MUST edit the following variables in the script:
- "WATCHED_DIR" - enter the exact path to the folder you want the script to watch (make sure the folder exists!).
- "PICASA_ALBUM" - the PicasaWeb album to upload the images to. Make sure this album exists! Also, use an unique album name, because GoogleCL (the command line tool used to upload the images) will display display options to choose the album to upload the image to. Example: if you have 2 albums: "test" and "test 2", setting the "PICASA_ALBUM" to "test" will result in Google CL asking you if you want to upload the image to either "test" or "test 2" so the process will not be automated anymore. If you set it to upload the images to the "test 2" album, there won't be any issues (in this example).
- Optional: by default, the script opens the link to the image in a new web browser tab. This can be disabled by commenting (add a "#" in the beginning of the line (without the quotes)) line 24 in the script (which looks like this: "xdg-open $url").
google picasa list