1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
#!/usr/bin/perl -w
#$Id$
#Display Calendar invites in a readable form.
use strict;
my %fields =qw(
DTSTART Start
DTEND End
DTSTART;TZID="Eastern" StartEastern
DTEND;TZID="Eastern" EndEastern
DTSTART;TZID="Pacific" StartPacific
DTEND;TZID="Pacific" EndPacific
DTSTART;TZID="Central" StartCentral
DTEND;TZID="Central" EndCentral
DESCRIPTION Description
SUMMARY Summary
LOCATION Location
);
my $marker ='^BEGIN:VEVENT';
my $start;
while (<> ) {
last if (m/$marker/ ) ;
}
print "\n\n";
my @lines;
my $i=0;
while (<>) {
chomp;
if (/^\s/) { #continuation line
s/^\s+//g;
$lines[$i-1] .= $_;
} else {
$lines[$i++]=$_;
}
}
#Process lines
foreach (@lines) {
my ($f, $v) =split(':');
my $key=$fields{$f};
print "$key:\t$v\n" if defined($key);
}
#Process attendee list
print "\nAttendees\n\n";
foreach (@lines) {
my ($f, $v) =split (':',$_,2);
next unless ($f =~ m/ATTENDEE/);
$f =~ s/^ATTENDEE;//g;
print $v,"\n"; # "\t", join("\t", split(';', $f)),"\n";
}
|