Commit 6966d67c authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇 Committed by Volker Krause
Browse files

Support German Eurowings booking confirmation

parent 8706d95f
......@@ -6,11 +6,11 @@
function main(text) {
var reservations = new Array();
var bookingRef = text.match(/Individual reservation code:\s*\*\* ([A-Z0-9]{6})/);
var bookingRef = text.match(/(?:Individual reservation code|Individueller Buchungscode):\s*\*\* ([A-Z0-9]{6})/);
var pos = 0;
while (true) {
var flightLine = text.substr(pos).match(/Flight: ([0-9]{2}\.[0-9]{2}\.[0-9]{4})\s*\|\s*([A-Z0-9]{2}) ([0-9]{3,4}).*\n/);
var flightLine = text.substr(pos).match(/(?:Flight|Flug): ([0-9]{2}\.[0-9]{2}\.[0-9]{4})\s*\|\s*([A-Z0-9]{2}) ([0-9]{3,4}).*\n/);
if (!flightLine)
break;
var idx = flightLine.index + flightLine[0].length;
......@@ -21,20 +21,20 @@ function main(text) {
res.reservationFor.airline.iataCode = flightLine[2];
var opByLine = text.substr(pos + idx).match(/^\s*\* operated by (.*)\n/);
var opByLine = text.substr(pos + idx).match(/^\s*\* (?:operated by|durchgeführt von) (.*)\n/);
if (opByLine) {
idx += opByLine.index + opByLine[0].length;
res.reservationFor.airline.name = opByLine[1];
}
var depLine = text.substr(pos + idx).match(/Departure:\s*([0-9]{2}:[0-9]{2})\s+(.*)\n/);
var depLine = text.substr(pos + idx).match(/(?:Departure|Abflug):\s*([0-9]{2}:[0-9]{2})\s+(.*)\n/);
if (!depLine)
break;
idx += depLine.index + depLine[0].length;
res.reservationFor.departureTime = JsonLd.toDateTime(flightLine[1] + ' ' + depLine[1], "dd.MM.yyyy hh:mm", "en");
res.reservationFor.departureAirport.name = depLine[2];
var arrLine = text.substr(pos + idx).match(/Arrival:\s*([0-9]{2}:[0-9]{2})\s+(.*)\n/);
var arrLine = text.substr(pos + idx).match(/(?:Arrival|Ankunft):\s*([0-9]{2}:[0-9]{2})\s+(.*)\n/);
if (!arrLine)
break;
idx += arrLine.index + arrLine[0].length;
......
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