mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-22 22:59:35 +02:00
VBB: remove vbb-parse-line 💥✅
This commit is contained in:
parent
673d6f8279
commit
7b0374695a
6 changed files with 3 additions and 804 deletions
|
@ -1,6 +1,5 @@
|
|||
'use strict'
|
||||
|
||||
const parseLineName = require('vbb-parse-line')
|
||||
const {parseHook} = require('../../lib/profile-hooks')
|
||||
|
||||
const parseAndAddLocationDHID = require('./parse-loc-dhid')
|
||||
|
@ -12,16 +11,8 @@ const _parseDeparture = require('../../parse/departure')
|
|||
const baseProfile = require('./base.json')
|
||||
const products = require('./products')
|
||||
|
||||
// todo: https://m.tagesspiegel.de/berlin/fahrerlebnis-wie-im-regionalexpress-so-faehrt-es-sich-in-der-neuen-express-s-bahn/25338674.html
|
||||
const parseLineWithMoreDetails = ({parsed}, p) => {
|
||||
const parseLineWithShortName = ({parsed}, p) => {
|
||||
parsed.name = p.name.replace(/^(bus|tram)\s+/i, '')
|
||||
const details = parseLineName(parsed.name)
|
||||
parsed.symbol = details.symbol
|
||||
parsed.nr = details.nr
|
||||
parsed.metro = details.metro
|
||||
parsed.express = details.express
|
||||
parsed.night = details.night
|
||||
|
||||
return parsed
|
||||
}
|
||||
|
||||
|
@ -79,7 +70,7 @@ const vbbProfile = {
|
|||
|
||||
products: products,
|
||||
|
||||
parseLine: parseHook(_parseLine, parseLineWithMoreDetails),
|
||||
parseLine: parseHook(_parseLine, parseLineWithShortName),
|
||||
parseLocation: parseHook(_parseLocation, parseLocation),
|
||||
parseJourney: parseHook(_parseJourney, parseJourneyWithTickets),
|
||||
parseDeparture: parseHook(_parseDeparture, parseDepartureRenameRingbahn),
|
||||
|
|
|
@ -16,5 +16,4 @@ const client = createClient(vbbProfile, 'my-awesome-program')
|
|||
## Customisations
|
||||
|
||||
- parses *VBB*-specific products (such as *X-Bus*)
|
||||
- parses line names to give more information (e.g. "Is it an express bus?")
|
||||
- renames *Ringbahn* line names to contain `⟳` and `⟲`
|
||||
|
|
|
@ -60,8 +60,7 @@
|
|||
"p-throttle": "^4.1.1",
|
||||
"pinkie-promise": "^2.0.1",
|
||||
"qs": "^6.6.0",
|
||||
"slugg": "^1.2.0",
|
||||
"vbb-parse-line": "^1.0.0"
|
||||
"slugg": "^1.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^7.0.0",
|
||||
|
|
720
test/fixtures/vbb-departures.js
vendored
720
test/fixtures/vbb-departures.js
vendored
File diff suppressed because it is too large
Load diff
65
test/fixtures/vbb-journeys.js
vendored
65
test/fixtures/vbb-journeys.js
vendored
|
@ -68,11 +68,6 @@ module.exports = [{
|
|||
id: 'berliner-verkehrsbetriebe',
|
||||
name: 'Berliner Verkehrsbetriebe'
|
||||
},
|
||||
symbol: 'U',
|
||||
nr: 9,
|
||||
metro: false,
|
||||
express: false,
|
||||
night: false,
|
||||
},
|
||||
direction: 'U Osloer Str. (Berlin)',
|
||||
arrivalPlatform: null,
|
||||
|
@ -146,11 +141,6 @@ module.exports = [{
|
|||
id: 's-bahn-berlin-gmbh',
|
||||
name: 'S-Bahn Berlin GmbH'
|
||||
},
|
||||
symbol: 'S',
|
||||
nr: 41,
|
||||
metro: false,
|
||||
express: false,
|
||||
night: false,
|
||||
},
|
||||
direction: 'Ringbahn S 41',
|
||||
arrivalPlatform: '3',
|
||||
|
@ -220,11 +210,6 @@ module.exports = [{
|
|||
mode: 'train',
|
||||
product: 'express',
|
||||
operator: {type: 'operator', id: 'db-regio-ag', name: 'DB Regio AG'},
|
||||
symbol: 'ICE',
|
||||
nr: 1710,
|
||||
metro: false,
|
||||
express: false,
|
||||
night: false,
|
||||
},
|
||||
direction: 'Ostseebad Binz, Bahnhof',
|
||||
arrivalPlatform: '3',
|
||||
|
@ -249,11 +234,6 @@ module.exports = [{
|
|||
id: 'db-regio-ag',
|
||||
name: 'DB Regio AG'
|
||||
},
|
||||
symbol: 'IC',
|
||||
nr: 2457,
|
||||
metro: false,
|
||||
express: false,
|
||||
night: false,
|
||||
},
|
||||
direction: 'Ostseebad Binz, Bahnhof',
|
||||
when: '2020-12-07T15:52:00+01:00',
|
||||
|
@ -276,11 +256,6 @@ module.exports = [{
|
|||
id: 'db-regio-ag',
|
||||
name: 'DB Regio AG'
|
||||
},
|
||||
symbol: 'IC',
|
||||
nr: 2055,
|
||||
metro: false,
|
||||
express: false,
|
||||
night: false,
|
||||
},
|
||||
direction: 'Stralsund, Hauptbahnhof',
|
||||
when: '2020-12-07T18:22:00+01:00',
|
||||
|
@ -368,11 +343,6 @@ module.exports = [{
|
|||
id: 'berliner-verkehrsbetriebe',
|
||||
name: 'Berliner Verkehrsbetriebe'
|
||||
},
|
||||
symbol: 'U',
|
||||
nr: 9,
|
||||
metro: false,
|
||||
express: false,
|
||||
night: false,
|
||||
},
|
||||
direction: 'U Osloer Str. (Berlin)',
|
||||
arrivalPlatform: null,
|
||||
|
@ -446,11 +416,6 @@ module.exports = [{
|
|||
id: 's-bahn-berlin-gmbh',
|
||||
name: 'S-Bahn Berlin GmbH'
|
||||
},
|
||||
symbol: 'S',
|
||||
nr: 41,
|
||||
metro: false,
|
||||
express: false,
|
||||
night: false,
|
||||
},
|
||||
direction: 'Ringbahn S 41',
|
||||
arrivalPlatform: null,
|
||||
|
@ -521,11 +486,6 @@ module.exports = [{
|
|||
mode: 'train',
|
||||
product: 'regional',
|
||||
operator: {type: 'operator', id: 'db-regio-ag', name: 'DB Regio AG'},
|
||||
symbol: 'RE',
|
||||
nr: 3,
|
||||
metro: false,
|
||||
express: true,
|
||||
night: false,
|
||||
},
|
||||
direction: 'Stralsund, Hauptbahnhof',
|
||||
arrivalPlatform: '3',
|
||||
|
@ -550,11 +510,6 @@ module.exports = [{
|
|||
id: 'db-regio-ag',
|
||||
name: 'DB Regio AG'
|
||||
},
|
||||
symbol: 'RE',
|
||||
nr: 66,
|
||||
metro: false,
|
||||
express: true,
|
||||
night: false,
|
||||
},
|
||||
direction: 'Tantow, Bahnhof',
|
||||
when: '2020-12-07T14:53:00+01:00',
|
||||
|
@ -577,11 +532,6 @@ module.exports = [{
|
|||
id: 'db-regio-ag',
|
||||
name: 'DB Regio AG'
|
||||
},
|
||||
symbol: 'RE',
|
||||
nr: 3,
|
||||
metro: false,
|
||||
express: true,
|
||||
night: false,
|
||||
},
|
||||
direction: 'Schwedt, Bahnhof',
|
||||
when: '2020-12-07T15:39:00+01:00',
|
||||
|
@ -604,11 +554,6 @@ module.exports = [{
|
|||
id: 'db-regio-ag',
|
||||
name: 'DB Regio AG'
|
||||
},
|
||||
symbol: 'RE',
|
||||
nr: 3,
|
||||
metro: false,
|
||||
express: true,
|
||||
night: false,
|
||||
},
|
||||
direction: 'Eberswalde, Hauptbahnhof',
|
||||
when: '2020-12-07T15:59:00+01:00',
|
||||
|
@ -631,11 +576,6 @@ module.exports = [{
|
|||
id: 'db-regio-ag',
|
||||
name: 'DB Regio AG'
|
||||
},
|
||||
symbol: 'RE',
|
||||
nr: 3,
|
||||
metro: false,
|
||||
express: true,
|
||||
night: false,
|
||||
},
|
||||
direction: 'Stralsund, Hauptbahnhof',
|
||||
when: '2020-12-07T16:39:00+01:00',
|
||||
|
@ -658,11 +598,6 @@ module.exports = [{
|
|||
id: 'db-regio-ag',
|
||||
name: 'DB Regio AG'
|
||||
},
|
||||
symbol: 'RE',
|
||||
nr: 66,
|
||||
metro: false,
|
||||
express: true,
|
||||
night: false,
|
||||
},
|
||||
direction: 'Szczecin, Glowny',
|
||||
when: '2020-12-07T17:19:00+01:00',
|
||||
|
|
5
test/fixtures/vbb-on-demand-trip.js
vendored
5
test/fixtures/vbb-on-demand-trip.js
vendored
|
@ -18,11 +18,6 @@ module.exports = {
|
|||
id: 'verkehrsgesellschaft-teltow-flaming-mbh',
|
||||
name: 'Verkehrsgesellschaft Teltow-Fläming mbH'
|
||||
},
|
||||
symbol: 'R',
|
||||
nr: 777,
|
||||
metro: false,
|
||||
express: false,
|
||||
night: false
|
||||
},
|
||||
reachable: true,
|
||||
realtimeDataUpdatedAt: 1635084435,
|
||||
|
|
Loading…
Add table
Reference in a new issue