Jacek Kowalski
2019-06-30 0b6d2f4164b9d823fb2a49d9fb4e83242f695e09
commit | author | age
b62720 1 <?php
bcd661 2 $tramTypes = new TramTypes();
b62720 3 $sources = [
JK 4     'bus' => [
5         'gtfsrt' => 'ftp://ztp.krakow.pl/VehiclePositions_A.pb',
6         'gtfsrt_file' => 'VehiclePositions_A.pb',
7         'ttss' => 'http://ttss.mpk.krakow.pl/internetservice/geoserviceDispatcher/services/vehicleinfo/vehicles',
8         'ttss_file' => 'vehicles_A.json',
9         'database' => 'mapping_A.sqlite3',
10         'result' => 'mapping_A.json',
c077c7 11         'result_vehicles' => 'vehicles_A.html',
bcd661 12         'mapper' => new BusTypes(),
c077c7 13         'prefix' => 'b',
b62720 14     ],
JK 15     'tram' => [
16         'gtfsrt' => 'ftp://ztp.krakow.pl/VehiclePositions_T.pb',
17         'gtfsrt_file' => 'VehiclePositions_T.pb',
18         'ttss' => 'http://www.ttss.krakow.pl/internetservice/geoserviceDispatcher/services/vehicleinfo/vehicles',
19         'ttss_file' => 'vehicles_T.json',
20         'database' => 'mapping_T.sqlite3',
21         'result' => 'mapping_T.json',
c077c7 22         'result_vehicles' => 'vehicles_T.html',
bcd661 23         'mapper' => $tramTypes,
c077c7 24         'prefix' => 't',
b62720 25     ],
JK 26     'tram2' => [
27         'gtfsrt' => 'ftp://ztp.krakow.pl/VehiclePositions.pb',
28         'gtfsrt_file' => 'VehiclePositions_T.pb',
29         'ttss' => 'http://www.ttss.krakow.pl/internetservice/geoserviceDispatcher/services/vehicleinfo/vehicles',
30         'ttss_file' => 'vehicles_T.json',
31         'database' => 'mapping_T.sqlite3',
32         'result' => 'mapping_T.json',
c077c7 33         'result_vehicles' => 'vehicles_T.html',
bcd661 34         'mapper' => $tramTypes,
c077c7 35         'prefix' => 't',
b62720 36     ],
JK 37 ]; 
38
39 foreach($sources as $name => &$source) {
c077c7 40     foreach(['gtfsrt_file', 'ttss_file', 'database', 'result', 'result_vehicles'] as $field) {
b62720 41         $source[$field] = __DIR__.'/data/'.$source[$field];
JK 42     }
c077c7 43     
b62720 44     $source['result_temp'] = $source['result'].'.tmp';
c077c7 45     $source['result_vehicles_temp'] = $source['result_vehicles'].'.tmp';
b62720 46 }
JK 47 unset($source);