]>
pere.pagekite.me Git - homepage.git/blob - linux/plan2icalendar
3 # Author: Petter Reinholdtsen <pere@hungry.com>
6 # Convert plan calender data to icalender format.
8 # plan, <URL:http://www.bitrot.de/>
9 # icalendar, RFC 2445, <URL:http://www.faqs.org/rfcs/rfc2445.html">iCalendar>
16 my $mailto = "pere\@hungry.com";
18 read_planfile
(".plan.dir/dayplan");
23 open(PLAN
, "<$planfile") || die "Unable to read $planfile";
28 if (m
%\d
+/\d+/\d
+\s
%) {
29 my ($date, $start, $duration) = split(/\s+/);
32 my ($dontknow, $msg) = $info =~ m/^(.)\t(.+)$/;
33 print STDERR
"E: $date $start $duration $msg\n";
35 my $timestamp = str2time
("$date $start");
36 $isostartstamp = time2str
("%Y%m%dT%H%M%S", $timestamp);
38 my @f = split(/:/, $duration);
39 $timestamp += ($f[0]*60*60 + $f[1]*60 +$f[2]);
40 $isoendstamp = time2str
("%Y%m%dT%H%M%S", $timestamp);
42 print STDERR
"IE: $isostartstamp $isoendstamp\n";
44 organizer
=> "$mailto",
46 dtstart
=> $isostartstamp,
47 dtend
=> $isoendstamp,
58 # :-//K Desktop Environment//NONSGML KOrganizer//EN
65 # :KOrganizer-141229514.660
73 # :MAILTO:pre@diskless.uio.no
88 :-//K Desktop Environment//NONSGML KOrganizer//EN
94 for $event (@events) {
100 :plan2icalendar-$count
108 :MAILTO:$event->{organizer}
121 print "END:VCALENDAR\n";