How do I disable notifications/reminder and set events to free time with
Perl's ICal::Entry?
Unforunately my university was too lazy to make a google calendar or .ics
for our public events. Instead they choose to wirte us an email with a
formatted text file containing a list of the dates. I have a Perl script
to convert said list, into an iCalendar (.ics) file. I want to import that
.ics into my google calendar later.
So far the script works very well but now I want to disable the standard
notifications (E-Mail and PopUp) and set the events to be free time
(instead of default busy). The problem is, that I don't get anything
usefull out of the documentation for Data::ICal::Entry::FreeBusy and
Data::ICal::Entry::Alarm::Display. Be so kind an provide me with the right
properties to add to the $event->add_properties(...) line in the script
below:
#!/usr/bin/perl -w
# Converts a specially formated text file (list of events) into an .ics
# (iCalendar) file for import into Google-Calendar or other calendar
# applications.
use Date::ICal;
use Data::ICal;
use Data::ICal::Entry::Event;
# Read file into one long string
open FILE, $ARGV[0] or die "Couldn't open file: $!";
my $fstring = join("", <FILE>);
close FILE;
# Prepare calendar
my $calendar = Data::ICal->new();
$calendar->add_properties( method=>"PUBLISH",);
# Add events depending on what was found in file
@events = split("\n\n", $fstring);
foreach $eventstring (@events) {
$eventstring =~ s/(\d+\.\d+\.\d+)//; # remove date from the string
$datestring = $1; #+but save it for processing:
($day, $month, $year) = split(/\./, $datestring);
$title = ( split /\n/, $eventstring )[1];
my $event = Data::ICal::Entry::Event->new();
$event->add_properties(
summary => "Kolloquium: $title",
description => $eventstring,
dtstart => Date::ICal->new( year=>"20$year", month=>$month,
day=>$day, hour=>17, min=>15 )->ical,
dtend => Date::ICal->new( year=>"20$year", month=>$month,
day=>$day, hour=>18, min=>15 )->ical,
dtstamp => Date::ICal->new( epoch => time )->ical,
# MISSING HERE: Right FREEBUSY and ALARM properties. PLEASE HELP!
);
$calendar->add_entry($event);
}
print $calendar->as_string;
Thank you kindly!
No comments:
Post a Comment