Added route_color and route_text_color

This commit is contained in:
Csaba 2024-02-21 13:05:17 +01:00
parent 174f3a4a2f
commit fdb36da9de
2 changed files with 5 additions and 5 deletions

View file

@ -135,9 +135,9 @@ class GtfsExport:
#if there is only one agency, use that #if there is only one agency, use that
agencies = set(trip.agency for id, trip in route_group.items()) agencies = set(trip.agency for id, trip in route_group.items())
if len(agencies) == 1: agency = agencies.pop() 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): def _convert_trip(self, trip: Trip):
self.trip_counter += 1 self.trip_counter += 1
@ -193,8 +193,8 @@ class GtfsExport:
logger.exception(ex) logger.exception(ex)
return destination return destination
def _create_route(self, agency, route_id, long_name): def _create_route(self, agency, route_id, long_name, color, text_color):
return GtfsRoute(agency, route_id, long_name, RIDESHARING_ROUTE_TYPE, "") return GtfsRoute(agency, route_id, long_name, RIDESHARING_ROUTE_TYPE, "", color, text_color)
def _create_calendar(self, trip): def _create_calendar(self, trip):
# TODO currently, calendar is not provided by Fahrgemeinschaft.de interface. # TODO currently, calendar is not provided by Fahrgemeinschaft.de interface.

View file

@ -4,7 +4,7 @@ from datetime import timedelta
GtfsFeedInfo = namedtuple('GtfsFeedInfo', 'feed_id feed_publisher_name feed_publisher_url feed_lang feed_version') 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') 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') 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') 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') GtfsTrip = namedtuple('GtfsTrip', 'route_id trip_id driver_id service_id shape_id trip_headsign bikes_allowed trip_url')