File indexing completed on 2024-12-29 04:51:06
0001 /* 0002 SPDX-FileCopyrightText: 2019 Volker Krause <vkrause@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 function expandStationName(name) 0008 { 0009 switch (name) { 0010 case "SSD": return "Stansted"; 0011 case "LST": return "London Liverpool Street"; 0012 case "TOM": return "Tottenham Hale"; 0013 case "SRA": return "Stratford"; 0014 } 0015 return name; 0016 } 0017 0018 function parsePkPass(pass, node) 0019 { 0020 var res = node.result[0]; 0021 res.reservationFor = JsonLd.newObject("TrainTrip"); 0022 res.reservationFor.departureDay = JsonLd.toDateTime(pass.field["travelDate"].value, "dd/MM/yyyy", "en"); 0023 res.reservationFor.departureStation = JsonLd.newObject("TrainStation"); 0024 res.reservationFor.departureStation.name = expandStationName(pass.field["from"].value); 0025 res.reservationFor.departureStation.identifier = 'uk:' + pass.field["from"].value; 0026 res.reservationFor.arrivalStation = JsonLd.newObject("TrainStation"); 0027 res.reservationFor.arrivalStation.name = expandStationName(pass.field["to"].value); 0028 res.reservationFor.arrivalStation.identifier = 'uk:' + pass.field["to"].value; 0029 0030 return res; 0031 }