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
8294be77
Commit
8294be77
authored
Oct 08, 2022
by
Volker Krause
Browse files
Add extractor script for PKP domestic ticket barcodes
parent
c77e8de2
Pipeline
#244025
passed with stage
in 10 minutes and 5 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/lib/scripts/extractors.qrc
View file @
8294be77
...
...
@@ -120,6 +120,8 @@
<file>onepagebooking.js</file>
<file>peach-aviation.json</file>
<file>peach-aviation.js</file>
<file>pkp.json</file>
<file>pkp.js</file>
<file>pretix.json</file>
<file>pretix.js</file>
<file>regiojet.json</file>
...
...
src/lib/scripts/pkp.js
0 → 100644
View file @
8294be77
/*
SPDX-FileCopyrightText: 2022 Volker Krause <vkrause@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
// see https://community.kde.org/KDE_PIM/KItinerary/PKP_Barcode
function
parseBarcode
(
content
,
node
)
{
const
layout
=
content
.
ticketLayout
;
let
res
=
JsonLd
.
newTrainReservation
();
res
.
reservedTicket
=
node
.
result
[
0
];
res
.
reservedTicket
.
issuedBy
=
undefined
;
// invalid UIC company code
res
.
reservedTicket
.
name
=
layout
.
text
(
2
,
0
,
72
,
1
);
res
.
reservationFor
.
departureTime
=
JsonLd
.
toDateTime
(
layout
.
text
(
10
,
0
,
72
,
1
)
+
'
'
+
layout
.
text
(
11
,
0
,
72
,
1
),
'
hh:mm dd.MM
'
,
'
pl
'
);
res
.
reservationFor
.
arrivalTime
=
JsonLd
.
toDateTime
(
layout
.
text
(
14
,
0
,
72
,
1
)
+
'
'
+
layout
.
text
(
15
,
0
,
72
,
1
),
'
hh:mm dd.MM
'
,
'
pl
'
);
res
.
reservedTicket
.
ticketedSeat
.
seatingType
=
layout
.
text
(
16
,
0
,
72
,
1
);
res
.
reservationFor
.
trainNumber
=
layout
.
text
(
18
,
0
,
72
,
1
);
res
.
reservedTicket
.
ticketedSeat
.
seatNumber
=
layout
.
text
(
23
,
0
,
72
,
1
);
res
.
reservationNumber
=
layout
.
text
(
31
,
0
,
72
,
1
);
res
.
reservationFor
.
departureStation
.
name
=
layout
.
text
(
41
,
0
,
72
,
1
);
res
.
reservationFor
.
arrivalStation
.
name
=
layout
.
text
(
42
,
0
,
72
,
1
);
return
res
;
}
src/lib/scripts/pkp.json
0 → 100644
View file @
8294be77
{
"filter"
:
[
{
"field"
:
"carrierId"
,
"match"
:
"0004"
,
"mimeType"
:
"internal/uic9183"
,
"scope"
:
"Current"
}
],
"function"
:
"parseBarcode"
,
"mimeType"
:
"internal/uic9183"
,
"script"
:
"pkp.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