cycle through all preferred games
This commit is contained in:
+16
-9
@@ -366,7 +366,7 @@ def draw_single_game(canvas, game):
|
|||||||
def run():
|
def run():
|
||||||
global canvas
|
global canvas
|
||||||
preferred_game_on = False
|
preferred_game_on = False
|
||||||
games = []
|
preferred_game_ids = []
|
||||||
|
|
||||||
preferred_team = [
|
preferred_team = [
|
||||||
"BUF",
|
"BUF",
|
||||||
@@ -380,21 +380,28 @@ def run():
|
|||||||
if games:
|
if games:
|
||||||
for game in games:
|
for game in games:
|
||||||
if game['away'] in preferred_team or game['home'] in preferred_team:
|
if game['away'] in preferred_team or game['home'] in preferred_team:
|
||||||
preferred_game_on = game
|
preferred_game_on = True
|
||||||
print(game)
|
preferred_game_ids.append(game['id'])
|
||||||
break
|
break
|
||||||
|
|
||||||
if preferred_game_on:
|
if preferred_game_on:
|
||||||
draw_single_game(canvas, preferred_game_on)
|
for preferred_game in preferred_game_ids:
|
||||||
|
shown_game = [g for g in games if preferred_game == g['id']]
|
||||||
|
print(shown_game)
|
||||||
|
|
||||||
|
draw_single_game(canvas, shown_game[0])
|
||||||
|
canvas = matrix.SwapOnVSync(canvas)
|
||||||
|
sleep(10)
|
||||||
else:
|
else:
|
||||||
draw_all_games(games)
|
draw_all_games()
|
||||||
|
canvas = matrix.SwapOnVSync(canvas)
|
||||||
|
sleep(0.03)
|
||||||
else:
|
else:
|
||||||
graphics.DrawText(
|
graphics.DrawText(
|
||||||
canvas, font, 10, 22, graphics.Color(Colors.RED), "No games today"
|
canvas, font, 10, 22, graphics.Color(Colors.RED), "No games today"
|
||||||
)
|
)
|
||||||
|
canvas = matrix.SwapOnVSync(canvas)
|
||||||
canvas = matrix.SwapOnVSync(canvas)
|
sleep(0.03)
|
||||||
sleep(10)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user