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

Extract Ryanair PDF boarding passes

On top of the generic IATA BCBP extraction this now adds times and airport
names.
parent 71148092
Pipeline #76383 passed with stage
in 10 minutes and 14 seconds
......@@ -96,6 +96,8 @@
<file>regiondo.js</file>
<file>renfe.json</file>
<file>renfe.js</file>
<file>ryanair.json</file>
<file>ryanair.js</file>
<file>sas.json</file>
<file>sas-boardingpass.js</file>
<file>sas-receipt.js</file>
......
/*
SPDX-FileCopyrightText: 2021 Volker Krause <vkrause@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
function parseBoardingPass(pdf, node, triggerNode) {
console.log(pdf);
var res = triggerNode.result[0];
const page = pdf.pages[triggerNode.location];
const timesText = page.textInRect(0.5, 0.5, 1, 1);
console.log(timesText);
const times = timesText.match(/\n(\d\d:\d\d)[\s\S]*?\n(\d\d:\d\d)[\s\S]*?\n(\d\d:\d\d)[\s\S]*?\n(\d\d:\d\d)[\s\S]*?\d\d:\d\d\./);
res.reservationFor.boardingTime = JsonLd.toDateTime(times[2], "hh:mm", "en");
res.reservationFor.departureTime = JsonLd.toDateTime(times[3], "hh:mm", "en");
res.reservationFor.arrivalTime = JsonLd.toDateTime(times[4], "hh:mm", "en");
res.reservationFor.departureAirport.name = page.textInRect(0.5, 0.3, 0.75, 0.375);
res.reservationFor.arrivalAirport.name = page.textInRect(0.75, 0.3, 1, 0.375);
return res;
}
{
"filter": [
{
"field": "operatingCarrierDesignator",
"match": "FR",
"mimeType": "internal/iata-bcbp",
"scope": "Descendants"
}
],
"function": "parseBoardingPass",
"mimeType": "application/pdf",
"script": "ryanair.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