From bc315aca16c6474f034ee09a3cec36f58c97669c Mon Sep 17 00:00:00 2001 From: User Name Date: Thu, 18 Apr 2024 09:38:32 -0400 Subject: [PATCH] pre-playoff fixes --- src/boards/boards.py | 14 +++++++++++--- src/data/data.py | 23 ++++++++++++++++------- src/main.py | 1 + src/renderer/main.py | 10 +++++----- 4 files changed, 33 insertions(+), 15 deletions(-) diff --git a/src/boards/boards.py b/src/boards/boards.py index e5adb225..0bce9f8a 100644 --- a/src/boards/boards.py +++ b/src/boards/boards.py @@ -5,7 +5,7 @@ """ import debug from boards.scoreticker import Scoreticker -from boards.seriesticker import Seriesticker +# from boards.seriesticker import Seriesticker from boards.standings import Standings from boards.team_summary import TeamSummary from boards.clock import Clock @@ -222,17 +222,25 @@ def fallback(self, data, matrix, sleepEvent): def scoreticker(self, data, matrix, sleepEvent): Scoreticker(data, matrix, sleepEvent).render() + # Since 2024, the playoff features are removed as we have not colected the new API endpoint for them. def seriesticker(self, data, matrix, sleepEvent): + debug.info("seriesticker is disabled. This feature is not available right now") + pass ''' forcing it to show since the playoff start and regular season end are in conflict for 2021 ''' - Seriesticker(data, matrix, sleepEvent).render() + + #Seriesticker(data, matrix, sleepEvent).render() + '''if data.status.is_playoff(data.today, data.playoffs): Seriesticker(data, matrix, sleepEvent).render() ''' + # Since 2024, the playoff features are removed as we have not colected the new API endpoint for them. def stanley_cup_champions(self, data, matrix, sleepEvent): - StanleyCupChampions(data, matrix, sleepEvent).render() + debug.info("stanley_cup_champions is disabled. This feature is not available right now") + pass + #StanleyCupChampions(data, matrix, sleepEvent).render() def standings(self, data, matrix, sleepEvent): #Try making standings a thread diff --git a/src/data/data.py b/src/data/data.py index 31f47623..4d89c9c6 100644 --- a/src/data/data.py +++ b/src/data/data.py @@ -146,6 +146,7 @@ def __init__(self, config): self.network_issues = False # Get the teams info + print("update Teams info") self.teams_info = self.get_teams() # So oddly enough, there are a handful of situations where the API does not include the team_id # it's happening often enough that it's worth keeping a second teams_info that is keyed off of the @@ -163,6 +164,7 @@ def __init__(self, config): self.new_data = True # Get the status from the API + print("Get status from api") self.get_status() # Get favorite team's id @@ -175,6 +177,7 @@ def __init__(self, config): #self.current_game_index = 0 # Fetch the games for today + print("refresh games") self.refresh_games() # Flag to indicate if all preferred games are Final @@ -184,6 +187,7 @@ def __init__(self, config): self.today = self.date() # Get refresh standings + print("refresh standings") self.refresh_standings() # Playoff Flag @@ -295,26 +299,30 @@ def refresh_games(self): self.games = [] self.pref_games = [] return data - + self.games = data["games"] self.pref_games = filter_list_of_games(self.games, self.pref_teams) + # Populate the TeamInfo classes used for the team_summary board for team_id in self.pref_teams: # import pdb; pdb.set_trace() team_info = self.teams_info[team_id].details - pg, ng = nhl_api.info.team_previous_game(team_info.abbrev, str(date.today())) - team_info.previous_game = pg - team_info.next_game = ng - + try: + pg, ng = nhl_api.info.team_previous_game(team_info.abbrev, str(date.today())) + team_info.previous_game = pg + team_info.next_game = ng + except: + pass + print("probe 2") if self.config.preferred_teams_only and self.pref_teams: self.games = self.pref_games - + print("probe 3") if not self.is_pref_team_offday() and self.config.live_mode: #self.pref_games = prioritize_pref_games(self.pref_games, self.pref_teams) self.check_all_pref_games_final() # TODO: This shouldn't be needed to get the fact that your preferred team has a game today self.check_game_priority() - + print("probe 4") self.network_issues = False break @@ -326,6 +334,7 @@ def refresh_games(self): sleep(NETWORK_RETRY_SLEEP_TIME) except IndexError as error_message: + print("probe 5") debug.error(error_message) debug.info("All preferred games are Final, showing the top preferred game") #self.current_game_index = 0 diff --git a/src/main.py b/src/main.py index dbb37aef..1b86c3a2 100644 --- a/src/main.py +++ b/src/main.py @@ -64,6 +64,7 @@ def run(): # This data will get passed throughout the entirety of this program. # It initializes all sorts of things like current season, teams, helper functions + print("init Data") data = Data(config) #If we pass the logging arguments on command line, override what's in the config.json, else use what's in config.json (color will always be false in config.json) diff --git a/src/renderer/main.py b/src/renderer/main.py index 66e0ef03..53510a53 100755 --- a/src/renderer/main.py +++ b/src/renderer/main.py @@ -5,7 +5,7 @@ from boards.boards import Boards from boards.clock import Clock from boards.stanley_cup_champions import StanleyCupChampions -from boards.seriesticker import Seriesticker +#from boards.seriesticker import Seriesticker from boards.team_summary import TeamSummary from boards.standings import Standings from data.scoreboard import Scoreboard @@ -169,10 +169,10 @@ def __render_game_day(self): debug.info("Game Over") sbrenderer = ScoreboardRenderer(self.data, self.matrix, self.scoreboard) self.check_new_goals() - if self.data.isPlayoff and self.data.stanleycup_round: + """ if self.data.isPlayoff and self.data.stanleycup_round: self.data.check_stanley_cup_champion() if self.data.cup_winner_id: - StanleyCupChampions(self.data, self.matrix, self.sleepEvent).render() + StanleyCupChampions(self.data, self.matrix, self.sleepEvent).render() """ self.__render_postgame(sbrenderer) self.sleepEvent.wait(self.refresh_rate) @@ -184,10 +184,10 @@ def __render_game_day(self): debug.info("FINAL") sbrenderer = ScoreboardRenderer(self.data, self.matrix, self.scoreboard) self.check_new_goals() - if self.data.isPlayoff and self.data.stanleycup_round: + """ if self.data.isPlayoff and self.data.stanleycup_round: self.data.check_stanley_cup_champion() if self.data.cup_winner_id: - StanleyCupChampions(self.data, self.matrix, self.sleepEvent).render() + StanleyCupChampions(self.data, self.matrix, self.sleepEvent).render() """ self.__render_postgame(sbrenderer) self.sleepEvent.wait(self.refresh_rate)