Commit f53cf7f6 authored by Volker Krause's avatar Volker Krause
Browse files

Add extractor script for DB ical events

parent 894c1c35
......@@ -283,3 +283,13 @@ function parseBahncard(code, node) {
bc.validUntil = JsonLd.readQDateTime(code, 'validUntil');
return bc.programName != undefined ? bc : undefined;
}
function parseEvent(event) {
let res = JsonLd.newTrainReservation();
const names = event.summary.match(/(.*) -> (.*)/);
res.reservationFor.departureStation.name = names[1];
res.reservationFor.departureTime = JsonLd.readQDateTime(event, 'dtStart');
res.reservationFor.arrivalStation.name = names[2];
res.reservationFor.arrivalTime = JsonLd.readQDateTime(event, 'dtEnd');
return res;
}
......@@ -75,5 +75,18 @@
"function": "parseBahncard",
"mimeType": "internal/uic9183",
"script": "deutschebahn.js"
},
{
"filter": [
{
"field": "uid",
"match": "^bahn\\d{14}$",
"mimeType": "internal/event",
"scope": "Current"
}
],
"function": "parseEvent",
"mimeType": "internal/event",
"script": "deutschebahn.js"
}
]
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment