6
6
import sys
7
7
from .helpers import perror
8
8
9
- occupancies = {
10
- None : '' ,
11
- - 1 : '' ,
12
- 0 : 'Low' , # todo check
13
- 1 : 'Low' ,
14
- 2 : 'Medium' ,
15
- 3 : 'High' ,
16
- }
17
9
API_URL = 'http://transport.opendata.ch/v1'
18
10
19
11
@@ -68,15 +60,6 @@ def _parse_section(con_section, connection):
68
60
section ['arrival' ] = dateutil .parser .parse (arrival ['arrival' ])
69
61
section ['platform_from' ] = "" if walk else departure ['platform' ]
70
62
section ['platform_to' ] = arrival ['platform' ]
71
- if walk :
72
- section ['occupancy1st' ] = ''
73
- section ['occupancy2nd' ] = ''
74
- elif journey :
75
- section ['occupancy1st' ] = occupancies .get (con_section ['journey' ]['capacity1st' ], '' )
76
- section ['occupancy2nd' ] = occupancies .get (con_section ['journey' ]['capacity2nd' ], '' )
77
- else :
78
- section ['occupancy1st' ] = occupancies .get (connection ['capacity1st' ], '' )
79
- section ['occupancy2nd' ] = occupancies .get (connection ['capacity2nd' ], '' )
80
63
return section
81
64
82
65
@@ -107,8 +90,6 @@ def keyfunc(s):
107
90
in connection ['sections' ]
108
91
if section ['journey' ] is not None
109
92
)
110
- data ['occupancy1st' ] = occupancies .get (connection ['capacity1st' ], '' )
111
- data ['occupancy2nd' ] = occupancies .get (connection ['capacity2nd' ], '' )
112
93
113
94
# Sections
114
95
con_sections = sorted (connection ['sections' ], key = keyfunc )
@@ -127,7 +108,7 @@ def keyfunc(s):
127
108
for p in ["station_to" , "arrival" ]:
128
109
section [p ] = to [p ]
129
110
# Get information from connection
130
- for p in ["occupancy2nd" , "occupancy1st" , " travelwith" , "change_count" ]:
111
+ for p in ["travelwith" , "change_count" ]:
131
112
section [p ] = data [p ]
132
113
data ['sections' ] = [section ]
133
114
0 commit comments