Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package kitinerary for openSUSE:Factory checked in at 2021-10-13 18:02:29 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/kitinerary (Old) and /work/SRC/openSUSE:Factory/.kitinerary.new.2443 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "kitinerary" Wed Oct 13 18:02:29 2021 rev:40 rq:923917 version:21.08.2 Changes: -------- --- /work/SRC/openSUSE:Factory/kitinerary/kitinerary.changes 2021-09-04 22:34:55.648117517 +0200 +++ /work/SRC/openSUSE:Factory/.kitinerary.new.2443/kitinerary.changes 2021-10-13 18:03:02.754988622 +0200 @@ -1,0 +2,14 @@ +Tue Oct 5 16:28:19 UTC 2021 - Christophe Giboudeaux <christo...@krop.fr> + +- Update to 21.08.2 + * New bugfix release + * For more details please see: + * https://kde.org/announcements/gear/21.08.2/ +- Changes since 21.08.1: + * Correctly decode HTML MIME nodes which specify codecs in HTML and MIME + * Handle US date formats in Accor hotel reservations + * Add extractor for onepagebooking + * Add extractor for Feratel cards + * Fix extracting English language SNCF tickets + +------------------------------------------------------------------- Old: ---- kitinerary-21.08.1.tar.xz kitinerary-21.08.1.tar.xz.sig New: ---- kitinerary-21.08.2.tar.xz kitinerary-21.08.2.tar.xz.sig ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kitinerary.spec ++++++ --- /var/tmp/diff_new_pack.9eQro0/_old 2021-10-13 18:03:03.230989368 +0200 +++ /var/tmp/diff_new_pack.9eQro0/_new 2021-10-13 18:03:03.230989368 +0200 @@ -18,7 +18,7 @@ %bcond_without lang Name: kitinerary -Version: 21.08.1 +Version: 21.08.2 Release: 0 Summary: Data model and extraction system for travel reservations License: LGPL-2.1-or-later ++++++ kitinerary-21.08.1.tar.xz -> kitinerary-21.08.2.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kitinerary-21.08.1/.gitlab-ci.yml new/kitinerary-21.08.2/.gitlab-ci.yml --- old/kitinerary-21.08.1/.gitlab-ci.yml 2021-08-30 18:21:55.000000000 +0200 +++ new/kitinerary-21.08.2/.gitlab-ci.yml 2021-10-05 00:32:51.000000000 +0200 @@ -32,4 +32,4 @@ - cd build && run-clang-tidy variables: PLATFORM: SUSEQt5.15 - BRANCH_GROUP: kf5-qt5 + BRANCH_GROUP: stable-kf5-qt5 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kitinerary-21.08.1/CMakeLists.txt new/kitinerary-21.08.2/CMakeLists.txt --- old/kitinerary-21.08.1/CMakeLists.txt 2021-08-30 18:21:55.000000000 +0200 +++ new/kitinerary-21.08.2/CMakeLists.txt 2021-10-05 00:32:51.000000000 +0200 @@ -3,7 +3,7 @@ # SPDX-License-Identifier: BSD-3-Clause cmake_minimum_required(VERSION 3.16 FATAL_ERROR) -set(PIM_VERSION "5.18.1") +set(PIM_VERSION "5.18.2") project(KItinerary VERSION ${PIM_VERSION}) set(CMAKE_CXX_STANDARD 17) @@ -37,8 +37,8 @@ find_package(SharedMimeInfo 1.3 REQUIRED) endif() -set(KMIME_VERSION "5.18.1") -set(PIM_PKPASS "5.18.1") +set(KMIME_VERSION "5.18.2") +set(PIM_PKPASS "5.18.2") find_package(KF5Mime ${KMIME_VERSION} CONFIG REQUIRED) find_package(KF5CalendarCore ${KF5_MIN_VERSION} CONFIG) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kitinerary-21.08.1/po/ca/kitinerary.po new/kitinerary-21.08.2/po/ca/kitinerary.po --- old/kitinerary-21.08.1/po/ca/kitinerary.po 2021-08-31 02:39:27.000000000 +0200 +++ new/kitinerary-21.08.2/po/ca/kitinerary.po 2021-10-05 07:46:55.000000000 +0200 @@ -181,13 +181,6 @@ #~ msgid "Reservation reference: %1" #~ msgstr "Refer??ncia de la reserva: %1" -#~| msgid "" -#~| "Reservation reference: %1\n" -#~| "Under name: %2\n" -#~| "\n" -#~| "PickUp location: %3\n" -#~| "\n" -#~| "Dropoff Location: %4" #~ msgid "" #~ "Reservation reference: %1\n" #~ "Under name: %2\n" @@ -202,6 +195,3 @@ #~ "Lloc de la recollida: %3\n" #~ "\n" #~ "Lloc de l'entrega: %4" - -#~ msgid "Rent car reservation: %1" -#~ msgstr "Reserva de cotxes per a llogar: %1" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kitinerary-21.08.1/po/ca@valencia/kitinerary.po new/kitinerary-21.08.2/po/ca@valencia/kitinerary.po --- old/kitinerary-21.08.1/po/ca@valencia/kitinerary.po 2021-08-31 02:39:27.000000000 +0200 +++ new/kitinerary-21.08.2/po/ca@valencia/kitinerary.po 2021-10-05 07:46:55.000000000 +0200 @@ -177,31 +177,3 @@ "Refer??ncia de la reserva: %1\n" "Sota el nom: %2\n" "Lloc de la recollida: %3" - -#~ msgid "Reservation reference: %1" -#~ msgstr "Refer??ncia de la reserva: %1" - -#~| msgid "" -#~| "Reservation reference: %1\n" -#~| "Under name: %2\n" -#~| "\n" -#~| "PickUp location: %3\n" -#~| "\n" -#~| "Dropoff Location: %4" -#~ msgid "" -#~ "Reservation reference: %1\n" -#~ "Under name: %2\n" -#~ "\n" -#~ "Pickup location: %3\n" -#~ "\n" -#~ "Dropoff location: %4" -#~ msgstr "" -#~ "Refer??ncia de la reserva: %1\n" -#~ "Sota el nom: %2\n" -#~ "\n" -#~ "Lloc de la recollida: %3\n" -#~ "\n" -#~ "Lloc de l'entrega: %4" - -#~ msgid "Rent car reservation: %1" -#~ msgstr "Reserva de cotxes per a llogar: %1" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kitinerary-21.08.1/po/de/kitinerary.po new/kitinerary-21.08.2/po/de/kitinerary.po --- old/kitinerary-21.08.1/po/de/kitinerary.po 2021-08-31 02:39:27.000000000 +0200 +++ new/kitinerary-21.08.2/po/de/kitinerary.po 2021-10-05 07:46:55.000000000 +0200 @@ -1,4 +1,5 @@ # Burkhard L??ck <lu...@hube-lueck.de>, 2018, 2019, 2020, 2021. +# Frederik Schwarzer <schwar...@kde.org>, 2021. msgid "" msgstr "" "Project-Id-Version: \n" @@ -12,6 +13,7 @@ "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Lokalize 21.08.1\n" #: calendarhandler.cpp:187 #, kde-format diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kitinerary-21.08.1/po/zh_CN/kitinerary.po new/kitinerary-21.08.2/po/zh_CN/kitinerary.po --- old/kitinerary-21.08.1/po/zh_CN/kitinerary.po 2021-08-31 02:39:27.000000000 +0200 +++ new/kitinerary-21.08.2/po/zh_CN/kitinerary.po 2021-10-05 07:46:55.000000000 +0200 @@ -8,7 +8,7 @@ "Project-Id-Version: kdeorg\n" "Report-Msgid-Bugs-To: https://bugs.kde.org\n" "POT-Creation-Date: 2021-05-24 00:17+0000\n" -"PO-Revision-Date: 2021-08-30 11:45\n" +"PO-Revision-Date: 2021-09-27 13:10\n" "Last-Translator: \n" "Language-Team: Chinese Simplified\n" "Language: zh_CN\n" @@ -26,7 +26,7 @@ #, kde-format msgctxt "canceled train/flight/loding reservation" msgid "Canceled: %1" -msgstr "" +msgstr "????????????%1" #: calendarhandler.cpp:217 #, kde-format @@ -104,27 +104,27 @@ #: calendarhandler.cpp:347 #, kde-format msgid "Check-in: %1" -msgstr "" +msgstr "?????????%1" #: calendarhandler.cpp:350 #, kde-format msgid "Check-out: %1" -msgstr "" +msgstr "?????????%1" #: calendarhandler.cpp:353 #, kde-format msgid "Phone: %1" -msgstr "" +msgstr "?????????%1" #: calendarhandler.cpp:356 #, kde-format msgid "Email: %1" -msgstr "" +msgstr "???????????????%1" #: calendarhandler.cpp:359 #, kde-format msgid "Website: %1" -msgstr "" +msgstr "?????????%1" #: calendarhandler.cpp:402 #, kde-format @@ -139,7 +139,7 @@ #: calendarhandler.cpp:464 #, kde-format msgid "Number of people: %1" -msgstr "" +msgstr "?????????%1" #: calendarhandler.cpp:471 calendarhandler.cpp:503 #, kde-format @@ -149,7 +149,7 @@ #: calendarhandler.cpp:481 #, kde-format msgid "Rental car reservation: %1" -msgstr "" +msgstr "???????????????%1" #: calendarhandler.cpp:492 #, kde-format @@ -157,6 +157,8 @@ "Pickup location: %1\n" "%2\n" msgstr "" +"??????????????????%1\n" +"%2\n" #: calendarhandler.cpp:496 #, kde-format @@ -164,6 +166,8 @@ "Dropoff location: %1\n" "%2\n" msgstr "" +"??????????????????%1\n" +"%2\n" #: calendarhandler.cpp:525 #, kde-format @@ -172,3 +176,6 @@ "Under name: %2\n" "Pickup location: %3" msgstr "" +"?????????????????????%1\n" +"???????????????%2\n" +"??????????????????%3" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kitinerary-21.08.1/src/cli/org.kde.kitinerary-extractor.appdata.xml new/kitinerary-21.08.2/src/cli/org.kde.kitinerary-extractor.appdata.xml --- old/kitinerary-21.08.1/src/cli/org.kde.kitinerary-extractor.appdata.xml 2021-08-30 18:21:55.000000000 +0200 +++ new/kitinerary-21.08.2/src/cli/org.kde.kitinerary-extractor.appdata.xml 2021-10-05 00:32:51.000000000 +0200 @@ -101,9 +101,9 @@ <binary>kitinerary-extractor</binary> </provides> <releases> + <release version="5.18.2" date="2021-10-07"/> <release version="5.18.1" date="2021-09-02"/> <release version="5.18.0" date="2021-08-12"/> <release version="5.17.3" date="2021-07-08"/> - <release version="5.17.2" date="2021-06-10"/> </releases> </component> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kitinerary-21.08.1/src/lib/htmldocument.cpp new/kitinerary-21.08.2/src/lib/htmldocument.cpp --- old/kitinerary-21.08.1/src/lib/htmldocument.cpp 2021-08-30 18:21:55.000000000 +0200 +++ new/kitinerary-21.08.2/src/lib/htmldocument.cpp 2021-10-05 00:32:51.000000000 +0200 @@ -366,4 +366,23 @@ #endif } +HtmlDocument* HtmlDocument::fromString(const QString &data, QObject *parent) +{ +#ifdef HAVE_LIBXML2 + const auto utf8Data = data.toUtf8(); + auto tree = htmlReadMemory(utf8Data.constData(), utf8Data.size(), nullptr, "utf-8", HTML_PARSE_RECOVER | HTML_PARSE_NOERROR | HTML_PARSE_NOWARNING | HTML_PARSE_NOBLANKS | HTML_PARSE_NONET | HTML_PARSE_COMPACT); + if (!tree) { + return nullptr; + } + + auto doc = new HtmlDocument(parent); + doc->d->m_doc = tree; + return doc; +#else + Q_UNUSED(data) + Q_UNUSED(parent) + return nullptr; +#endif +} + #include "moc_htmldocument.cpp" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kitinerary-21.08.1/src/lib/htmldocument.h new/kitinerary-21.08.2/src/lib/htmldocument.h --- old/kitinerary-21.08.1/src/lib/htmldocument.h 2021-08-30 18:21:55.000000000 +0200 +++ new/kitinerary-21.08.2/src/lib/htmldocument.h 2021-10-05 00:32:51.000000000 +0200 @@ -86,6 +86,10 @@ * @returns @c nullptr if loading fails or libxml was not found. */ static HtmlDocument* fromData(const QByteArray &data, QObject *parent = nullptr); + /** Creates a HtmlDocument from a given (unicode) string. + * @returns @c nullptr if loading fails or libxml was not found. + */ + static HtmlDocument* fromString(const QString &data, QObject *parent = nullptr); /** Returns the root element of the document. */ HtmlElement root() const; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kitinerary-21.08.1/src/lib/processors/htmldocumentprocessor.cpp new/kitinerary-21.08.2/src/lib/processors/htmldocumentprocessor.cpp --- old/kitinerary-21.08.1/src/lib/processors/htmldocumentprocessor.cpp 2021-08-30 18:21:55.000000000 +0200 +++ new/kitinerary-21.08.2/src/lib/processors/htmldocumentprocessor.cpp 2021-10-05 00:32:51.000000000 +0200 @@ -42,9 +42,8 @@ || fileName.endsWith(QLatin1String(".htm"), Qt::CaseInsensitive); } -ExtractorDocumentNode HtmlDocumentProcessor::createNodeFromData(const QByteArray &encodedData) const +static ExtractorDocumentNode nodeFromHtml(HtmlDocument *html) { - auto html = HtmlDocument::fromData(encodedData); if (!html || html->root().firstChild().isNull()) { return {}; } @@ -54,6 +53,19 @@ return node; } +ExtractorDocumentNode HtmlDocumentProcessor::createNodeFromData(const QByteArray &encodedData) const +{ + return nodeFromHtml(HtmlDocument::fromData(encodedData)); +} + +ExtractorDocumentNode HtmlDocumentProcessor::createNodeFromContent(const QVariant &decodedData) const +{ + if (decodedData.type() == QVariant::String) { + return nodeFromHtml(HtmlDocument::fromString(decodedData.toString())); + } + return ExtractorDocumentProcessor::createNodeFromContent(decodedData); +} + void HtmlDocumentProcessor::expandNode(ExtractorDocumentNode &node, const ExtractorEngine *engine) const { const auto html = node.content<HtmlDocument*>(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kitinerary-21.08.1/src/lib/processors/htmldocumentprocessor.h new/kitinerary-21.08.2/src/lib/processors/htmldocumentprocessor.h --- old/kitinerary-21.08.1/src/lib/processors/htmldocumentprocessor.h 2021-08-30 18:21:55.000000000 +0200 +++ new/kitinerary-21.08.2/src/lib/processors/htmldocumentprocessor.h 2021-10-05 00:32:51.000000000 +0200 @@ -18,6 +18,7 @@ public: bool canHandleData(const QByteArray &encodedData, QStringView fileName) const override; ExtractorDocumentNode createNodeFromData(const QByteArray &encodedData) const override; + ExtractorDocumentNode createNodeFromContent(const QVariant& decodedData) const override; void expandNode(ExtractorDocumentNode &node, const ExtractorEngine *engine) const override; void preExtract(ExtractorDocumentNode &node, const ExtractorEngine *engine) const override; QJSValue contentToScriptValue(const ExtractorDocumentNode &node, QJSEngine *engine) const override; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kitinerary-21.08.1/src/lib/processors/mimedocumentprocessor.cpp new/kitinerary-21.08.2/src/lib/processors/mimedocumentprocessor.cpp --- old/kitinerary-21.08.1/src/lib/processors/mimedocumentprocessor.cpp 2021-08-30 18:21:55.000000000 +0200 +++ new/kitinerary-21.08.2/src/lib/processors/mimedocumentprocessor.cpp 2021-10-05 00:32:51.000000000 +0200 @@ -120,7 +120,7 @@ if ((ct && ct->isPlainText() && fileName.isEmpty()) || (!ct && content->isTopLevel())) { child = engine->documentNodeFactory()->createNode(content->decodedText(), u"text/plain"); } else if (ct && ct->isHTMLText()) { - child = engine->documentNodeFactory()->createNode(content->decodedContent(), fileName, u"text/html"); + child = engine->documentNodeFactory()->createNode(content->decodedText(), u"text/html"); } else { child = engine->documentNodeFactory()->createNode(content->decodedContent(), fileName); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kitinerary-21.08.1/src/lib/scripts/accor.js new/kitinerary-21.08.2/src/lib/scripts/accor.js --- old/kitinerary-21.08.1/src/lib/scripts/accor.js 2021-08-30 18:21:55.000000000 +0200 +++ new/kitinerary-21.08.2/src/lib/scripts/accor.js 2021-10-05 00:32:51.000000000 +0200 @@ -14,14 +14,16 @@ res.reservationNumber = elems[i].firstChild.nextSibling.recursiveContent; } if (title.match(/(Date of stay|Aufenthaltsdatum)/i)) { - var dt = elems[i].firstChild.nextSibling.recursiveContent.match(/(\d{2}([|/.])\d{2}[|/.]\d{4}).*(\d{2}[|/.]\d{2}[|/.]\d{4})/); + const dtStr = elems[i].firstChild.nextSibling.recursiveContent; + var dt = dtStr.match(/(\d{2}[|/.]\d{2}[|/.]\d{4}).*(\d{2}[|/.]\d{2}[|/.]\d{4})/); + if (!dt) { // US format + dt = dtStr.match(/([A-Z][a-z]{2}\. \d{2}, \d{4}).*([A-Z][a-z]{2}\. \d{2}, \d{4})/); + } if (dt) { var separator = dt[2]; - var format = ["dd", "MM", "yyyy"].join(separator); - var lang = (separator === "." ? "de" : "en"); - - res.checkinTime = JsonLd.toDateTime(dt[1], format, lang); - res.checkoutTime = JsonLd.toDateTime(dt[3], format, lang); + const formats = [ "dd.MM.yyyy", "dd/MM/yyyy", "MMM. dd, yyyy"]; + res.checkinTime = JsonLd.toDateTime(dt[1], formats, "en"); + res.checkoutTime = JsonLd.toDateTime(dt[2], formats, "en"); } } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kitinerary-21.08.1/src/lib/scripts/extractors.qrc new/kitinerary-21.08.2/src/lib/scripts/extractors.qrc --- old/kitinerary-21.08.1/src/lib/scripts/extractors.qrc 2021-08-30 18:21:55.000000000 +0200 +++ new/kitinerary-21.08.2/src/lib/scripts/extractors.qrc 2021-10-05 00:32:51.000000000 +0200 @@ -54,6 +54,8 @@ <file>eventbrite.js</file> <file>fcmtravel.json</file> <file>fcmtravel.js</file> + <file>feratel-card.json</file> + <file>feratel-card.js</file> <file>flixbus.json</file> <file>flixbus.js</file> <file>hertz.js</file> @@ -92,6 +94,8 @@ <file>np4.js</file> <file>oebb.json</file> <file>oebb.js</file> + <file>onepagebooking.json</file> + <file>onepagebooking.js</file> <file>regiojet.json</file> <file>regiojet.js</file> <file>regiondo.json</file> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kitinerary-21.08.1/src/lib/scripts/feratel-card.js new/kitinerary-21.08.2/src/lib/scripts/feratel-card.js --- old/kitinerary-21.08.1/src/lib/scripts/feratel-card.js 1970-01-01 01:00:00.000000000 +0100 +++ new/kitinerary-21.08.2/src/lib/scripts/feratel-card.js 2021-10-05 00:32:51.000000000 +0200 @@ -0,0 +1,40 @@ +/* + SPDX-FileCopyrightText: 2021 Kai Uwe Broulik <k...@broulik.de> + SPDX-License-Identifier: LGPL-2.0-or-later +*/ + +function parseReservation(pass, node) { + let res = node.result[0]; + + const secondary = pass.secondaryFields; + const cardName = secondary.find(item => item.key === "cardName"); + const ausgabestelleName = secondary.find(item => item.key === "ausgabestelleName"); + + if (cardName) { + res.underName = JsonLd.newObject("Person"); + res.underName.name = cardName.value; + } + if (ausgabestelleName) { + res.reservationFor.name = ausgabestelleName.value; + } + + const aux = pass.auxiliaryFields; + const cardValidFrom = aux.find(item => item.key === "cardValidFrom"); + const cardValidTo = aux.find(item => item.key === "cardValidTo"); + + if (cardValidFrom) { + res.reservationFor.startDate = cardValidFrom.value; + } + if (cardValidTo) { + res.reservationFor.endDate = cardValidTo.value; + } + + const back = pass.backFields; + const web = back.find(item => item.key === "web"); + + if (web) { + res.reservationFor.url = web.value; + } + + return res; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kitinerary-21.08.1/src/lib/scripts/feratel-card.json new/kitinerary-21.08.2/src/lib/scripts/feratel-card.json --- old/kitinerary-21.08.1/src/lib/scripts/feratel-card.json 1970-01-01 01:00:00.000000000 +0100 +++ new/kitinerary-21.08.2/src/lib/scripts/feratel-card.json 2021-10-05 00:32:51.000000000 +0200 @@ -0,0 +1,13 @@ +{ + "filter": [ + { + "field": "passTypeIdentifier", + "match": "pass\\.com\\.feratel\\.card\\.mobile\\..*", + "mimeType": "application/vnd.apple.pkpass", + "scope": "Current" + } + ], + "function": "parseReservation", + "mimeType": "application/vnd.apple.pkpass", + "script": "feratel-card.js" +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kitinerary-21.08.1/src/lib/scripts/onepagebooking.js new/kitinerary-21.08.2/src/lib/scripts/onepagebooking.js --- old/kitinerary-21.08.1/src/lib/scripts/onepagebooking.js 1970-01-01 01:00:00.000000000 +0100 +++ new/kitinerary-21.08.2/src/lib/scripts/onepagebooking.js 2021-10-05 00:32:51.000000000 +0200 @@ -0,0 +1,61 @@ +/* + SPDX-FileCopyrightText: 2021 Nicolas Fella <nicolas.fe...@gmx.de> + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ + +function main(content) { + + const resId = content.match(/Buchungsnummer:(.+)/)[1] + + const arrivalDate = content.match(/Anreisetag: (.+)/)[1] + const departureDate = content.match(/Abreisetag: (.+)/)[1] + + const guestName = content.match(/Gastname: (Herr|Frau) (.+)/)[2] + + const addressBlock = content.match(/Ihr\n(.*)\n(.*)\n(.*)/) + + const hotelName = addressBlock[1] + + const street = addressBlock[2] + + const cityLine = addressBlock[3].match(/([0-9]+) (.*)/) + + const address = JsonLd.newObject("PostalAddress") + address.addressCountry = "DE" + address.addressLocality = cityLine[2] + address.postalCode = cityLine[1] + address.streetAddress = street + + const telephone = content.match(/Tel.: (.*)/)[1] + const email = content.match(/E-Mail: (.*)/)[1] + + const price = content.match(/Gesamtpreis: (.*) EUR/)[1].replace(',', '.') + + const numberAdults = content.match(/Anzahl der Erwachsener: ([0-9]+)/)[1] + + const numberChildren = content.match(/Anzahl der Kinder: ([0-9]+)/)[1] + + var res = JsonLd.newLodgingReservation() + + res.reservationFor.name = addressBlock[1] + + res.reservationNumber = resId + res.checkinTime = JsonLd.toDateTime(arrivalDate, "dd.MM.yyyy", "de") + res.checkoutTime = JsonLd.toDateTime(departureDate, "dd.MM.yyyy", "de") + + res.reservationFor.telephone = telephone + res.reservationFor.email = email + + res.reservationFor.address = address + + res.underName.name = guestName + + res.totalPrice = price + res.priceCurrency = "EUR" + + res.reservationFor.numAdults = numberAdults + res.reservationFor.numChildren = numberChildren + + return res +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kitinerary-21.08.1/src/lib/scripts/onepagebooking.json new/kitinerary-21.08.2/src/lib/scripts/onepagebooking.json --- old/kitinerary-21.08.1/src/lib/scripts/onepagebooking.json 1970-01-01 01:00:00.000000000 +0100 +++ new/kitinerary-21.08.2/src/lib/scripts/onepagebooking.json 2021-10-05 00:32:51.000000000 +0200 @@ -0,0 +1,13 @@ +{ + "filter": [ + { + "field": "From", + "match": "@onepagebooking.com", + "mimeType": "message/rfc822", + "scope": "Ancestors" + } + ], + "function": "main", + "mimeType": "text/plain", + "script": "onepagebooking.js" +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kitinerary-21.08.1/src/lib/scripts/sncf.js new/kitinerary-21.08.2/src/lib/scripts/sncf.js --- old/kitinerary-21.08.1/src/lib/scripts/sncf.js 2021-08-30 18:21:55.000000000 +0200 +++ new/kitinerary-21.08.2/src/lib/scripts/sncf.js 2021-10-05 00:32:51.000000000 +0200 @@ -6,7 +6,7 @@ function parseSncfPdfText(text) { var reservations = new Array(); - var bookingRef = text.match(/(?:DOSSIER VOYAGE|BOOKING FILE REFERENCE) : +([A-Z0-9]{6})/); + var bookingRef = text.match(/(?:DOSSIER VOYAGE|BOOKING FILE REFERENCE|REFERENCE NUMBER) ?: +([A-Z0-9]{6})/); var pos = 0; while (true) { @@ -18,19 +18,19 @@ var res = JsonLd.newTrainReservation(); res.reservationNumber = bookingRef[1]; - var depLine = text.substr(pos + index).match(/\n {2,3}([\w -]+?) +(\d{2}\/\d{2}) (?:??|at) (\d{2}h\d{2})/); + var depLine = text.substr(pos + index).match(/\n {2,3}([\w -]+?) +(\d{2}\/\d{2}) (?:??|at) (\d{2}[h:]\d{2})/); if (!depLine) break; index += depLine.index + depLine[0].length; res.reservationFor.departureStation.name = depLine[1]; - res.reservationFor.departureTime = JsonLd.toDateTime(depLine[2] + " " + depLine[3], "dd/MM hh'h'mm", "fr"); + res.reservationFor.departureTime = JsonLd.toDateTime(depLine[2] + " " + depLine[3], ["dd/MM hh'h'mm", "dd/MM hh:mm"], "fr"); - var arrLine = text.substr(pos + index).match(/\n {2,3}([\w -]+?) +(\d{2}\/\d{2}) (?:??|at) (\d{2}h\d{2})/); + var arrLine = text.substr(pos + index).match(/\n {2,3}([\w -]+?) +(\d{2}\/\d{2}) (?:??|at) (\d{2}[h:]\d{2})/); if (!arrLine) break; index += arrLine.index + arrLine[0].length; res.reservationFor.arrivalStation.name = arrLine[1]; - res.reservationFor.arrivalTime = JsonLd.toDateTime(arrLine[2] + " " + arrLine[3], "dd/MM hh'h'mm", "fr"); + res.reservationFor.arrivalTime = JsonLd.toDateTime(arrLine[2] + " " + arrLine[3], ["dd/MM hh'h'mm", "dd/MM hh:mm"], "fr"); // parse seat, train number, etc from the text for one leg // since the stations are vertically centered, the stuff we are looking for might be at different @@ -39,7 +39,7 @@ var trainNumber = legText.match(/TRAIN (?:N??|NUMBER) ?(\d{3,5})/); if (trainNumber) res.reservationFor.trainNumber = trainNumber[1]; - var seatRes = legText.match(/(?:VOITURE|COACH) (\d+) - PLACE (\d+)/); + var seatRes = legText.match(/(?:VOITURE|COACH) (\d+) - (?:PLACE|SEAT) (\d+)/); if (seatRes) { res.reservedTicket.ticketedSeat.seatSection = seatRes[1]; res.reservedTicket.ticketedSeat.seatNumber = seatRes[2];