Commit 1ae9d49c authored by Volker Krause's avatar Volker Krause
Browse files

Augment arrival time from ZSSK PDF tickets when present

That's missing in the barcode.
parent d5065ae1
Pipeline #192451 passed with stage
in 3 minutes and 39 seconds
......@@ -46,3 +46,12 @@ function parseDomesticBarcode(data) {
res.reservedTicket.ticketToken = 'aztecbin:' + ByteArray.toBase64(data);
return res;
}
function parseDomesticPdf(pdf, node, triggerNode) {
const text = pdf.pages[triggerNode.location].text;
// TODO multi-leg support?
const leg = text.match(/\d{2}\.\d{2}.\d{2} +\d{2}:\d{2} +.* -> .* +(\d{2}\.\d{2}\.\d{2} +\d{2}:\d{2})/);
let res = triggerNode.result[0];
res.reservationFor.arrivalTime = JsonLd.toDateTime(leg[1], 'dd.MM.yy hh:mm', 'sk');
return res;
}
{
"filter": [
{
"match": "^\\x04\\x01",
"mimeType": "application/octet-stream",
"scope": "Current"
}
],
"function": "parseDomesticBarcode",
"mimeType": "application/octet-stream",
"script": "zssk.js"
}
[
{
"filter": [
{
"match": "^\\x04\\x01",
"mimeType": "application/octet-stream",
"scope": "Current"
}
],
"function": "parseDomesticBarcode",
"mimeType": "application/octet-stream",
"script": "zssk.js"
},
{
"filter": [
{
"match": "^\\x04\\x01",
"mimeType": "application/octet-stream",
"scope": "Descendants"
}
],
"function": "parseDomesticPdf",
"mimeType": "application/pdf",
"script": "zssk.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