Commit 423df5a9 authored by Volker Krause's avatar Volker Krause
Browse files

Add Regionado pkpass extractor script

parent 71c89572
Pipeline #74080 passed with stage
in 10 minutes and 20 seconds
......@@ -90,6 +90,8 @@
<file>oebb.js</file>
<file>regiojet.json</file>
<file>regiojet.js</file>
<file>regiondo.json</file>
<file>regiondo.js</file>
<file>renfe.json</file>
<file>renfe.js</file>
<file>sas.json</file>
......
/*
SPDX-FileCopyrightText: 2021 Volker Krause <vkrause@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
function parsePass(pass, node) {
var res = node.result[0];
res.reservationFor.startDate = pass.field["when"].value;
res.underName = JsonLd.newObject("Person");
res.underName.name = pass.field["buyer"].value;
var addr = pass.field["venue"].value.match(/(.*), (.*)/);
res.reservationFor.location.name = null;
res.reservationFor.location.address = JsonLd.newObject("PostalAddress");
res.reservationFor.location.address.addressCountry = addr[2];
if (addr[2] == "Deutschland") {
var addr2 = addr[1].match(/(.*) (\d{5} .*) ([A-Z]{2})/);
res.reservationFor.location.address.streetAddress = addr2[1];
res.reservationFor.location.address.addressLocality = addr2[2];
res.reservationFor.location.address.addressRegion = addr2[3];
} else {
res.reservationFor.location.address.streetAddress = addr[1];
}
return res;
}
{
"filter": [
{
"field": "passTypeIdentifier",
"match": "pass.de.regiondo.pass",
"mimeType": "application/vnd.apple.pkpass",
"scope": "Current"
}
],
"function": "parsePass",
"mimeType": "application/vnd.apple.pkpass",
"script": "regiondo.js"
}
Markdown is supported
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