Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
KItinerary
Commits
9a7be742
Commit
9a7be742
authored
Nov 28, 2022
by
Volker Krause
Browse files
Add caesar-data hotel booking extractor script
parent
1f8aa6c9
Pipeline
#276239
passed with stage
in 4 minutes and 13 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/lib/scripts/caesar-data.js
0 → 100644
View file @
9a7be742
/*
SPDX-FileCopyrightText: 2022 Volker Krause <vkrause@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
function
parseConfirmationEmail
(
content
)
{
const
text
=
content
.
root
.
recursiveContent
;
let
res
=
JsonLd
.
newLodgingReservation
();
res
.
reservationNumber
=
text
.
match
(
/Buchungs-Nr.:
(
.*
?)[\s\n]
/
)[
1
];
const
timeRange
=
text
.
match
(
/Ankunft:
(
.*
?)
- Abreise:
(
.*
)\n
/
);
res
.
checkinDate
=
JsonLd
.
toDateTime
(
timeRange
[
1
],
'
dd. MMMM yyyy
'
,
'
de
'
);
res
.
checkoutDate
=
JsonLd
.
toDateTime
(
timeRange
[
2
],
'
dd. MMMM yyyy
'
,
'
de
'
);
res
.
underName
.
name
=
text
.
match
(
/Daten des Bestellers:
\n(?:
Herr|Frau
)
(
.*
)\n
/
)[
1
];
const
addr
=
text
.
match
(
/
(
.*
)\n(
.*
)\n(
.*
)\n
Tel.:
(
.*
)\n
Fax: .*
\n(
http.*
)\n(
.*@.*
)\n
/
);
res
.
reservationFor
.
name
=
addr
[
1
];
res
.
reservationFor
.
address
.
streetAddress
=
addr
[
2
];
res
.
reservationFor
.
address
.
addressLocality
=
addr
[
3
];
res
.
reservationFor
.
telephone
=
addr
[
4
];
res
.
reservationFor
.
url
=
addr
[
5
];
res
.
reservationFor
.
email
=
addr
[
6
];
return
res
;
}
src/lib/scripts/caesar-data.json
0 → 100644
View file @
9a7be742
{
"filter"
:
[
{
"field"
:
"From"
,
"match"
:
"@caesar-data.com"
,
"mimeType"
:
"message/rfc822"
,
"scope"
:
"Ancestors"
}
],
"function"
:
"parseConfirmationEmail"
,
"mimeType"
:
"text/html"
,
"script"
:
"caesar-data.js"
}
src/lib/scripts/extractors.qrc
View file @
9a7be742
...
...
@@ -43,6 +43,8 @@
<file>brusselsairlines-receipt.js</file>
<file>bvg.json</file>
<file>bvg.js</file>
<file>caesar-data.json</file>
<file>caesar-data.js</file>
<file>chaos-communication-congress.json</file>
<file>chaos-communication-congress.js</file>
<file>czechrailways.json</file>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment