make stops sources configurable

This commit is contained in:
Csaba 2024-02-08 13:31:21 +01:00
parent ff10a70295
commit 63ca4e2d2c

View file

@ -9,28 +9,26 @@ from amarillo.plugins.enhancer.services import stops
from amarillo.plugins.enhancer.services import trips from amarillo.plugins.enhancer.services import trips
from amarillo.plugins.enhancer.services.carpools import CarpoolService from amarillo.plugins.enhancer.services.carpools import CarpoolService
from amarillo.plugins.enhancer.services import gtfs_generator from amarillo.plugins.enhancer.services import gtfs_generator
from amarillo.services.config import config
from amarillo.configuration import configure_services from amarillo.configuration import configure_services
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
def configure_container():
def configure_enhancer_services():
configure_services()
logger.info("Load stops...") logger.info("Load stops...")
stop_sources = [ with open(config.stop_sources_file) as stop_sources_file:
{"url": "https://datahub.bbnavi.de/export/rideshare_points.geojson", "vicinity": 50}, stop_sources = json.load(stop_sources_file)
{"url": "https://data.mfdz.de/mfdz/stops/stops_zhv.csv", "vicinity": 50}, stop_store = stops.StopsStore(stop_sources)
{"url": "https://data.mfdz.de/mfdz/stops/parkings_osm.csv", "vicinity": 500},
]
stop_store = stops.StopsStore(stop_sources)
stop_store.load_stop_sources() stop_store.load_stop_sources()
container['stops_store'] = stop_store container['stops_store'] = stop_store
container['trips_store'] = trips.TripStore(stop_store) container['trips_store'] = trips.TripStore(stop_store)
container['carpools'] = CarpoolService(container['trips_store']) container['carpools'] = CarpoolService(container['trips_store'])
def configure_enhancer_services():
configure_services()
configure_container()
logger.info("Restore carpools...") logger.info("Restore carpools...")
for agency_id in container['agencies'].agencies: for agency_id in container['agencies'].agencies: