emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] org google weather


From: brian powell
Subject: Re: [O] org google weather
Date: Fri, 4 Mar 2011 10:29:12 -0500

FWIW/YMMV I use RUBY: I like the "twilight" info too--not sure emacs does twilight info too--maybe you can reuse some of the code and put into OrgMode: I do:

emacs -l .bja-sunrise-sunset-twilight.el

--where .bja-sunrise-sunset-twilight.el is:

(defun bja-sunrise ()
  "Display sunrise, sunset & twilight information."
  (interactive)
  (shell-command "~/sunrise_http_post.rb"))

--excerption of sunrise_http_post.rb (available somewhere on the web)
...
require 'net/http'
 
YOUR_ID = 'BGPOWELL' # A unique ID per comment above
YOUR_CITY = 'Fairfax' # The name of your city
YOUR_STATE = 'VA' # Two letter state abbreviation
 
now = Time.now
month = now.month
day = now.day + 1 # Tomorrow
year = now.year
 
Net::HTTP.start('aa.usno.navy.mil') do |query|
  response = query.post('/cgi-bin/aa_pap.pl', "FFX=1&ID=#{YOUR_ID}&xxy=#{year}&xxm=#{month}&xxd=#{day}&st=#{YOUR_STATE}&place=#{YOUR_CITY}&ZZZ=END")
  if response.body =~ /Begin civil twilight[^0-9]*(\d+:\d{2} [ap].m.).*Sunrise[^0-9]*(\d+:\d{2} [ap].m.).*Sunset[^0-9]*(\d+:\d{2} [ap].m.).*End civil twilight[^0-9]*(\d+:\d{2} [ap].m.)/m
    puts "#{month}/#{day}/#{year}"
    puts "Begin Twilight: #{$1}"
    puts "Sunrise : #{$2}"
    puts "Sunset : #{$3}"
    puts "End Twilight : #{$4}"
  end
end



On Fri, Mar 4, 2011 at 6:27 AM, Ian Barton <address@hidden> wrote:

Hi Ian,

Ian Barton wrote:
Has anybody tried adding the functionality of %%(diary-sunrise-sunset)
(sunrise, sunset time and daylight hours) to the google weather code?

I just have something like:

#+CATEGORY: Day/Year
&%%(diary-day-of-year)
#+CATEGORY: Sunrise
&%%(diary-sunrise-sunset)

in one of my Agenda files. Sunrise then appears at sunrise time in my Agenda
like:

   Sunrise:     6:53...... Sunrise (GMT), sunset 5:52pm (GMT) at
Wilkesley (10:58 hours daylight)

Do you have a way to get the sunset located on a line on its own (different
line from the sunrise one)?  That'd be even much nicer...

No, but I would like one:) If there were separate diary functions for sunrise and sunset it would be easy. Maybe I need to look at the diary elisp and write my own separate functions.

Ian.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]