example gives a running timeline checking every 10 seconds

This commit is contained in:
cube
2026-05-30 18:59:12 +01:00
parent 57a6ebbf35
commit 452a2572fa
2 changed files with 13 additions and 3 deletions

View File

@@ -1,4 +1,5 @@
from pcslive import LiveStats
import time
stats = LiveStats()
@@ -6,6 +7,11 @@ if len(stats.races) > 0:
race = stats.races[0]
print("Latest timeline update from", race.title, ":")
race.get_timeline()
print(race.timeline[0])
last_update = ""
while True:
race.get_timeline()
if last_update != race.timeline[0]:
print(race.timeline[0])
last_update = race.timeline[0]
time.sleep(10)