emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: brian powell <briangpowellms@gmail.com>
To: lists@manor-farm.org
Cc: emacs-orgmode@gnu.org
Subject: Re: org google weather
Date: Fri, 4 Mar 2011 10:29:12 -0500	[thread overview]
Message-ID: <AANLkTi=apwG3LwdWHZuyLiVZ4AUqYYxjMf-FtJSPpoK+@mail.gmail.com> (raw)
In-Reply-To: <4D70CCB6.5080101@manor-farm.org>

[-- Attachment #1: Type: text/plain, Size: 2239 bytes --]

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 &amp; 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 <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
>>> 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.
>
>

[-- Attachment #2: Type: text/html, Size: 3601 bytes --]

  reply	other threads:[~2011-03-04 15:29 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-03 21:37 org google weather Simon Brown
2011-03-04  8:40 ` Ian Barton
2011-03-04  9:08   ` Sébastien Vauban
2011-03-04 11:27     ` Ian Barton
2011-03-04 15:29       ` brian powell [this message]
2011-03-04 16:38       ` Nick Dokos
2011-03-04 19:28         ` Bastien
2011-03-04 19:42         ` Konrad Hinsen
2011-03-04 20:26           ` Nick Dokos
2011-03-05 10:19             ` Bastien
2011-03-05 11:44               ` Matthew Sauer
2011-03-05 13:26                 ` Konrad Hinsen
2011-03-05 14:57                   ` Matthew Sauer
2011-03-05 15:15                     ` Michael Markert
2011-03-05 15:23                     ` Nick Dokos
2011-03-05 17:46                       ` Matthew Sauer
2011-03-05 19:57                         ` Nick Dokos
2011-03-05 14:29               ` Konrad Hinsen
2011-03-05 17:07                 ` Bastien
2011-03-05 20:35                   ` Konrad Hinsen
2011-03-05 21:19                     ` brian powell
2011-03-05 23:51                     ` Nick Dokos
2011-03-06 10:33                       ` Konrad Hinsen
2011-03-06 11:20                         ` Konrad Hinsen
2011-03-04 23:03         ` Sébastien Vauban
2011-03-04 23:25           ` Nick Dokos
2011-03-04 21:28   ` Simon Brown
2011-03-04 22:05     ` Nick Dokos
2011-03-04 22:29       ` Nick Dokos
2011-03-04 22:43       ` Simon Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTi=apwG3LwdWHZuyLiVZ4AUqYYxjMf-FtJSPpoK+@mail.gmail.com' \
    --to=briangpowellms@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=lists@manor-farm.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).