diff --git a/src/extractors/aircoach-ie.js b/src/extractors/aircoach-ie.js new file mode 100644 index 0000000..d18855c --- /dev/null +++ b/src/extractors/aircoach-ie.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(text) { + var res = JsonLd.newBusReservation(); + res.reservationNumber = text.match(/Reference number +(\w+)\n/)[1]; + var date = text.match(/Outward - ([\d\/]+) /)[1]; + var dep = text.match(/Departing: ([\d:]+) (.*?)\n/); + res.reservationFor.departureBusStop.name = dep[2]; + res.reservationFor.departureTime = JsonLd.toDateTime(date + dep[1], "dd/MM/yyyyhh:mm", "en"); + var arr = text.match(/Arriving: ([\d:]+) (.*?)\n/); + res.reservationFor.arrivalBusStop.name = arr[2]; + res.reservationFor.arrivalTime = JsonLd.toDateTime(date + arr[1], "dd/MM/yyyyhh:mm", "en"); + + // operator only serves locations in IE + res.reservationFor.departureBusStop.address.addressCountry = "IE"; + res.reservationFor.arrivalBusStop.address.addressCountry = "IE"; + + return res; +} diff --git a/src/extractors/aircoach-ie.json b/src/extractors/aircoach-ie.json new file mode 100644 index 0000000..0e4ab27 --- /dev/null +++ b/src/extractors/aircoach-ie.json @@ -0,0 +1,12 @@ +{ + "filter": [ + { + "header": "From", + "match": "@aircoach.ie", + "type": "Email" + } + ], + "function": "main", + "script": "aircoach-ie.js", + "type": "Text" +} diff --git a/src/extractors/extractors.qrc b/src/extractors/extractors.qrc index 5f935c7..5759f13 100644 --- a/src/extractors/extractors.qrc +++ b/src/extractors/extractors.qrc @@ -1,72 +1,74 @@ 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 easyjet.json easyjet.js eurowings.json eurowings.js eurowings-pkpass.js fcmtravel.json fcmtravel.js hertz.js hertz.json iberia.json iberia.js klm.json klm.js koleje-malopolskie.json koleje-malopolskie.js korail.json korail.js lufthansa.json lufthansa-pkpass.js nh-hotels.json nh-hotels.js np4.json np4.js regiojet.json regiojet.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 swiss-pkpass.js travelport-galileo.json travelport-galileo.js trenitalia.json trenitalia.js vgn.json vgn.js vueling.json vueling.js