From fe5de9f7c15eeac539d77c5981e0162493b1bc76 Mon Sep 17 00:00:00 2001 From: Francia Csaba Date: Thu, 8 Feb 2024 13:31:21 +0100 Subject: [PATCH] make stops sources configurable --- amarillo/plugins/enhancer/configuration.py | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/amarillo/plugins/enhancer/configuration.py b/amarillo/plugins/enhancer/configuration.py index b361d5d..e94c368 100644 --- a/amarillo/plugins/enhancer/configuration.py +++ b/amarillo/plugins/enhancer/configuration.py @@ -9,28 +9,26 @@ from amarillo.plugins.enhancer.services import stops from amarillo.plugins.enhancer.services import trips from amarillo.plugins.enhancer.services.carpools import CarpoolService from amarillo.plugins.enhancer.services import gtfs_generator - +from amarillo.services.config import config from amarillo.configuration import configure_services logger = logging.getLogger(__name__) - -def configure_enhancer_services(): - configure_services() - +def configure_container(): logger.info("Load stops...") - stop_sources = [ - {"url": "https://datahub.bbnavi.de/export/rideshare_points.geojson", "vicinity": 50}, - {"url": "https://data.mfdz.de/mfdz/stops/stops_zhv.csv", "vicinity": 50}, - {"url": "https://data.mfdz.de/mfdz/stops/parkings_osm.csv", "vicinity": 500}, - ] - stop_store = stops.StopsStore(stop_sources) + with open(config.stop_sources_file) as stop_sources_file: + stop_sources = json.load(stop_sources_file) + stop_store = stops.StopsStore(stop_sources) stop_store.load_stop_sources() container['stops_store'] = stop_store container['trips_store'] = trips.TripStore(stop_store) container['carpools'] = CarpoolService(container['trips_store']) +def configure_enhancer_services(): + configure_services() + configure_container() + logger.info("Restore carpools...") for agency_id in container['agencies'].agencies: