diff --git a/src/extractors/extractors.qrc b/src/extractors/extractors.qrc index e2536d1..15dc69a 100644 --- a/src/extractors/extractors.qrc +++ b/src/extractors/extractors.qrc @@ -1,85 +1,87 @@ acprail.json acprail.js aerlingus.json aerlingus.js airbaltic.json airbaltic.js aircoach-ie.json aircoach-ie.js amadeus.json amadeus.js americanairlines.json americanairlines.js aohostels.json aohostels.js availpro.json availpro.js booking.json booking.js brusselsairlines.json brusselsairlines.js brusselsairlines-receipt.js czechrailways.json czechrailways.js deutschebahn.json deutschebahn.js dinnerbooking.json dinnerbooking.js easyairportparking.json easyairportparking-pkpass.js easyjet.json easyjet.js eurowings.json eurowings.js eurowings-pkpass.js fcmtravel.json fcmtravel.js flixbus.json flixbus.js hertz.js hertz.json iberia.json iberia.js + indigo.json + indigo.js irctc.json irctc.js klm.json klm.js koleje-malopolskie.json koleje-malopolskie.js korail.json korail.js lufthansa.json lufthansa-pkpass.js nationalexpress.json nationalexpress.js nh-hotels.json nh-hotels.js np4.json np4.js regiojet.json regiojet.js renfe.json renfe.js sas.json sas-boardingpass.js sas-receipt.js simplebooking.json simplebooking.js sncf.json sncf.js stansted-express.json stansted-express.js swiss.json swiss.js travelport-galileo.json travelport-galileo.js trenitalia.json trenitalia.js vgn.json vgn.js vueling.json vueling.js diff --git a/src/extractors/indigo.js b/src/extractors/indigo.js new file mode 100644 index 0000000..4938a8b --- /dev/null +++ b/src/extractors/indigo.js @@ -0,0 +1,36 @@ +/* + Copyright (c) 2019 Volker Krause + + 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 main(pdf) { + var res = Context.data[0]; + var page = pdf.pages[Context.pdfPageNumber]; + + // needs to be done manually as we don't have PDF ctime for this to work automatically + var date = page.text.match(/Date +(\d\d \w{3} \d\d)/); + var depTime = page.text.match(/Departure Time\s+(\d\d:\d\d)/); + res.reservationFor.departureTime = JsonLd.toDateTime(date[1] + depTime[1], "dd MMM yyhh:mm", "en"); + var boardingTime = page.text.match(/Boarding Time\s+(\d\d:\d\d)/); + res.reservationFor.boardingTime = JsonLd.toDateTime(date[1] + boardingTime[1], "dd MMM yyhh:mm", "en"); + + var from = page.text.match(/From +(\S.+?)(?:\(|To|\s\s)/); + res.reservationFor.departureAirport.name = from[1]; + var to = page.text.match(/To +(\S.+?)(?:\(|\s\s)/); + res.reservationFor.arrivalAirport.name = to[1]; + return res; +} diff --git a/src/extractors/indigo.json b/src/extractors/indigo.json new file mode 100644 index 0000000..1ecd92a --- /dev/null +++ b/src/extractors/indigo.json @@ -0,0 +1,12 @@ +{ + "filter": [ + { + "match": "6E", + "property": "reservationFor.airline.iataCode", + "type": "JsonLd" + } + ], + "function": "main", + "script": "indigo.js", + "type": "Pdf" +}