23 lines
696 B
Python
23 lines
696 B
Python
from pcslive import LiveStats
|
|
import time
|
|
|
|
stats = LiveStats()
|
|
|
|
# if there are live races...
|
|
if len(stats.races) > 0:
|
|
race = stats.races[0] # just grab the first one for example's sake
|
|
print("Latest timeline update from", race.title, ":")
|
|
|
|
# keep the last update so we don't spam the terminal
|
|
last_update = ""
|
|
while True:
|
|
race.get_timeline()
|
|
|
|
# only update terminal if the newest item has changed (is new)
|
|
if last_update != race.timeline[0]:
|
|
print(race.timeline[0])
|
|
last_update = race.timeline[0]
|
|
|
|
# wait ten seconds before checking again
|
|
# maybe set to longer if running for extended time
|
|
time.sleep(10) |