From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Sven Bretfeld" Subject: Re: [google] updated awk script for google to org conversion Date: 12 Jul 2010 09:49:29 +0200 Message-ID: <87iq4l6sxi.fsf@gmx.ch> References: <87wrt5kqfn.wl%ucecesf@ucl.ac.uk> <87sk3tkmzx.wl%ucecesf@ucl.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from [140.186.70.92] (port=50885 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OYDmi-00075Q-T3 for emacs-orgmode@gnu.org; Mon, 12 Jul 2010 03:52:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OYDld-0000a2-2G for emacs-orgmode@gnu.org; Mon, 12 Jul 2010 03:49:34 -0400 Received: from mx4.rz.ruhr-uni-bochum.de ([134.147.64.53]:52452) by eggs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1OYDlc-0000Zh-LM for emacs-orgmode@gnu.org; Mon, 12 Jul 2010 03:49:33 -0400 In-Reply-To: <87sk3tkmzx.wl%ucecesf@ucl.ac.uk> (Eric S. Fraga's message of "Fri, 09 Jul 2010 10:44:50 +0100") 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: Eric S Fraga Cc: org-mode mailing list 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