From mboxrd@z Thu Jan 1 00:00:00 1970 From: brian powell Subject: Re: org google weather Date: Fri, 4 Mar 2011 10:29:12 -0500 Message-ID: References: <87oc5rlwc4.wl%lists@700c.org> <4D70A577.4000509@manor-farm.org> <80k4gfnth7.fsf@somewhere.org> <4D70CCB6.5080101@manor-farm.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=000e0cdf690edd6825049da9ce27 Return-path: Received: from [140.186.70.92] (port=32810 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PvWwO-0001rr-9z for emacs-orgmode@gnu.org; Fri, 04 Mar 2011 10:29:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PvWwM-0006j2-UC for emacs-orgmode@gnu.org; Fri, 04 Mar 2011 10:29:16 -0500 Received: from mail-ww0-f49.google.com ([74.125.82.49]:47644) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PvWwM-0006iv-N3 for emacs-orgmode@gnu.org; Fri, 04 Mar 2011 10:29:14 -0500 Received: by wwj40 with SMTP id 40so2396599wwj.30 for ; Fri, 04 Mar 2011 07:29:13 -0800 (PST) In-Reply-To: <4D70CCB6.5080101@manor-farm.org> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: lists@manor-farm.org Cc: emacs-orgmode@gnu.org --000e0cdf690edd6825049da9ce27 Content-Type: text/plain; charset=ISO-8859-1 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 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. > > --000e0cdf690edd6825049da9ce27 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable FWIW/YMMV I use RUBY: I like the "twilight" info too--not sure em= acs does twilight info too--maybe you can reuse some of the code and put in= to OrgMode: I do:

emacs -l=A0.bja-sunrise-sunset-twiligh= t.el

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

(defun bja-sunrise ()
=A0=A0"Display su= nrise, sunset &amp; twilight information."
=A0=A0(intera= ctive)
=A0=A0(shell-command "~/sunrise_http_post.rb"))
<= div>
--excerption of=A0sunrise_http_post.rb (available somewh= ere on the web)
...
require 'net/http'
=A0
YOUR_ID =3D 'BGPOWELL' # A unique ID per comment= above
YOUR_CITY =3D 'Fairfax' # The name of your city
YOUR_STATE =3D 'VA' # Two letter state abbreviation
=A0
now =3D Time.now
month =3D now.month
day =3D now.d= ay + 1 # Tomorrow
year =3D now.year
=A0
Net::= HTTP.start('aa.usno.navy.mil= 9;) do |query|
=A0=A0response =3D query.post('/cgi-bin/aa_pap.pl', "FFX=3D1&ID=3D#{YOUR_ID}&xxy=3D#{year}&= amp;xxm=3D#{month}&xxd=3D#{day}&st=3D#{YOUR_STATE}&place=3D#{YO= UR_CITY}&ZZZ=3DEND")
=A0=A0if response.body =3D~ /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
=A0=A0 =A0puts &q= uot;#{month}/#{day}/#{year}"
=A0=A0 =A0puts "Begin Twilight: #{$1}"
=A0=A0 =A0p= uts "Sunrise : #{$2}"
=A0=A0 =A0puts "Sunset : #{$= 3}"
=A0=A0 =A0puts "End Twilight : #{$4}"
=A0=A0end
end



On = Fri, Mar 4, 2011 at 6:27 AM, Ian Barton <lists@manor-farm.org> 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 Agend= a
like:

=A0 =A0Sunrise: =A0 =A0 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)? =A0That'd be even much nicer...

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

Ian.


--000e0cdf690edd6825049da9ce27--