examples named
This commit is contained in:
@@ -36,9 +36,3 @@ from pcslive import LiveStats
|
|||||||
stats = LiveStats()
|
stats = LiveStats()
|
||||||
stats.print_races()
|
stats.print_races()
|
||||||
```
|
```
|
||||||
|
|
||||||
# examples
|
|
||||||
|
|
||||||
`example.py` posts the latest timeline of one current race (checking every 10 seconds for updates)
|
|
||||||
|
|
||||||
`example2.py` organises the situation diagram in a dictionary of timegap keys to a list of riders in that group. it could probably be organised better but it works
|
|
||||||
|
|||||||
18
example_timeline_all.py
Normal file
18
example_timeline_all.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
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, ":")
|
||||||
|
|
||||||
|
race.get_timeline()
|
||||||
|
|
||||||
|
# prints in reverse so you dont have to scroll up to the most recent :P
|
||||||
|
count = len(race.timeline) - 1
|
||||||
|
for item in race.timeline:
|
||||||
|
print(item[count])
|
||||||
|
print("===================")
|
||||||
|
count -= 1
|
||||||
Reference in New Issue
Block a user