emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Sven Bretfeld" <sven.bretfeld@gmx.ch>
To: Eric S Fraga <e.fraga@ucl.ac.uk>
Cc: org-mode mailing list <emacs-orgmode@gnu.org>
Subject: Re: [google] updated awk script for google to org conversion
Date: 12 Jul 2010 09:49:29 +0200	[thread overview]
Message-ID: <87iq4l6sxi.fsf@gmx.ch> (raw)
In-Reply-To: <87sk3tkmzx.wl%ucecesf@ucl.ac.uk> (Eric S. Fraga's message of "Fri, 09 Jul 2010 10:44:50 +0100")

Hi Eric

Thank you very much for the script and the idea. I'm a fan of MobileOrg
for Android, but the diary functions are not convenient to deal with at
the moment. So I adopted your method for date handling. Some
observations:

1. wget doesn't overwrite an older basic.ics laying in the same folder.
   Instead it names the files of further downloads to basic.ics.1,
   basic.ics.2 and so on. Therefore I added an additional line (rm $ICS)
   to your shell-script (not the awk-script, but the one with the
   automatized procedure you sent in a previous posting):

--8<---------------cut here---------------start------------->8---
#!/bin/bash

ICS=/home/sven/bin/google2org/basic.ics
ORG=/home/sven/aktuell/myconf/googlecalendar.org
AWK=/home/sven/bin/google2org/ical2org.awk

cd /home/sven/bin/google2org/
wget http://www.google.com/calendar/ical/[...]/basic.ics

timezone=$(date +%z | sed 's/^\([+-]\)0/\1/')

seconds=$(($timezone*36))

awk -f $AWK < $ICS > $ORG

rm $ICS
--8<---------------cut here---------------end--------------->8---

2. Running the above script with cron, makes Emacs continually ask if
   googlecalendar.org should really be edited, because the file had
   changed on disk. So I put the whole thing into an Emacs function:

--8<---------------cut here---------------start------------->8---
(defun my-org-to-google ()
  (interactive)
  (save-excursion
  (find-file "~/aktuell/myconf/mygtd.org")
  (org-export-icalendar-this-file))
)

(defun my-google-to-org ()
  (interactive)
  (save-excursion
    (kill-buffer "googlecalendar.org")
    (shell-command
     (format
      "sh /home/sven/bin/google2org/importgoogle.sh")))
)

(if (string-equal system-name "kamaloka")
    (run-at-time "3:00am" nil 'my-org-to-google)
    (run-at-time nil 3600 'my-google-to-org)
)
--8<---------------cut here---------------end--------------->8---

Every night a new ical-export is created from my main org-file at
3:00am, waiting to be uploaded in the morning (do you know if it's
possible to automatically import this to GoogleCL?). Every hour the new
entries of GoogleCL are imported to googlecalendar.org (which I include
my agenda-files, of course). To avoid problems, this happens only on one
of my PCs (kamaloka).

Greetings,

Sven

  parent reply	other threads:[~2010-07-12  7:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-09  0:57 Google calendar to org mode script and a feature request for agenda Torsten Wagner
2010-07-09  1:54 ` Nick Dokos
2010-07-09  8:30 ` Eric S Fraga
2010-07-09  9:44   ` [google] updated awk script for google to org conversion Eric S Fraga
2010-07-11  3:03     ` Daniel Martins
2010-07-12  7:49     ` Sven Bretfeld [this message]
2010-07-12  9:22       ` Rémi Vanicat
2010-07-12 13:48         ` Michael Steiner
2010-07-13  7:29           ` Sven Bretfeld
2010-07-12 17:50       ` Eric S Fraga
2010-07-12 17:54         ` Marcelo de Moraes Serpa

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=87iq4l6sxi.fsf@gmx.ch \
    --to=sven.bretfeld@gmx.ch \
    --cc=e.fraga@ucl.ac.uk \
    --cc=emacs-orgmode@gnu.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).