Skip to content

Commit

Permalink
Small display changes
Browse files Browse the repository at this point in the history
  • Loading branch information
IsoPorksu committed Feb 3, 2025
1 parent e13bf19 commit 51237fa
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
20 changes: 10 additions & 10 deletions Core Code/TrueTrack.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Core Code v10.7 (2.2.25)
import asyncio, json, time, textwrap, platform, requests, paho.mqtt.client as mqtt
import json, time, textwrap, platform, requests, paho.mqtt.client as mqtt
from os import system
from math import *
from datetime import datetime, timezone, timedelta
from pytz import timezone
from pathlib import Path
from asyncio import sleep
from asyncio import *

global last_message, start_time, vehicles, friends, vuoros, session
last_message, start_time, vehicles, friends, vuoros, session, last_etas = time.time(), datetime.now(), {}, {}, {}, requests.Session(), {}
Expand Down Expand Up @@ -136,8 +136,8 @@ def print_maker(car, station, next, eta, destination, speed, departure, seq, vuo
x="x"
vuoro=vuoro[:-1]
else: x=" "
if vuoro == 'Unknown': string += f" {departure}"
else: string += f"{x}{timetable}{vuoro:<3}{departure[1:]}"
if vuoro == 'Unknown': string += f" {departure}"
else: string += f"{x}{timetable}{vuoro:<3}{departure}"
print_list.append(string)

async def fetch_alerts():
Expand Down Expand Up @@ -186,10 +186,10 @@ async def print_vehicle_table():
now = datetime.now(timezone("Europe/Helsinki"))
clear()
print(f" Runtime: {int(runtime.total_seconds())}s Ping: {ceil((time.time() - last_message) * 1000)}ms Time: {now.strftime('%H:%M:%S')} Timetable: {timetable}")
print(" Set | Now -> Next ETA | Destination|Set 2|Sped|Vuoro Dep")
print(" ----|-------------------|------------|-----|----|---------")
print(" Set | Now -> Next ETA | Destination|Set 2|Sped|Vuoro Dep ")
print(" ----|-------------------|------------|-----|----|----------")
for item in print_list: print(item)
print(" ----|-------------------|------------|-----|----|---------")
print(" ----|-------------------|------------|-----|----|----------")

total_m2 = counters['mm'] + counters['tap']
total_m1 = counters['vs'] + counters['kil']
Expand Down Expand Up @@ -326,7 +326,7 @@ async def main():
time.sleep(1)
client.subscribe(topic)
client.loop_start()
await asyncio.gather(update_vehicle_table(), export_vuoro(), check_timetable())
stop_event = asyncio.Event()
await gather(update_vehicle_table(), export_vuoro(), check_timetable())
stop_event = Event()

asyncio.run(main())
run(main())
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ I don't know; figure it out yourself.
The display will look something like this:
```Runtime: 4s Ping: 138ms Time: 20:50:32 Timetable: S
Set | Now -> Next ETA | Destination|Set 2|Sped|Vuoro Dep
----|-------------------|------------|-----|----|---------
^113 | HY1 | MM | 177 | |xS6 0:35
^123 | LAS2 -> KOS2 21s | KIL | 167 | 62 | S7 9:18
167 | LAS2 -> KOS2 21s | KIL |^123 | 62 | S7 9:18
177 | HY1 | MM |^113 | |xS6 0:35
^203 | IK1 -> MP1 25s | MM | 219 | 70 | S14 0:21
219 | IK1 -> MP1 25s | MM |^203 | 70 | S14 0:21
303 | KA2 | KIL | | | S3 9:38
309 | URP2 | KIL | | |xS19 9:29
320*| RT2 | KIL | | | S12 9:49
----|-------------------|------------|-----|----|---------
----|-------------------|------------|-----|----|----------
^113 | HY1 | MM | 177 | |xS6 20:35
^123 | LAS2 -> KOS2 21s | KIL | 167 | 62 | S7 19:18
167 | LAS2 -> KOS2 21s | KIL |^123 | 62 | S7 19:18
177 | HY1 | MM |^113 | |xS6 20:35
^203 | IK1 -> MP1 25s | MM | 219 | 70 | S14 20:21
219 | IK1 -> MP1 25s | MM |^203 | 70 | S14 20:21
303 | KA2 | KIL | | | S3 19:38
309 | URP2 | KIL | | |xS19 19:29
320*| RT2 | KIL | | | S12 19:49
----|-------------------|------------|-----|----|----------
6 | 4xM1 2xM2 | 0 2 0 4 | | |
2xM100, 1xM200, 3xM300, 0xO300 = :(
```
Expand Down

0 comments on commit 51237fa

Please sign in to comment.