aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/icewifi.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/scripts/icewifi.py b/scripts/icewifi.py
index 9286c0c..4fb0b79 100755
--- a/scripts/icewifi.py
+++ b/scripts/icewifi.py
@@ -3,16 +3,25 @@
import requests
import json
-data = requests.get("https://iceportal.de/api1/rs/status")
+TRIPINFO = "https://iceportal.de/api1/rs/tripInfo/trip"
+STATUS = "https://iceportal.de/api1/rs/status"
+
+data = requests.get(STATUS)
+trip = requests.get(TRIPINFO)
if data.status_code != 200:
- print(f"HTTP Status {data.status_code}")
+ print(f"Data HTTP Status {data.status_code}")
+if trip.status_code != 200:
+ print(f"Trip HTTP Status {data.status_code}")
t_info = data.json()
+t_trip = trip.json()
+
+future_stops = [ e for e in t_trip['trip']['stops'] if not e['info']['passed'] ]
return_info={
- 'text':t_info["tzn"],
- 'tooltip':f'BR{t_info["series"]}, I-Netz {t_info["internet"]}',
+ 'text':f"{t_trip['trip']['trainType']} {t_trip['trip']['vzn']}",
+ 'tooltip':f'BR{t_info["series"]}({t_info["tzn"]}), I-Netz {t_info["connectivity"]["currentState"]}',
#'class':'',
'percentage':t_info["speed"]
}