i3pystatus/ice-status: fix delay display, add track info

This commit is contained in:
Franzi 2021-10-10 18:39:11 +02:00
parent 8f4229b1e2
commit e920bf8281
Signed by untrusted user: kunsi
GPG key ID: 12E3D2136B818350

View file

@ -38,10 +38,16 @@ try:
next_stop_id = trip_info['stopInfo']['actualNext'] next_stop_id = trip_info['stopInfo']['actualNext']
for stop in trip_info['stops']: for stop in trip_info['stops']:
if stop['station']['evaNr'] == next_stop_id: if stop['station']['evaNr'] == next_stop_id:
next_stop = '{} {}{}'.format( if stop['timetable']['departureDelay']:
delay = ' ({})'.format(stop['timetable']['departureDelay'])
else:
delay = ''
next_stop = '{} [{}] {}{}'.format(
stop['station']['name'], stop['station']['name'],
stop['track']['actual'],
datetime.fromtimestamp(stop['timetable']['actualArrivalTime']/1000).strftime('%H:%M'), datetime.fromtimestamp(stop['timetable']['actualArrivalTime']/1000).strftime('%H:%M'),
stop['timetable']['departureDelay'] if stop['timetable']['departureDelay'] else '', delay
) )
break break
else: else: