Skip to content

Instantly share code, notes, and snippets.

@quantenProjects
Last active August 10, 2019 14:22
Show Gist options
  • Save quantenProjects/9e9303d00511d57c6d951cc58e026bae to your computer and use it in GitHub Desktop.
Save quantenProjects/9e9303d00511d57c6d951cc58e026bae to your computer and use it in GitHub Desktop.
Big Font Tacho for Wifi-On-ICE with figlet
import requests
import json
import time
import sys
import os
from colorama import init
init(strip=not sys.stdout.isatty()) # strip colors if stdout is redirected
from termcolor import cprint
from pyfiglet import figlet_format
while True:
try:
jsonText = json.loads(requests.get("https://portal.imice.de/api1/rs/status").text)
os.system("clear")
print(figlet_format(str(jsonText["speed"] )+ " km/h", font='banner'))
print("GPS status: {gpsstatus}".format(gpsstatus=jsonText["gpsStatus"]))
print("Connection: {conn}, Service level: {servicelevel}, Internet: {internet}".format(conn=jsonText["connection"],servicelevel=jsonText["servicelevel"],internet=jsonText["internet"]))
print("Class: {wagonClass}, Baureihe: {br}, TZN: {tzn}".format(wagonClass=jsonText["wagonClass"],br=jsonText["series"],tzn=jsonText["tzn"]))
time.sleep(1.9)
except:
pass
time.sleep(0.1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment