//
// "Saturday","10:00 - 10:15 EDT - Welcome address","Welcome Address by FSF","Jupiter","LibrePlanet special sessions","LibrePlanet 2022","","","http://libreplanet.org/2022/speakers/#5910"
+
include 'ICS.php';
$csv = array_map('str_getcsv', explode("\n", stream_get_contents(STDIN)));
+// print out header for vcalendar
+?>BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//FSF//lp-csv-to-ics//EN
+CALSCALE:GREGORIAN
+NAME:LibrePlanet 2022
+<?php
+
foreach ($csv as $linenum => $line) {
if (count($line) <= 1) {
'url' => str_replace("http:", "https:", $line[8]),
));
- echo $ics->to_string();
-
- echo "\n\n";
+ // print the trimmed event string
+ $trimmed_event = array();
+ preg_match("/.*(BEGIN:VEVENT.*END:VEVENT).*/ms", $ics->to_string(), $trimmed_event);
+ echo $trimmed_event[1];
+ echo "\n";
}
+// print out footer for vcalendar
+echo "END:VCALENDAR\r\n";
+