Commit 8294be77 authored by Volker Krause's avatar Volker Krause
Browse files

Add extractor script for PKP domestic ticket barcodes

parent c77e8de2
Pipeline #244025 passed with stage
in 10 minutes and 5 seconds
......@@ -120,6 +120,8 @@
<file>onepagebooking.js</file>
<file>peach-aviation.json</file>
<file>peach-aviation.js</file>
<file>pkp.json</file>
<file>pkp.js</file>
<file>pretix.json</file>
<file>pretix.js</file>
<file>regiojet.json</file>
......
/*
SPDX-FileCopyrightText: 2022 Volker Krause <vkrause@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
// see https://community.kde.org/KDE_PIM/KItinerary/PKP_Barcode
function parseBarcode(content, node) {
const layout = content.ticketLayout;
let res = JsonLd.newTrainReservation();
res.reservedTicket = node.result[0];
res.reservedTicket.issuedBy = undefined; // invalid UIC company code
res.reservedTicket.name = layout.text(2, 0, 72, 1);
res.reservationFor.departureTime = JsonLd.toDateTime(layout.text(10, 0, 72, 1) + ' ' + layout.text(11, 0, 72, 1), 'hh:mm dd.MM', 'pl');
res.reservationFor.arrivalTime = JsonLd.toDateTime(layout.text(14, 0, 72, 1) + ' ' + layout.text(15, 0, 72, 1), 'hh:mm dd.MM', 'pl');
res.reservedTicket.ticketedSeat.seatingType = layout.text(16, 0, 72, 1);
res.reservationFor.trainNumber = layout.text(18, 0, 72, 1);
res.reservedTicket.ticketedSeat.seatNumber = layout.text(23, 0, 72, 1);
res.reservationNumber = layout.text(31, 0, 72, 1);
res.reservationFor.departureStation.name = layout.text(41, 0, 72, 1);
res.reservationFor.arrivalStation.name = layout.text(42, 0, 72, 1);
return res;
}
{
"filter": [
{
"field": "carrierId",
"match": "0004",
"mimeType": "internal/uic9183",
"scope": "Current"
}
],
"function": "parseBarcode",
"mimeType": "internal/uic9183",
"script": "pkp.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