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
d4e19202
Commit
d4e19202
authored
Jul 19, 2022
by
Volker Krause
Browse files
Add extractor script for GNV ferries
parent
dc4f42b8
Pipeline
#207123
canceled with stage
in 2 minutes and 41 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/lib/scripts/extractors.qrc
View file @
d4e19202
...
...
@@ -66,6 +66,8 @@
<file>feratel-card.js</file>
<file>flixbus.json</file>
<file>flixbus.js</file>
<file>gnv.it.json</file>
<file>gnv.it.js</file>
<file>gomus.json</file>
<file>gomus.js</file>
<file>gwr.json</file>
...
...
src/lib/scripts/gnv.it.js
0 → 100644
View file @
d4e19202
/*
SPDX-FileCopyrightText: 2022 Volker Krause <vkrause@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
function
parseTicket
(
content
,
node
,
triggerNode
)
{
const
page
=
content
.
pages
[
triggerNode
.
location
];
const
text
=
page
.
textInRect
(
0.0
,
0.0
,
0.5
,
0.5
);
let
res
=
JsonLd
.
newBoatReservation
();
res
.
reservedTicket
.
ticketToken
=
'
code39:
'
+
triggerNode
.
content
;
res
.
reservationNumber
=
text
.
match
(
/TICKET ID
\n\s
+
(\d
+
)
/
)[
1
];
const
dep
=
text
.
match
(
/Port of departure
(
.*
)\n(?:
.*
\n)?\s
*
(\d{2}
:
\d{2}
\d{2}
\w
+,
\d{4})
/
);
res
.
reservationFor
.
departureBoatTerminal
.
name
=
dep
[
1
];
res
.
reservationFor
.
departureBoatTerminal
.
geo
=
JsonLd
.
toGeoCoordinates
(
page
.
links
[
0
].
url
);
res
.
reservationFor
.
departureTime
=
JsonLd
.
toDateTime
(
dep
[
2
],
'
hh:mm dd MMMM, yyyy
'
,
'
it
'
);
const
arr
=
text
.
match
(
/Port of arrival
(
.*
)\n(?:
.*
\n)?\s
*
(\d{2}
:
\d{2}
\d{2}
\w
+,
\d{4})
/
);
res
.
reservationFor
.
arrivalBoatTerminal
.
name
=
arr
[
1
];
res
.
reservationFor
.
arrivalTime
=
JsonLd
.
toDateTime
(
arr
[
2
],
'
hh:mm dd MMMM, yyyy
'
,
'
it
'
);
const
passenger
=
page
.
textInRect
(
0.5
,
0.0
,
1.0
,
0.5
);
res
.
underName
.
name
=
passenger
.
match
(
/
(
.*
)\n
/
)[
1
];
return
res
;
}
src/lib/scripts/gnv.it.json
0 → 100644
View file @
d4e19202
{
"filter"
:
[
{
"match"
:
"^GN-
\\
d{7}$"
,
"mimeType"
:
"text/plain"
,
"scope"
:
"Descendants"
}
],
"function"
:
"parseTicket"
,
"mimeType"
:
"application/pdf"
,
"script"
:
"gnv.it.js"
}
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