From fdb36da9de73c1d367263898700704c933b941ff Mon Sep 17 00:00:00 2001 From: Francia Csaba Date: Wed, 21 Feb 2024 13:05:17 +0100 Subject: [PATCH] Added route_color and route_text_color --- amarillo/plugins/grfs_export/gtfs_export.py | 8 ++++---- amarillo/plugins/grfs_export/models/gtfs.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/amarillo/plugins/grfs_export/gtfs_export.py b/amarillo/plugins/grfs_export/gtfs_export.py index 2317e62..a21155e 100644 --- a/amarillo/plugins/grfs_export/gtfs_export.py +++ b/amarillo/plugins/grfs_export/gtfs_export.py @@ -135,9 +135,9 @@ class GtfsExport: #if there is only one agency, use that agencies = set(trip.agency for id, trip in route_group.items()) if len(agencies) == 1: agency = agencies.pop() - trip = next(iter(route_group.values())) # grab any trip, relevant values should be the same + trip : Trip = next(iter(route_group.values())) # grab any trip, relevant values should be the same - self.routes.append(self._create_route(agency, trip.route_id, trip.route_name)) + self.routes.append(self._create_route(agency, trip.route_id, trip.route_name, trip.route_color, trip.route_text_color)) def _convert_trip(self, trip: Trip): self.trip_counter += 1 @@ -193,8 +193,8 @@ class GtfsExport: logger.exception(ex) return destination - def _create_route(self, agency, route_id, long_name): - return GtfsRoute(agency, route_id, long_name, RIDESHARING_ROUTE_TYPE, "") + def _create_route(self, agency, route_id, long_name, color, text_color): + return GtfsRoute(agency, route_id, long_name, RIDESHARING_ROUTE_TYPE, "", color, text_color) def _create_calendar(self, trip): # TODO currently, calendar is not provided by Fahrgemeinschaft.de interface. diff --git a/amarillo/plugins/grfs_export/models/gtfs.py b/amarillo/plugins/grfs_export/models/gtfs.py index 77026b1..1d5fcb5 100644 --- a/amarillo/plugins/grfs_export/models/gtfs.py +++ b/amarillo/plugins/grfs_export/models/gtfs.py @@ -4,7 +4,7 @@ from datetime import timedelta GtfsFeedInfo = namedtuple('GtfsFeedInfo', 'feed_id feed_publisher_name feed_publisher_url feed_lang feed_version') GtfsAgency = namedtuple('GtfsAgency', 'agency_id agency_name agency_url agency_timezone agency_lang agency_email') -GtfsRoute = namedtuple('GtfsRoute', 'agency_id route_id route_long_name route_type route_short_name') +GtfsRoute = namedtuple('GtfsRoute', 'agency_id route_id route_long_name route_type route_short_name route_color route_text_color') GtfsStop = namedtuple('GtfsStop', 'stop_id stop_lat stop_lon stop_name') GtfsStopTime = namedtuple('GtfsStopTime', 'trip_id departure_time arrival_time stop_id stop_sequence pickup_type drop_off_type timepoint') GtfsTrip = namedtuple('GtfsTrip', 'route_id trip_id driver_id service_id shape_id trip_headsign bikes_allowed trip_url')