Skip to content
GitLab
Menu
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
a7687588
Commit
a7687588
authored
Jul 16, 2021
by
Volker Krause
Browse files
Add event reservation extractor for ticketmaster.de
parent
8148a47d
Pipeline
#70632
failed with stage
in 4 minutes and 25 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/lib/scripts/extractors.qrc
View file @
a7687588
...
...
@@ -113,6 +113,8 @@
<file>terminland-de.js</file>
<file>thalys.json</file>
<file>thalys.js</file>
<file>ticketmaster.json</file>
<file>ticketmaster.js</file>
<file>tierparkberlin.json</file>
<file>tierparkberlin.js</file>
<file>travelport-galileo.json</file>
...
...
src/lib/scripts/ticketmaster.js
0 → 100644
View file @
a7687588
/*
SPDX-FileCopyrightText: 2021 Volker Krause <vkrause@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
function
parsePdfTicket
(
pdf
,
node
)
{
var
reservations
=
new
Array
();
for
(
page
of
pdf
.
pages
)
{
const
text
=
page
.
textInRect
(
0.125
,
0
,
0.9
,
0.5
);
var
res
=
JsonLd
.
newEventReservation
();
res
.
reservationNumber
=
text
.
match
(
/Auftragsnummer:
\s
*
(\d
+
)
/
)[
1
];
const
name
=
text
.
match
(
/gekauft von:.*
\n\s
*
\d
.*
\d\s
*
(\S
.*
)\n
/
);
res
.
underName
.
name
=
name
[
1
];
res
.
reservationFor
.
name
=
text
.
substr
(
name
.
index
+
name
[
0
].
length
).
match
(
/
(
.*
)\n
/
)[
1
];
const
venue
=
text
.
match
(
/Veranstalter:
\n
.*
\n(
.*
)\n(
.*
?)(?:
.*
)?\n(
.*
)\n
/
);
res
.
reservationFor
.
location
.
name
=
venue
[
1
];
res
.
reservationFor
.
location
.
address
.
streetAddress
=
venue
[
2
];
res
.
reservationFor
.
location
.
address
.
addressLocality
=
venue
[
3
];
const
dt
=
text
.
substr
(
venue
.
index
+
venue
[
0
].
length
).
match
(
/
\w
*,
(
.*
)
Uhr/
)[
1
];
res
.
reservationFor
.
startDate
=
JsonLd
.
toDateTime
(
dt
,
'
dd. MMM yyyy, hh:mm
'
,
'
de
'
);
const
entry
=
text
.
match
(
/Einlass ab:
\w
*,
(
.*
)
Uhr/
)[
1
];
res
.
reservationFor
.
doorTime
=
JsonLd
.
toDateTime
(
entry
,
'
dd. MMM yyyy, hh:mm
'
,
'
de
'
);
const
barcodes
=
node
.
findChildNodes
({
mimeType
:
"
text/plain
"
,
match
:
"
.{6,20}
"
,
scope
:
"
Descendants
"
});
res
.
reservedTicket
.
ticketToken
=
'
qrCode:
'
+
barcodes
[
0
].
content
;
reservations
.
push
(
res
);
}
return
reservations
;
}
src/lib/scripts/ticketmaster.json
0 → 100644
View file @
a7687588
{
"filter"
:
[
{
"field"
:
"From"
,
"match"
:
"@ticketmaster.de"
,
"mimeType"
:
"message/rfc822"
,
"scope"
:
"Ancestors"
}
],
"function"
:
"parsePdfTicket"
,
"mimeType"
:
"application/pdf"
,
"script"
:
"ticketmaster.js"
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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