不幸的是,我的大学懒得制作谷歌日历或.ics
我们的公共活动。相反,他们选择给我们写一封电子邮件,其中包含一个包含日期列表的格式化文本文件。我有一个 Perl 脚本将所述列表转换为 iCalendar ( .ics
) 文件。我想.ics
稍后将其导入我的谷歌日历。
到目前为止,脚本运行良好,但现在我想禁用标准通知(电子邮件和弹出窗口)并将事件设置为空闲时间(而不是默认忙碌)。问题是,我没有从Data::ICal::Entry::FreeBusy和Data::ICal::Entry::Alarm::Display的文档中得到任何有用的信息。请善待我,为我提供正确的属性以添加到$event->add_properties(...)
下面脚本中的行:
#!/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
my @events = split("\n\n", $fstring);
foreach $eventstring (@events) {
my $eventstring =~ s/(\d+\.\d+\.\d+)//; # remove date from the string
my $datestring = $1; #+but save it for processing:
($day, $month, $year) = split(/\./, $datestring);
$title = ( split /\n/, $eventstring )[1]; # what is left is the title
my $event = Data::ICal::Entry::Event->new();
$event->add_properties(
summary => "Kolloquium: $title",
description => $eventstring, #+and the long description
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;
非常感谢你!