From 039741871492e2cffde659b1b1b839e5aec3a726 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonia=20P=C3=A9rez-Cerezo?= Date: Mon, 18 Nov 2024 14:20:40 +0100 Subject: [PATCH 1/2] Fix issue where trains stop only to drop off passengers --- travelynx-waybar.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/travelynx-waybar.py b/travelynx-waybar.py index 1e5e221..1a557d9 100755 --- a/travelynx-waybar.py +++ b/travelynx-waybar.py @@ -93,10 +93,13 @@ if checked_in or args.last_checkin is not None : dep = timestring(stop, "Departure") arr = timestring(stop, "Arrival") tooltip = tooltip + f'\n{arr}–{dep} {stop["name"]}' - elif int(stop["scheduledDeparture"]) > now : + elif stop["scheduledDeparture"] is not None and int(stop["scheduledDeparture"]) > now : dep = humantime(stop["scheduledDeparture"]) arr = humantime(stop["scheduledArrival"]) tooltip = tooltip + f'\n{arr}–{dep} {stop["name"]}' + elif stop["scheduledDeparture"] is None and int(stop["scheduledArrival"]) > now : + arr = humantime(stop["scheduledArrival"]) + tooltip = tooltip + f'\narrival {arr} {stop["name"]}' print(json.dumps({"text": st, "tooltip": tooltip, "class": "active", "percentage": ""})) From 5b4b75212da3aa4d45442479482cf52e7c84e00d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonia=20P=C3=A9rez-Cerezo?= Date: Fri, 28 Mar 2025 09:48:19 +0100 Subject: [PATCH 2/2] Fix handling of border points --- travelynx-waybar.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/travelynx-waybar.py b/travelynx-waybar.py index 1a557d9..b61f764 100755 --- a/travelynx-waybar.py +++ b/travelynx-waybar.py @@ -89,6 +89,8 @@ if checked_in or args.last_checkin is not None : stops = response["intermediateStops"] now = time.time() for stop in stops: + if stop["scheduledDeparture"] is None and stop["scheduledArrival"] is None : + continue if stop["realDeparture"] is not None and int(stop["realDeparture"]) > now : dep = timestring(stop, "Departure") arr = timestring(stop, "Arrival")