Commit 40896e24 authored by Volker Krause's avatar Volker Krause
Browse files

Add Trainline ical extractor script

parent ee07daeb
......@@ -147,6 +147,8 @@
<file>ticketmaster.js</file>
<file>tierparkberlin.json</file>
<file>tierparkberlin.js</file>
<file>trainline.json</file>
<file>trainline.js</file>
<file>travelport-galileo.json</file>
<file>travelport-galileo.js</file>
<file>trenitalia.json</file>
......
/*
SPDX-FileCopyrightText: 2022 Volker Krause <vkrause@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
function parseEvent(event) {
let res = JsonLd.newTrainReservation();
res.reservationFor.departureTime = JsonLd.readQDateTime(event, 'dtStart');
res.reservationFor.arrivalTime = JsonLd.readQDateTime(event, 'dtEnd');
res.reservationFor.departureStation.name = event.location;
res.reservationFor.arrivalStation.name = event.summary.match(/.* → (.*) \[/)[1];
return res;
}
{
"filter": [
{
"field": "uid",
"match": "@trainline.eu$",
"mimeType": "internal/event",
"scope": "Current"
}
],
"function": "parseEvent",
"mimeType": "internal/event",
"script": "trainline.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