Completed
Push — master ( 618bcd...4a6efe )
by Bart
01:11
created

main()   B

Complexity

Conditions 5

Size

Total Lines 28

Duplication

Lines 0
Ratio 0 %

Importance

Changes 9
Bugs 0 Features 0
Metric Value
c 9
b 0
f 0
dl 0
loc 28
rs 8.0894
cc 5
1
#!/usr/bin/env python3
2
3
import sys
4
import os
5
6
sys.path.append('../nsmaps')
7
8
import nsmaps
9
from nsmaps.station import StationType
10
11
DATA_DIR = './website/nsmaps-data'
12
13
MAX_STATIONS = 60
14
15
16
def main():
17
    stations = nsmaps.station.Stations(DATA_DIR)
18
    major_station_types = (
19
        StationType.intercitystation,
20
        StationType.knooppuntIntercitystation,
21
        StationType.megastation,
22
        StationType.knooppuntSneltreinstation,
23
        StationType.sneltreinstation,
24
        StationType.knooppuntStoptreinstation,
25
        StationType.stoptreinstation
26
    )
27
    stations_options = stations.get_stations_for_types(major_station_types)
28
29
    stations_todo = []
30
31
    n_stations = 0
32
    for station in stations_options:
33
        if n_stations >= MAX_STATIONS:
34
            break
35
        if not station.has_travel_time_data() and station.get_country_code() == 'NL':
36
            print(station.get_travel_time_filepath())
37
            stations_todo.append(station)
38
            n_stations += 1
39
            print(station)
40
41
    timestamp = "19-04-2016 08:00"
42
    stations.create_traveltimes_data(stations_todo, timestamp)
43
    stations.recreate_missing_destinations(timestamp, False)
44
45
46
if __name__ == "__main__":
47
    main()