Commit 9a335e6d authored by Nicolas Fella's avatar Nicolas Fella
Browse files

Add EasyAirportParking extractor

Summary: easyairportparking (https://www.easyairportparking.de/de) operates airport parking at various German airports. They ship event pkpass files. However, the end date wasn't extracted correctly by the generic extractor, so make a custom one.

Reviewers: vkrause

Reviewed By: vkrause

Subscribers: kde-pim

Tags: #kde_pim

Differential Revision: https://phabricator.kde.org/D23603
parent fcf7724e
/*
Copyright (c) 2019 Nicolas Fella <nicolas.fella@gmx.de>
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(pass)
{
var res = JsonLd.newEventReservation();
res.reservationFor.startDate = JsonLd.toDateTime(pass.field["reservation_time_from"].value, "dd.MM.yyyy", "de");
res.reservationFor.endDate = JsonLd.toDateTime(pass.field["reservation_time_till"].value, "dd.MM.yyyy", "de");
return res;
}
[{
"type": "pkpass",
"filter": [ { "field": "passTypeIdentifier", "match": "pass.com.blueend.customer.eap.ticket" } ],
"script": "easyairportparking-pkpass.js"
}]
......@@ -25,6 +25,8 @@
<file>deutschebahn.js</file>
<file>dinnerbooking.json</file>
<file>dinnerbooking.js</file>
<file>easyairportparking.json</file>
<file>easyairportparking-pkpass.js</file>
<file>easyjet.json</file>
<file>easyjet.js</file>
<file>eurowings.json</file>
......
......@@ -132,6 +132,20 @@ QJSValue JsApi::JsonLd::newLodgingReservation() const
return res;
}
QJSValue KItinerary::JsApi::JsonLd::newEventReservation() const
{
auto resFor = newObject(QStringLiteral("Event"));
auto res = newObject(QStringLiteral("EventReservation"));
res.setProperty(QStringLiteral("reservationFor"), resFor);
const auto ticket = newObject(QStringLiteral("Ticket"));
res.setProperty(QStringLiteral("reservedTicket"), ticket);
return res;
}
QDateTime JsApi::JsonLd::toDateTime(const QString &dtStr, const QString &format, const QString &localeName) const
{
QLocale locale(localeName);
......
......@@ -56,6 +56,8 @@ public:
* This can be used by extractor scripts to fill in the extracted information.
*/
Q_INVOKABLE QJSValue newLodgingReservation() const;
Q_INVOKABLE QJSValue newEventReservation() const;
// TODO add the same for other reservation types
/** Convert a date/time string to a date/time value.
......
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