June 18, 2010

Use Google Services from the Command Line

Not every one likes beautiful interfaces with big buttons, controls for entering text and uploading files. Sometimes it's faster to type commands in a terminal.

GoogleCL is a project that makes it easy to use Google services like Blogger, Picasa Web, YouTube, Google Docs ans Google Calendar from the command-line. It's a wrapper for the Google Data APIs, so you first need to install Python 2.6 (or 2.5) and Google Data APIs Python Client Library.

It's not very difficult to install a Python package. For example, in Windows you need to extract the archive, open the folder in Windows Explorer, shift + right-click in a blank space, select "Open command window here" and type: python setup.py install.

After installing Python, Google Data APIs Python Client Library and Google CL, you can type commands that let you upload photos to Picasa Web, upload videos to YouTube, publish Blogger posts, add events to Google Calendar, find Gmail contacts and more.

Here are some of my favorite commands:

google calendar add "Meet Mary tomorrow at 10am"
(add an event to Google Calendar)

google picasa get "Album Title" c:\files\picasa\
(download the files from one of your albums)

google picasa create --title "Miami Beach" c:\files\photos\miami\*.jpg
(upload photos to a new Picasa Web album)

google youtube post --title "Summer in Rome" c:\videos\rome.avi
(upload a video to YouTube)

google docs get --title "Reports .*"
(download documents that have titles starting with "Reports" as text files)

google docs upload c:\files\*.doc
(upload the *.doc files from a folder to Google Docs)

For a more comprehensive list of commands, type google --help or read the manual.


{ via Google Open Source Blog }

15 comments:

  1. What's the deal?? Are you trying to be like Linux??? We've all been there... and done that... The year is 2010... If you want Google to return to being a behind times "geek" program, with no inticement for or understanding of the regular Joes... you're on the right track... Go ahead and come up with more stuff that you have to do with a command line.. What a waste.. but, it wouldn't be much trouble at all for me to switch to Yahoo, Firefox or Internet Explorer... and let the wanna-be geeks have Google.... All I really need to know is, "How is it gonna be???" I thought I had resolved this issue back when I uninstalled Ubuntu from one machine... and Fedora from the other.. As far as I'm concerned, I DID resolve the issue...

    ReplyDelete
  2. No one is forcing you to use the GoogleCL utility... You can rest assured that Google will not be taking down any of their website-based services, and this is just an addition to what you can already do. If you don't like typing on a command line, by all means use the standard interfaces provided by Google (this isn't even provided by Google, it is something a third party developer has created).

    Now, for those of us who want to be able to type a dozen characters to upload an album to picasa, taking all of 10 seconds, this is a great tool. Graphical User Interfaces have their place, as do Command Line Interfaces, and having more options never hurt anybody.

    ReplyDelete
  3. What the hell are you on about, Carl?

    - What has 2010 got to do with it, almost seems like you think Linux died in the 1990s (you're thinking of MSDos perhaps, not quite the same thing)

    - "More stuff you have to do with the command line". As the blog clearly says, GoogleCl is just a wrapper for already-in-place APIs, none of Google's functionality is *requiring* command-line use, it's just offering it as a new an additional choice for those who might find it useful

    - GoogleCl is clearly an access tool for Google's hosted services, not for software such as Chrome, so where's your logic in saying you can "switch to Yahoo, Firefox or Internet Explorer"?

    - Anyone who doesn't realise that typing commands in quicker than using a GUI (even in Windows, keyboard shortcuts such as Alt+Tab, Winkey+R, etc) either hasn't tried using keyboard alternatives (command line apps, keyboard shortcuts, etc) or tried but didn't give it enough of a chance of get used to it. Sure, I'm not saying command-line apps are for everyone, but to write it off as an always-bad and out-of-date solution is just foolish.

    ReplyDelete
  4. It's designed for emacs guys :) I guess emacs google mode is coming on the road!

    ReplyDelete
  5. What is most interesting is the gdata python API that googleCL uses. You can do some interesting things with Vim and its python interface.

    ReplyDelete
  6. Not added to the Google Linux yum repositories?

    http://www.google.com/linuxrepositories/yum.html

    ReplyDelete
  7. This allows a new level of client side control through a variety of interfaces besides the command line. This is API level control of Google applications on-line.

    A little imagination and you can do some very nice things with these client side. I had fun this afternoon playing with this, and now to sleep on it, and see what happens tommorow.

    I am glad to see many people are interested. We need a place to put up some code examples. Any body interested?

    ReplyDelete
  8. @Alex Chitu
    Your blog rocks, the way you right articles is great.Lot of your articles are linked by popular tech blogs and are appearing in techmeme.

    ReplyDelete
  9. Nice piece of code! This makes many things, much easier to do.

    ReplyDelete
  10. It's very useful feature! I use it in my daily work

    ReplyDelete
  11. typo's in the first paragraph

    i <3 google

    ReplyDelete

Note: Only a member of this blog may post a comment.