Friday, September 10, 2010

Weather for emacs and orgmode

On 09 Sep 2010 Julien Danjou provided a way to access the Google weather API from emacs. Additionally, the weather can easily be integrated into an orgmode agenda.

cd ~/Projects/git/
git clone git://git.naquadah.org/google-weather-el.git

Then we set up emacs in the following way

(add-to-list 'load-path "~/Projects/git/google-weather-el")
(require 'google-weather)
(require 'org-google-weather)

To add the weather to the agenda, put a call to org-google-weather with the city (e.g. "Webster, NY") or postal code (e.g. "14580") in an org file that is used by the agenda. Multiple weather locations can be included and the #+CATEGORY option can be used to distinguish them in the agenda.

#+CATEGORY: Webster, NY
%%(org-google-weather "Webster, NY")
#+CATEGORY: Washington, DC
%%(org-google-weather "Washington, DC")

The Google weather API is apparently very well undocumented (http://blog.programmableweb.com/2010/02/08/googles-secret-weather-api/), but the following call will retrieve an XML response.

http://www.google.com/ig/api?weather=14580

Other APIs that might be of interest are stock quotes

http://www.google.com/ig/api?stock=YHOO

movie listings

http://www.google.com/ig/api?movies=14580

and a news feed

http://www.google.com/ig/api?news

Neat stuff.

No comments:

Post a Comment