From 1e665d45b7115a8b9cde6c1b26c2c2deacd5e52b Mon Sep 17 00:00:00 2001 From: cube Date: Sat, 30 May 2026 21:43:47 +0100 Subject: [PATCH] examples named --- README.md | 6 ------ example.py => example_live_timeline.py | 0 example2.py => example_situation.py | 0 example_timeline_all.py | 18 ++++++++++++++++++ 4 files changed, 18 insertions(+), 6 deletions(-) rename example.py => example_live_timeline.py (100%) rename example2.py => example_situation.py (100%) create mode 100644 example_timeline_all.py diff --git a/README.md b/README.md index 1484c42..d32500a 100644 --- a/README.md +++ b/README.md @@ -36,9 +36,3 @@ from pcslive import LiveStats stats = LiveStats() 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 diff --git a/example.py b/example_live_timeline.py similarity index 100% rename from example.py rename to example_live_timeline.py diff --git a/example2.py b/example_situation.py similarity index 100% rename from example2.py rename to example_situation.py diff --git a/example_timeline_all.py b/example_timeline_all.py new file mode 100644 index 0000000..57c7307 --- /dev/null +++ b/example_timeline_all.py @@ -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 \ No newline at end of file