Commit 3c4c3c22 authored by Volker Krause's avatar Volker Krause
Browse files

Add extractor for Travelport Galileo reservations

Despite being a backend system, like with Amadeus this is nevertheless
exposed to consumers regularly.
parent 4f311a3a
From: care@via.com
Date: Sun, 01 Jan 2017 12:34:56 +0100
bla bla bla
1.1KONQUI/KATIE MS 2.1KONQUI/DOCTOR MR 3.1KONQUI/LITTLE*07JAN2007
1. DL 38 Y 20JAN HKGSEA HS3 1145 0811 O SA
FONE-SZXT*MPT-098765432109
TKTG-TAU/SU20DEC
SI.P1/SSRDOCSDLHK1/P/CH/E12345678/CH/07JAN76/F/05JUN23/KONQUI/KATIE
SI.P2/SSRDOCSDLHK1/P/CH/E12345678/CH/07JAN76/M/05JUN23/KONQUI/DOCTOR
SI.P3/SSRDOCSDLHK1/P/CH/E12345678/CH/07JAN07/F/05JUN23/KONQUI/LITTLE
bla bla bla
[
{
"@context": "http://schema.org",
"@type": "FlightReservation",
"reservationFor": {
"@type": "Flight",
"airline": {
"@type": "Airline",
"iataCode": "DL"
},
"arrivalAirport": {
"@type": "Airport",
"address": {
"@type": "PostalAddress",
"addressCountry": "US"
},
"geo": {
"@type": "GeoCoordinates",
"latitude": 47.44889831542969,
"longitude": -122.30899810791016
},
"iataCode": "SEA"
},
"arrivalTime": {
"@type": "QDateTime",
"@value": "2017-01-21T08:11:00-08:00",
"timezone": "America/Los_Angeles"
},
"departureAirport": {
"@type": "Airport",
"address": {
"@type": "PostalAddress",
"addressCountry": "CN"
},
"geo": {
"@type": "GeoCoordinates",
"latitude": 22.308900833129883,
"longitude": 113.91400146484375
},
"iataCode": "HKG"
},
"departureDay": "2017-01-20",
"departureTime": {
"@type": "QDateTime",
"@value": "2017-01-20T11:45:00+08:00",
"timezone": "Asia/Hong_Kong"
},
"flightNumber": "38"
},
"underName": {
"@type": "Person",
"familyName": "KONQUI",
"givenName": "DOCTOR MR",
"name": "DOCTOR MR KONQUI"
}
},
{
"@context": "http://schema.org",
"@type": "FlightReservation",
"reservationFor": {
"@type": "Flight",
"airline": {
"@type": "Airline",
"iataCode": "DL"
},
"arrivalAirport": {
"@type": "Airport",
"address": {
"@type": "PostalAddress",
"addressCountry": "US"
},
"geo": {
"@type": "GeoCoordinates",
"latitude": 47.44889831542969,
"longitude": -122.30899810791016
},
"iataCode": "SEA"
},
"arrivalTime": {
"@type": "QDateTime",
"@value": "2017-01-21T08:11:00-08:00",
"timezone": "America/Los_Angeles"
},
"departureAirport": {
"@type": "Airport",
"address": {
"@type": "PostalAddress",
"addressCountry": "CN"
},
"geo": {
"@type": "GeoCoordinates",
"latitude": 22.308900833129883,
"longitude": 113.91400146484375
},
"iataCode": "HKG"
},
"departureDay": "2017-01-20",
"departureTime": {
"@type": "QDateTime",
"@value": "2017-01-20T11:45:00+08:00",
"timezone": "Asia/Hong_Kong"
},
"flightNumber": "38"
},
"underName": {
"@type": "Person",
"familyName": "KONQUI",
"givenName": "KATIE MS",
"name": "KATIE MS KONQUI"
}
},
{
"@context": "http://schema.org",
"@type": "FlightReservation",
"reservationFor": {
"@type": "Flight",
"airline": {
"@type": "Airline",
"iataCode": "DL"
},
"arrivalAirport": {
"@type": "Airport",
"address": {
"@type": "PostalAddress",
"addressCountry": "US"
},
"geo": {
"@type": "GeoCoordinates",
"latitude": 47.44889831542969,
"longitude": -122.30899810791016
},
"iataCode": "SEA"
},
"arrivalTime": {
"@type": "QDateTime",
"@value": "2017-01-21T08:11:00-08:00",
"timezone": "America/Los_Angeles"
},
"departureAirport": {
"@type": "Airport",
"address": {
"@type": "PostalAddress",
"addressCountry": "CN"
},
"geo": {
"@type": "GeoCoordinates",
"latitude": 22.308900833129883,
"longitude": 113.91400146484375
},
"iataCode": "HKG"
},
"departureDay": "2017-01-20",
"departureTime": {
"@type": "QDateTime",
"@value": "2017-01-20T11:45:00+08:00",
"timezone": "Asia/Hong_Kong"
},
"flightNumber": "38"
},
"underName": {
"@type": "Person",
"familyName": "KONQUI",
"givenName": "LITTLE",
"name": "LITTLE KONQUI"
}
}
]
bla bla bla
1.1DOE/JOHNMR
1. EY 289 E 09JAN AMDAUH TK1 0505 0700 O*
2. EY 83 E 09JAN AUHFCO HK1 0850 1300 O*
3. EY 3000 E 09JAN FCOVLC HK1 1500 1705 O*
OPERATED BY ALITALIA S.P.A
4. EY 3001 V 16JAN VLCFCO HK1 1755 1955 O*
OPERATED BY ALITALIA S.P.A
5. EY 84 V 16JAN FCOAUH HK1 2200 #0605 O*
6. EY 226 V 17JAN AUHAMD TK1 1000 1445 O*
bla bla bla
[
{
"@context": "http://schema.org",
"@type": "FlightReservation",
"reservationFor": {
"@type": "Flight",
"airline": {
"@type": "Airline",
"iataCode": "EY"
},
"arrivalAirport": {
"@type": "Airport",
"address": {
"@type": "PostalAddress",
"addressCountry": "AE"
},
"geo": {
"@type": "GeoCoordinates",
"latitude": 24.4330997467041,
"longitude": 54.651100158691406
},
"iataCode": "AUH"
},
"arrivalTime": {
"@type": "QDateTime",
"@value": "2017-01-09T07:00:00+04:00",
"timezone": "Asia/Dubai"
},
"departureAirport": {
"@type": "Airport",
"address": {
"@type": "PostalAddress",
"addressCountry": "IN"
},
"geo": {
"@type": "GeoCoordinates",
"latitude": 23.077199935913086,
"longitude": 72.63469696044922
},
"iataCode": "AMD"
},
"departureDay": "2017-01-09",
"departureTime": {
"@type": "QDateTime",
"@value": "2017-01-09T05:05:00+05:30",
"timezone": "Asia/Kolkata"
},
"flightNumber": "289"
},
"underName": {
"@type": "Person",
"familyName": "DOE",
"givenName": "JOHNMR",
"name": "JOHNMR DOE"
}
},
{
"@context": "http://schema.org",
"@type": "FlightReservation",
"reservationFor": {
"@type": "Flight",
"airline": {
"@type": "Airline",
"iataCode": "EY"
},
"arrivalAirport": {
"@type": "Airport",
"address": {
"@type": "PostalAddress",
"addressCountry": "IT"
},
"geo": {
"@type": "GeoCoordinates",
"latitude": 41.80030059814453,
"longitude": 12.238900184631348
},
"iataCode": "FCO"
},
"arrivalTime": {
"@type": "QDateTime",
"@value": "2017-01-09T13:00:00+01:00",
"timezone": "Europe/Rome"
},
"departureAirport": {
"@type": "Airport",
"address": {
"@type": "PostalAddress",
"addressCountry": "AE"
},
"geo": {
"@type": "GeoCoordinates",
"latitude": 24.4330997467041,
"longitude": 54.651100158691406
},
"iataCode": "AUH"
},
"departureDay": "2017-01-09",
"departureTime": {
"@type": "QDateTime",
"@value": "2017-01-09T08:50:00+04:00",
"timezone": "Asia/Dubai"
},
"flightNumber": "83"
},
"underName": {
"@type": "Person",
"familyName": "DOE",
"givenName": "JOHNMR",
"name": "JOHNMR DOE"
}
},
{
"@context": "http://schema.org",
"@type": "FlightReservation",
"reservationFor": {
"@type": "Flight",
"airline": {
"@type": "Airline",
"iataCode": "EY",
"name": "ALITALIA S.P.A"
},
"arrivalAirport": {
"@type": "Airport",
"address": {
"@type": "PostalAddress",
"addressCountry": "ES"
},
"geo": {
"@type": "GeoCoordinates",
"latitude": 39.48939895629883,
"longitude": -0.48166701197624207
},
"iataCode": "VLC"
},
"arrivalTime": {
"@type": "QDateTime",
"@value": "2017-01-09T17:05:00+01:00",
"timezone": "Europe/Madrid"
},
"departureAirport": {
"@type": "Airport",
"address": {
"@type": "PostalAddress",
"addressCountry": "IT"
},
"geo": {
"@type": "GeoCoordinates",
"latitude": 41.80030059814453,
"longitude": 12.238900184631348
},
"iataCode": "FCO"
},
"departureDay": "2017-01-09",
"departureTime": {
"@type": "QDateTime",
"@value": "2017-01-09T15:00:00+01:00",
"timezone": "Europe/Rome"
},
"flightNumber": "3000"
},
"underName": {
"@type": "Person",
"familyName": "DOE",
"givenName": "JOHNMR",
"name": "JOHNMR DOE"
}
},
{
"@context": "http://schema.org",
"@type": "FlightReservation",
"reservationFor": {
"@type": "Flight",
"airline": {
"@type": "Airline",
"iataCode": "EY",
"name": "ALITALIA S.P.A"
},
"arrivalAirport": {
"@type": "Airport",
"address": {
"@type": "PostalAddress",
"addressCountry": "IT"
},
"geo": {
"@type": "GeoCoordinates",
"latitude": 41.80030059814453,
"longitude": 12.238900184631348
},
"iataCode": "FCO"
},
"arrivalTime": {
"@type": "QDateTime",
"@value": "2017-01-16T19:55:00+01:00",
"timezone": "Europe/Rome"
},
"departureAirport": {
"@type": "Airport",
"address": {
"@type": "PostalAddress",
"addressCountry": "ES"
},
"geo": {
"@type": "GeoCoordinates",
"latitude": 39.48939895629883,
"longitude": -0.48166701197624207
},
"iataCode": "VLC"
},
"departureDay": "2017-01-16",
"departureTime": {
"@type": "QDateTime",
"@value": "2017-01-16T17:55:00+01:00",
"timezone": "Europe/Madrid"
},
"flightNumber": "3001"
},
"underName": {
"@type": "Person",
"familyName": "DOE",
"givenName": "JOHNMR",
"name": "JOHNMR DOE"
}
},
{
"@context": "http://schema.org",
"@type": "FlightReservation",
"reservationFor": {
"@type": "Flight",
"airline": {
"@type": "Airline",
"iataCode": "EY"
},
"arrivalAirport": {
"@type": "Airport",
"address": {
"@type": "PostalAddress",
"addressCountry": "AE"
},
"geo": {
"@type": "GeoCoordinates",
"latitude": 24.4330997467041,
"longitude": 54.651100158691406
},
"iataCode": "AUH"
},
"arrivalTime": {
"@type": "QDateTime",
"@value": "2017-01-17T06:05:00+04:00",
"timezone": "Asia/Dubai"
},
"departureAirport": {
"@type": "Airport",
"address": {
"@type": "PostalAddress",
"addressCountry": "IT"
},
"geo": {
"@type": "GeoCoordinates",
"latitude": 41.80030059814453,
"longitude": 12.238900184631348
},
"iataCode": "FCO"
},
"departureDay": "2017-01-16",
"departureTime": {
"@type": "QDateTime",
"@value": "2017-01-16T22:00:00+01:00",
"timezone": "Europe/Rome"
},
"flightNumber": "84"
},
"underName": {
"@type": "Person",
"familyName": "DOE",
"givenName": "JOHNMR",
"name": "JOHNMR DOE"
}
},
{
"@context": "http://schema.org",
"@type": "FlightReservation",
"reservationFor": {
"@type": "Flight",
"airline": {
"@type": "Airline",
"iataCode": "EY"
},
"arrivalAirport": {
"@type": "Airport",
"address": {
"@type": "PostalAddress",
"addressCountry": "IN"
},
"geo": {
"@type": "GeoCoordinates",
"latitude": 23.077199935913086,
"longitude": 72.63469696044922
},
"iataCode": "AMD"
},
"arrivalTime": {
"@type": "QDateTime",
"@value": "2017-01-17T14:45:00+05:30",
"timezone": "Asia/Kolkata"
},
"departureAirport": {
"@type": "Airport",
"address": {
"@type": "PostalAddress",
"addressCountry": "AE"
},
"geo": {
"@type": "GeoCoordinates",
"latitude": 24.4330997467041,
"longitude": 54.651100158691406
},
"iataCode": "AUH"
},
"departureDay": "2017-01-17",
"departureTime": {
"@type": "QDateTime",
"@value": "2017-01-17T10:00:00+04:00",
"timezone": "Asia/Dubai"
},
"flightNumber": "226"
},
"underName": {
"@type": "Person",
"familyName": "DOE",
"givenName": "JOHNMR",
"name": "JOHNMR DOE"
}
}
]
......@@ -60,6 +60,8 @@
<file>swiss.json</file>
<file>swiss.js</file>
<file>swiss-pkpass.js</file>
<file>travelport-galileo.json</file>
<file>travelport-galileo.js</file>
<file>trenitalia.json</file>
<file>trenitalia.js</file>
<file>vueling.json</file>
......
/*
Copyright (c) 2019 Volker Krause <vkrause@kde.org>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
function parsePNR(text) {
var reservations = new Array();
var passengers = new Array();
var pos = 0;
while (true) {
var passenger = text.substr(pos).match(/\d\.1(.+?)\/([\w\s]+?)(?:\*| |\n)/);
if (!passenger)
break;
pos += passenger.index + passenger[0].length;
var person = JsonLd.newObject("Person");
person.familyName = passenger[1];
person.givenName = passenger[2];
passengers.push(person);