[conspire] July schedule posted

Tony Godshall tony at of.net
Tue Jul 7 15:15:41 PDT 2009


>
> > It would be possible to go the other way, though: auto-generate
> > iCalendar files from MySQL data we've already got.
> >
> > It's on my list of things to do when I'm sufficiently motivated. (Along
> > with RSS feeds)
>
> A cronjob in Ruby that periodically parses out current MySQL data and
> drops off an iCal file in a download location would just the thing.

Pofict

Or SQL dump && script.py where script.py is something like this...
[adapted from example at http://codespeak.net/icalendar/]


from datetime import datetime
from icalendar import UTC # timezone
cal = Calendar()
cal.add('prodid', '-//My calendar product//mxm.dk//')
cal.add('version', '2.0')

for line in open('/path/to/sqldump/').readlines():
  line= line.strip()
  summary,dtstart,dtend,dtstamp,priority,uid= // line parsing and
value generating goes here
  event = Event()
  event.add('summary', 'Python meeting about calendaring')
  event.add('dtstart',dtstart)
  event.add('dtend', dtend)
  event.add('dtstamp', dtstamp)
  event['uid'] = uid
  event.add('priority', [roprotu)
  cal.add_component(event)
open('/path/to/tmpfile', 'wb').write(cal.as_string())
os.unlink('path/to/final.ics')
os.rename('/path/to/tmpfile','/path/to/final.ics')


>
> By the way, following a link from the hCalendar pages
> (http://microformats.org/wiki/hcalendar) Don pointed out, we find a good
> explanation of how to best specify an all-day event in RFC 2445's
> iCalendar format:
>
> http://lists.osafoundation.org/pipermail/ietf-calsify/2005-September/000769.html
>
>  Afaik RFC 2445 does not say anything about allday events, but in all
>  implementations I have seen so far the DTEND is exclusive.
>
>  Example for a one day allday event on Jul 15:
>
>  DTSTART;VALUE=DATE:20050715
>  DTEND;VALUE=DATE:20050716
>
>  Think of this being another form for midnight to midnight local time:
>
>  DTSTART:20050715T000000
>  DTEND:20050716T000000
>
> The latter pair (midnight, July 15, 2005 to midnight, July 16, 2005)
> is a good example of what we'll want for such events.


Good to know.




More information about the conspire mailing list