X-Git-Url: http://pere.pagekite.me/gitweb/homepage.git/blobdiff_plain/e6ec658ed7cff06e22bdbd7360d049254b82263f..60bf8a3f215da8c82ec727e3045793dea8edd5a8:/linux/plan2icalendar
diff --git a/linux/plan2icalendar b/linux/plan2icalendar
index d22965dd67..02fc237b36 100755
--- a/linux/plan2icalendar
+++ b/linux/plan2icalendar
@@ -7,6 +7,8 @@
#
# plan,
# icalendar, RFC 2445, iCalendar>
+#
+# Depend on debian package libdate-ical-perl
use warnings;
use strict;
@@ -18,12 +20,12 @@ use Date::ICal;
my @events;
my %opts;
-my $debug = 0;
-unless (getopts('if:o:', \%opts)) {
+unless (getopts('dif:o:', \%opts)) {
usage();
exit 1;
}
+my $debug = $opts{d} || 0;
my $input = $opts{f};
my $output = $opts{o};
@@ -38,6 +40,14 @@ exit 0;
sub usage {
print <) {
- chomp;
- if (m/^BEGIN:VEVENT/) {
- my %event;
- while () {
- chomp;
- last if (m/END:VEVENT/);
- $event{description} = $1 if (m/^DESCRIPTION\s*:\s*(.+)$/);
- $event{created} = $1 if (m/^CREATED\s*:\s*(.+)$/);
- $event{dtend} = $1 if (m/^DTEND\s*:\s*(.+)$/);
- $event{dtstamp} = $1 if (m/^DTSTAMP\s*:\s*(.+)$/);
- $event{dtstart} = $1 if (m/^DTSTART\s*:\s*(.+)$/);
- $event{last-modified} = $1 if (m/^LAST-MODIFIED\s*:\s*(.+)$/);
- $event{sequence} = $1 if (m/^SEQUENCE\s*:\s*(.+)$/);
- $event{summary} = $1 if (m/^SUMMARY\s*:\s*(.+)$/);
- $event{uid} = $1 if (m/^UID\s*:\s*(.+)$/);
- }
- push @events, \%event;
- }
+ chomp;
+ if (m/^BEGIN:VEVENT/) {
+ my %event;
+ while () {
+ chomp;
+ last if (m/END:VEVENT/);
+ $event{description} = $1 if (m/^DESCRIPTION\s*:\s*(.+)$/);
+ $event{created} = $1 if (m/^CREATED\s*:\s*(.+)$/);
+ $event{dtend} = $1 if (m/^DTEND\s*:\s*(.+)$/);
+ $event{dtstamp} = $1 if (m/^DTSTAMP\s*:\s*(.+)$/);
+ $event{dtstart} = $1 if (m/^DTSTART\s*:\s*(.+)$/);
+ $event{last-modified} = $1 if (m/^LAST-MODIFIED\s*:\s*(.+)$/);
+ $event{sequence} = $1 if (m/^SEQUENCE\s*:\s*(.+)$/);
+ $event{summary} = $1 if (m/^SUMMARY\s*:\s*(.+)$/);
+ $event{uid} = $1 if (m/^UID\s*:\s*(.+)$/);
+ }
+ push @events, \%event;
+ print STDERR "Event pushed\n" if $debug;
+ }
}
close (ICALENDAR);
$/ = $oldval;
@@ -174,6 +186,9 @@ sub utf8tolocalmap {
$string =~ s/ø/ø/g;
$string =~ s/æ/æ/g;
$string =~ s/Ã¥/å/g;
+ $string =~ s/Ã
/Å/g;
+ $string =~ s/«/«/g;
+ $string =~ s/»/»/g;
return $string;
}