Powered By

Powered by Blogger

Tampilkan postingan dengan label googlecl. Tampilkan semua postingan
Tampilkan postingan dengan label googlecl. Tampilkan semua postingan

Senin, 01 November 2010

Script To Watch A Folder And Upload New Images To PicasaWeb

Patrick @ Platechnotes created a simple but very useful script which automatically uploads the new images in a folder to your PicasaWeb account. The script uses GoogleCL, a tool released by Google for managing most Google services via command line.

What this script does is check a folder for new images and when you add a new image, it is instantly uploaded to your PicasaWeb account (in an album you set in the script). Note that the script will not upload any images that already exist in that folder. When an image is successfully uploaded to PicasaWeb, the script notifies you of this (using NotifyOSD) and opens the link to the image in a new web browser tab (but you can remove this behavior easily if you don't want it).


For me, there was a small error in the script so I've tweaked it a bit, however even tough I could have added checks for dependencies and so on, I didn't do that because there's no point in complicating a simple script which all these stuff - and if you follow my exact instructions below, these dependency / folder checks are not necessary.


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").

4. This step is only required once for the computer where you're using this script: GoogleCL needs the permission to upload images to your PicasaWeb account and for this, you must firstly access it from the command line so run the following command:
google picasa list

At this point, GoogleCL will request your username so enter it, then a new link will open in your web browser with the Google OAuth page - here, click the button to grant access to Google CL. Then (important!), return to the terminal where you've ran the above command and press the "ENTER" key.


5. Now save the file you've created in step 3 and make it executable (right click it, select Properties and on the Permissions tab, check the "Allow executing file as program" box).

Then run the script: either double click it and select "Run" or from a terminal. You can also add it to your startup applications.


Credits for the script: platechnotes

Selasa, 12 Oktober 2010

Easily Install Google Earth, TeamViewer, Dropbox, IBM Lotus Symphony And Many More In Ubuntu 10.10 Using The Super OS Repository

Super OS 10.10, a modified version of Ubuntu has been released today and with it, the Super OS repository I was telling you about a while back has also been updated to support Ubuntu 10.10 Maverick Meerkat.

You can use the Super OS repository in Ubuntu (without installing Super OS) and you'll get access to a lot of applications, all in just one repo. Among the applications available in the Super OS repository are: Amazon MP3 Downloader, Adobe AIR, Flash and Reader, Boxee, FrostWire, Dropbox, IBM Lotus Symphony (Office suite), Google Chrome, Google Desktop, Google Earth (which has been removed from the Medibuntu repository in Ubuntu 10.10), GoogleCL, Hulu Desktop, Nero Linux, Opera, PeaZip, Google Picasa, Real Player (also removed from Medibuntu in Ubuntu 10.10), Remastersys, Skype, SpiderOak, TeamViewer, TrueCrypt, UCK, VirtualBox (non-free) and others - all in a single repository (so to use them all, you don't have to add a huge list of repositories but only 1). A complete list of applications available in the Super OS repository can be found HERE.


Add the Super OS repository to Ubuntu 10.10 Maverick Meerkat

To add the Super OS repository to your Ubuntu sources.list, simply download and install this .deb file - it will add the repository and also install the key. Then, update the software sources using the following command:
sudo apt-get update

The note I made the last time I wrote about the Super OS repository, stands: there is no guarantee that this repository is safe to use. But just like it is with the PPAs, you can choose to trust the maintainer or not, it's up to you.


If you want, you can of course directly install Super OS instead of Ubuntu 10.10.


Thanks to Ubuntips for the heads up on the new Super OS release.

Selasa, 22 Juni 2010

YouTube Uploader Nautilus Script Using The New GoogleCL

upload to youtube

With the release of GoogleCL, a command line tool to access most Google services, it was obvious a lot of scripts would start to be created.

The first such script - for uploading videos to YouTube - has been posted to GNOME Look and is very easy to use and install.


Before using the script, you must install GoogleCL. Instructions can be found HERE. Also, before using the script you must run the Google YouTube command line interface at least once so you can authorize YouTube. To do this, simply use an example from HERE.

It's a Nautilus script so you must place it in the "~/.gnome2/nautilus-scripts" folder. You can download the script from HERE. Once you place it in the Nautilus scripts folder, make it executable:

chmod +x ~/.gnome2/nautilus-scripts/youtube-upload.sh



Then, to upload a video to YouTube, all you have to do is right click a video and select your script via the Nautilus context menu. Note that GoogleCL does not provide a way to see the upload progress, but the script will notify you when the upload finishes!


You can of course play with the source code of this script and extend it, modify it for uploading pictures to PicasaWeb or anything to Google Docs and so on.