Skip to content

Commit

Permalink
cantamen seat attributes fix (#172)
Browse files Browse the repository at this point in the history
  • Loading branch information
ThorstenFroehlinghaus authored Oct 17, 2024
1 parent 9ef9ecd commit c2d3f2a
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions x2gbfs/providers/cantamen.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,15 @@ def _parse_attributes(self, attributes):
if lowercasedClass.startswith('seats'):
# seats are encoded differently per provider: SEATSX, seats_x
seatsClass = lowercasedClass.replace('_', '')
numberOfSeats_str = seatsClass[len('seats') :]
numberOfSeats = 7 if numberOfSeats_str == '5plus2' else int(numberOfSeats_str)
self.seats[attributeId] = numberOfSeats
numberOfSeats = seatsClass[len('seats') :]
if numberOfSeats == '5plus2':
self.seats[attributeId] = 7
elif numberOfSeats == '6bus':
self.seats[attributeId] = 6
elif numberOfSeats.isdigit():
self.seats[attributeId] = int(numberOfSeats)
else:
logger.info(f'Seat attribute {attribute["Class"]} is unknown and will be ignored')

def _all_bookees(self) -> Generator[Dict[str, Any], None, None]:
bookees = self._load_response()['Bookee']
Expand Down

0 comments on commit c2d3f2a

Please sign in to comment.