From e920bf82819ba3a04f1bd8fe071adf421a23195f Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Sun, 10 Oct 2021 18:39:11 +0200 Subject: [PATCH] i3pystatus/ice-status: fix delay display, add track info --- .config/i3pystatus/ice-status.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.config/i3pystatus/ice-status.py b/.config/i3pystatus/ice-status.py index 9dafd06..27cc22c 100755 --- a/.config/i3pystatus/ice-status.py +++ b/.config/i3pystatus/ice-status.py @@ -38,10 +38,16 @@ try: next_stop_id = trip_info['stopInfo']['actualNext'] for stop in trip_info['stops']: 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['track']['actual'], datetime.fromtimestamp(stop['timetable']['actualArrivalTime']/1000).strftime('%H:%M'), - stop['timetable']['departureDelay'] if stop['timetable']['departureDelay'] else '', + delay ) break else: