added RRX hotspot

This commit is contained in:
chrissy 2026-01-03 08:36:23 +01:00
parent 0cba7b3753
commit 32a03f1f2a
1 changed files with 30 additions and 2 deletions

View File

@ -13,6 +13,8 @@ timezone = pytz.timezone('Europe/Berlin')
statusData = None #initialize variables...
tripData = None
tlApiToken="[YOUR API TOKEN]
# Request the raw data from ICE-Portal and raise an exception, when it is not avialable.
def get_api_db():
global statusData
@ -29,9 +31,20 @@ def get_api_db():
# Request data from travelynx
def get_api_tl():
global tripDataTl
tripDataTl_response = requests.get("https://travelynx.de/api/v1/status/[YOUR API TOKEN]", timeout=5)
tripDataTl_response = requests.get(f"https://travelynx.de/api/v1/status/{tlApiToken}", timeout=5)
tripDataTl = tripDataTl_response.json()
def get_api_cd():
global statusDataCD
global tripDataCD
try:
statusDataCD_response = requests.get("http://cdwifi.cz/portal/api/vehicle/realtime", timeout=5)
statusDataCD = statusDataCD_response.json()
return 1
except requests.exceptions.RequestException:
return 0
# Look for the current SSID. Replace wlp2s0 with the real name of your wifi interface and check, that the path to iwlist is correct (just type 'which iwlist' in the terminal)
def get_ssid():
@ -54,6 +67,17 @@ def get_speed_db():
except:
return "No Speed"
def get_speed_cd():
try:
speed=str(statusDataCD['speed'])
if speed==None:
speed="No Speed"
return speed
except:
return "No Speed"
# Figure out, whats the next station and filter the output for this.
def get_next_db():
if tripData["trip"]["stopInfo"] == None :
@ -121,10 +145,14 @@ def main():
get_api_tl()
print(get_trainInfo_tl()+" | NEXT: "+get_next_tl())
if get_ssid() == "WIFI@DB":
if get_ssid() == "WIFI@DB" or "RRX Hotspot":
get_api_tl()
print(get_trainInfo_tl()+" | NEXT: "+get_next_tl())
if get_ssid() == "CDWiFi":
get_api_tl()
get_api_cd()
print(get_trainInfo_tl()+" | "+"SPEED: "+get_speed_cd()+" km/h | NEXT: "+get_next_tl())
if __name__ == '__main__':
sys.exit(main())