mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 07:09: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'
|
'use strict'
|
||||||
|
|
||||||
const parseLineName = require('vbb-parse-line')
|
|
||||||
const {parseHook} = require('../../lib/profile-hooks')
|
const {parseHook} = require('../../lib/profile-hooks')
|
||||||
|
|
||||||
const parseAndAddLocationDHID = require('./parse-loc-dhid')
|
const parseAndAddLocationDHID = require('./parse-loc-dhid')
|
||||||
|
@ -12,16 +11,8 @@ const _parseDeparture = require('../../parse/departure')
|
||||||
const baseProfile = require('./base.json')
|
const baseProfile = require('./base.json')
|
||||||
const products = require('./products')
|
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 parseLineWithShortName = ({parsed}, p) => {
|
||||||
const parseLineWithMoreDetails = ({parsed}, p) => {
|
|
||||||
parsed.name = p.name.replace(/^(bus|tram)\s+/i, '')
|
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
|
return parsed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +70,7 @@ const vbbProfile = {
|
||||||
|
|
||||||
products: products,
|
products: products,
|
||||||
|
|
||||||
parseLine: parseHook(_parseLine, parseLineWithMoreDetails),
|
parseLine: parseHook(_parseLine, parseLineWithShortName),
|
||||||
parseLocation: parseHook(_parseLocation, parseLocation),
|
parseLocation: parseHook(_parseLocation, parseLocation),
|
||||||
parseJourney: parseHook(_parseJourney, parseJourneyWithTickets),
|
parseJourney: parseHook(_parseJourney, parseJourneyWithTickets),
|
||||||
parseDeparture: parseHook(_parseDeparture, parseDepartureRenameRingbahn),
|
parseDeparture: parseHook(_parseDeparture, parseDepartureRenameRingbahn),
|
||||||
|
|
|
@ -16,5 +16,4 @@ const client = createClient(vbbProfile, 'my-awesome-program')
|
||||||
## Customisations
|
## Customisations
|
||||||
|
|
||||||
- parses *VBB*-specific products (such as *X-Bus*)
|
- 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 `⟲`
|
- renames *Ringbahn* line names to contain `⟳` and `⟲`
|
||||||
|
|
|
@ -60,8 +60,7 @@
|
||||||
"p-throttle": "^4.1.1",
|
"p-throttle": "^4.1.1",
|
||||||
"pinkie-promise": "^2.0.1",
|
"pinkie-promise": "^2.0.1",
|
||||||
"qs": "^6.6.0",
|
"qs": "^6.6.0",
|
||||||
"slugg": "^1.2.0",
|
"slugg": "^1.2.0"
|
||||||
"vbb-parse-line": "^1.0.0"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"eslint": "^7.0.0",
|
"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',
|
id: 'berliner-verkehrsbetriebe',
|
||||||
name: 'Berliner Verkehrsbetriebe'
|
name: 'Berliner Verkehrsbetriebe'
|
||||||
},
|
},
|
||||||
symbol: 'U',
|
|
||||||
nr: 9,
|
|
||||||
metro: false,
|
|
||||||
express: false,
|
|
||||||
night: false,
|
|
||||||
},
|
},
|
||||||
direction: 'U Osloer Str. (Berlin)',
|
direction: 'U Osloer Str. (Berlin)',
|
||||||
arrivalPlatform: null,
|
arrivalPlatform: null,
|
||||||
|
@ -146,11 +141,6 @@ module.exports = [{
|
||||||
id: 's-bahn-berlin-gmbh',
|
id: 's-bahn-berlin-gmbh',
|
||||||
name: 'S-Bahn Berlin GmbH'
|
name: 'S-Bahn Berlin GmbH'
|
||||||
},
|
},
|
||||||
symbol: 'S',
|
|
||||||
nr: 41,
|
|
||||||
metro: false,
|
|
||||||
express: false,
|
|
||||||
night: false,
|
|
||||||
},
|
},
|
||||||
direction: 'Ringbahn S 41',
|
direction: 'Ringbahn S 41',
|
||||||
arrivalPlatform: '3',
|
arrivalPlatform: '3',
|
||||||
|
@ -220,11 +210,6 @@ module.exports = [{
|
||||||
mode: 'train',
|
mode: 'train',
|
||||||
product: 'express',
|
product: 'express',
|
||||||
operator: {type: 'operator', id: 'db-regio-ag', name: 'DB Regio AG'},
|
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',
|
direction: 'Ostseebad Binz, Bahnhof',
|
||||||
arrivalPlatform: '3',
|
arrivalPlatform: '3',
|
||||||
|
@ -249,11 +234,6 @@ module.exports = [{
|
||||||
id: 'db-regio-ag',
|
id: 'db-regio-ag',
|
||||||
name: 'DB Regio AG'
|
name: 'DB Regio AG'
|
||||||
},
|
},
|
||||||
symbol: 'IC',
|
|
||||||
nr: 2457,
|
|
||||||
metro: false,
|
|
||||||
express: false,
|
|
||||||
night: false,
|
|
||||||
},
|
},
|
||||||
direction: 'Ostseebad Binz, Bahnhof',
|
direction: 'Ostseebad Binz, Bahnhof',
|
||||||
when: '2020-12-07T15:52:00+01:00',
|
when: '2020-12-07T15:52:00+01:00',
|
||||||
|
@ -276,11 +256,6 @@ module.exports = [{
|
||||||
id: 'db-regio-ag',
|
id: 'db-regio-ag',
|
||||||
name: 'DB Regio AG'
|
name: 'DB Regio AG'
|
||||||
},
|
},
|
||||||
symbol: 'IC',
|
|
||||||
nr: 2055,
|
|
||||||
metro: false,
|
|
||||||
express: false,
|
|
||||||
night: false,
|
|
||||||
},
|
},
|
||||||
direction: 'Stralsund, Hauptbahnhof',
|
direction: 'Stralsund, Hauptbahnhof',
|
||||||
when: '2020-12-07T18:22:00+01:00',
|
when: '2020-12-07T18:22:00+01:00',
|
||||||
|
@ -368,11 +343,6 @@ module.exports = [{
|
||||||
id: 'berliner-verkehrsbetriebe',
|
id: 'berliner-verkehrsbetriebe',
|
||||||
name: 'Berliner Verkehrsbetriebe'
|
name: 'Berliner Verkehrsbetriebe'
|
||||||
},
|
},
|
||||||
symbol: 'U',
|
|
||||||
nr: 9,
|
|
||||||
metro: false,
|
|
||||||
express: false,
|
|
||||||
night: false,
|
|
||||||
},
|
},
|
||||||
direction: 'U Osloer Str. (Berlin)',
|
direction: 'U Osloer Str. (Berlin)',
|
||||||
arrivalPlatform: null,
|
arrivalPlatform: null,
|
||||||
|
@ -446,11 +416,6 @@ module.exports = [{
|
||||||
id: 's-bahn-berlin-gmbh',
|
id: 's-bahn-berlin-gmbh',
|
||||||
name: 'S-Bahn Berlin GmbH'
|
name: 'S-Bahn Berlin GmbH'
|
||||||
},
|
},
|
||||||
symbol: 'S',
|
|
||||||
nr: 41,
|
|
||||||
metro: false,
|
|
||||||
express: false,
|
|
||||||
night: false,
|
|
||||||
},
|
},
|
||||||
direction: 'Ringbahn S 41',
|
direction: 'Ringbahn S 41',
|
||||||
arrivalPlatform: null,
|
arrivalPlatform: null,
|
||||||
|
@ -521,11 +486,6 @@ module.exports = [{
|
||||||
mode: 'train',
|
mode: 'train',
|
||||||
product: 'regional',
|
product: 'regional',
|
||||||
operator: {type: 'operator', id: 'db-regio-ag', name: 'DB Regio AG'},
|
operator: {type: 'operator', id: 'db-regio-ag', name: 'DB Regio AG'},
|
||||||
symbol: 'RE',
|
|
||||||
nr: 3,
|
|
||||||
metro: false,
|
|
||||||
express: true,
|
|
||||||
night: false,
|
|
||||||
},
|
},
|
||||||
direction: 'Stralsund, Hauptbahnhof',
|
direction: 'Stralsund, Hauptbahnhof',
|
||||||
arrivalPlatform: '3',
|
arrivalPlatform: '3',
|
||||||
|
@ -550,11 +510,6 @@ module.exports = [{
|
||||||
id: 'db-regio-ag',
|
id: 'db-regio-ag',
|
||||||
name: 'DB Regio AG'
|
name: 'DB Regio AG'
|
||||||
},
|
},
|
||||||
symbol: 'RE',
|
|
||||||
nr: 66,
|
|
||||||
metro: false,
|
|
||||||
express: true,
|
|
||||||
night: false,
|
|
||||||
},
|
},
|
||||||
direction: 'Tantow, Bahnhof',
|
direction: 'Tantow, Bahnhof',
|
||||||
when: '2020-12-07T14:53:00+01:00',
|
when: '2020-12-07T14:53:00+01:00',
|
||||||
|
@ -577,11 +532,6 @@ module.exports = [{
|
||||||
id: 'db-regio-ag',
|
id: 'db-regio-ag',
|
||||||
name: 'DB Regio AG'
|
name: 'DB Regio AG'
|
||||||
},
|
},
|
||||||
symbol: 'RE',
|
|
||||||
nr: 3,
|
|
||||||
metro: false,
|
|
||||||
express: true,
|
|
||||||
night: false,
|
|
||||||
},
|
},
|
||||||
direction: 'Schwedt, Bahnhof',
|
direction: 'Schwedt, Bahnhof',
|
||||||
when: '2020-12-07T15:39:00+01:00',
|
when: '2020-12-07T15:39:00+01:00',
|
||||||
|
@ -604,11 +554,6 @@ module.exports = [{
|
||||||
id: 'db-regio-ag',
|
id: 'db-regio-ag',
|
||||||
name: 'DB Regio AG'
|
name: 'DB Regio AG'
|
||||||
},
|
},
|
||||||
symbol: 'RE',
|
|
||||||
nr: 3,
|
|
||||||
metro: false,
|
|
||||||
express: true,
|
|
||||||
night: false,
|
|
||||||
},
|
},
|
||||||
direction: 'Eberswalde, Hauptbahnhof',
|
direction: 'Eberswalde, Hauptbahnhof',
|
||||||
when: '2020-12-07T15:59:00+01:00',
|
when: '2020-12-07T15:59:00+01:00',
|
||||||
|
@ -631,11 +576,6 @@ module.exports = [{
|
||||||
id: 'db-regio-ag',
|
id: 'db-regio-ag',
|
||||||
name: 'DB Regio AG'
|
name: 'DB Regio AG'
|
||||||
},
|
},
|
||||||
symbol: 'RE',
|
|
||||||
nr: 3,
|
|
||||||
metro: false,
|
|
||||||
express: true,
|
|
||||||
night: false,
|
|
||||||
},
|
},
|
||||||
direction: 'Stralsund, Hauptbahnhof',
|
direction: 'Stralsund, Hauptbahnhof',
|
||||||
when: '2020-12-07T16:39:00+01:00',
|
when: '2020-12-07T16:39:00+01:00',
|
||||||
|
@ -658,11 +598,6 @@ module.exports = [{
|
||||||
id: 'db-regio-ag',
|
id: 'db-regio-ag',
|
||||||
name: 'DB Regio AG'
|
name: 'DB Regio AG'
|
||||||
},
|
},
|
||||||
symbol: 'RE',
|
|
||||||
nr: 66,
|
|
||||||
metro: false,
|
|
||||||
express: true,
|
|
||||||
night: false,
|
|
||||||
},
|
},
|
||||||
direction: 'Szczecin, Glowny',
|
direction: 'Szczecin, Glowny',
|
||||||
when: '2020-12-07T17:19:00+01:00',
|
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',
|
id: 'verkehrsgesellschaft-teltow-flaming-mbh',
|
||||||
name: 'Verkehrsgesellschaft Teltow-Fläming mbH'
|
name: 'Verkehrsgesellschaft Teltow-Fläming mbH'
|
||||||
},
|
},
|
||||||
symbol: 'R',
|
|
||||||
nr: 777,
|
|
||||||
metro: false,
|
|
||||||
express: false,
|
|
||||||
night: false
|
|
||||||
},
|
},
|
||||||
reachable: true,
|
reachable: true,
|
||||||
realtimeDataUpdatedAt: 1635084435,
|
realtimeDataUpdatedAt: 1635084435,
|
||||||
|
|
Loading…
Add table
Reference in a new issue