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
ec24147a
Commit
ec24147a
authored
Oct 09, 2019
by
Volker Krause
Browse files
Add Indigo boarding pass extractor script
parent
2d9e1de6
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/extractors/extractors.qrc
View file @
ec24147a
...
...
@@ -42,6 +42,8 @@
<file>hertz.json</file>
<file>iberia.json</file>
<file>iberia.js</file>
<file>indigo.json</file>
<file>indigo.js</file>
<file>irctc.json</file>
<file>irctc.js</file>
<file>klm.json</file>
...
...
src/extractors/indigo.js
0 → 100644
View file @
ec24147a
/*
Copyright (c) 2019 Volker Krause <vkrause@kde.org>
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
(
pdf
)
{
var
res
=
Context
.
data
[
0
];
var
page
=
pdf
.
pages
[
Context
.
pdfPageNumber
];
// needs to be done manually as we don't have PDF ctime for this to work automatically
var
date
=
page
.
text
.
match
(
/Date +
(\d\d
\w{3}
\d\d)
/
);
var
depTime
=
page
.
text
.
match
(
/Departure Time
\s
+
(\d\d
:
\d\d)
/
);
res
.
reservationFor
.
departureTime
=
JsonLd
.
toDateTime
(
date
[
1
]
+
depTime
[
1
],
"
dd MMM yyhh:mm
"
,
"
en
"
);
var
boardingTime
=
page
.
text
.
match
(
/Boarding Time
\s
+
(\d\d
:
\d\d)
/
);
res
.
reservationFor
.
boardingTime
=
JsonLd
.
toDateTime
(
date
[
1
]
+
boardingTime
[
1
],
"
dd MMM yyhh:mm
"
,
"
en
"
);
var
from
=
page
.
text
.
match
(
/From +
(\S
.+
?)(?:\(
|To|
\s\s)
/
);
res
.
reservationFor
.
departureAirport
.
name
=
from
[
1
];
var
to
=
page
.
text
.
match
(
/To +
(\S
.+
?)(?:\(
|
\s\s)
/
);
res
.
reservationFor
.
arrivalAirport
.
name
=
to
[
1
];
return
res
;
}
src/extractors/indigo.json
0 → 100644
View file @
ec24147a
{
"filter"
:
[
{
"match"
:
"6E"
,
"property"
:
"reservationFor.airline.iataCode"
,
"type"
:
"JsonLd"
}
],
"function"
:
"main"
,
"script"
:
"indigo.js"
,
"type"
:
"Pdf"
}
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