From: Petter Reinholdtsen Date: Mon, 3 Jan 2005 18:32:56 +0000 (+0000) Subject: Add plan2icalendar script. X-Git-Url: https://pere.pagekite.me/gitweb/homepage.git/commitdiff_plain/b052f5d4202f82bed19ec2a133c4de9b1a58079f?ds=inline;hp=9a20c4b439106a5514fa762600939efa703d1179 Add plan2icalendar script. --- diff --git a/linux/index.html b/linux/index.html index 8131b2da03..c4afd907ee 100644 --- a/linux/index.html +++ b/linux/index.html @@ -32,6 +32,12 @@
ypserv-2.8.92-20030610.diff - 2003-06-02
Porting ypserv to non-linux platforms.
+
plan2icalendar - + 2002-01-10
+
Convert plan + files to iCalendar + format.
+
gprof-callgraph.pl - 2001-12-12
Create a VCG or a dot call graph file from the output generated diff --git a/linux/plan2icalendar b/linux/plan2icalendar new file mode 100755 index 0000000000..92ef801561 --- /dev/null +++ b/linux/plan2icalendar @@ -0,0 +1,122 @@ +#!/usr/bin/perl -w +# +# Author: Petter Reinholdtsen +# Date: 2002-01-10 +# +# Convert plan calender data to icalender format. +# +# plan, +# icalendar, RFC 2445, iCalendar> + +use Date::Parse; +use Date::Format; + +my @events; + +my $mailto = "pere\@hungry.com"; + +read_planfile(".plan.dir/dayplan"); +write_icalendar(); + +sub read_planfile { + my ($planfile) = @_; + open(PLAN, "<$planfile") || die "Unable to read $planfile"; + my $planver = ; + chomp $planver; + while () { + chomp; + if (m%\d+/\d+/\d+\s%) { + my ($date, $start, $duration) = split(/\s+/); + my $info = ; + chomp $info; + my ($dontknow, $msg) = $info =~ m/^(.)\t(.+)$/; + print STDERR "E: $date $start $duration $msg\n"; + + my $timestamp = str2time("$date $start"); + $isostartstamp = time2str("%Y%m%dT%H%M%S", $timestamp); + + my @f = split(/:/, $duration); + $timestamp += ($f[0]*60*60 + $f[1]*60 +$f[2]); + $isoendstamp = time2str("%Y%m%dT%H%M%S", $timestamp); + + print STDERR "IE: $isostartstamp $isoendstamp\n"; + push(@events, { + organizer => "$mailto", + summary => $msg, + dtstart => $isostartstamp, + dtend => $isoendstamp, + priority => '1' + }); + } + } + close(PLAN); +} + + +# BEGIN:VCALENDAR +# PRODID +# :-//K Desktop Environment//NONSGML KOrganizer//EN +# VERSION +# :2.0 +# BEGIN:VEVENT +# CREATED +# :20020110T153939 +# UID +# :KOrganizer-141229514.660 +# SEQUENCE +# :0 +# LAST-MODIFIED +# :20020110T153939 +# DTSTAMP +# :20020110T153952 +# ORGANIZER +# :MAILTO:pre@diskless.uio.no +# SUMMARY +# :SL-veiledning +# PRIORITY +# :1 +# DTSTART +# :20020114T151500 +# DTEND +# :20020114T160000 +# END:VEVENT +# END:VCALENDAR +sub write_icalendar { + print <{organizer} +SUMMARY + :$event->{summary} +PRIORITY + :$event->{priority} +DTSTART + :$event->{dtstart} +DTEND + :$event->{dtend} +END:VEVENT +EOF + $count++; + } + print "END:VCALENDAR\n"; +}