team switch logging (#73)

Works and doesn't seem to break anything else
This commit is contained in:
Chuck
2025-09-27 12:50:50 -04:00
committed by GitHub
parent fc06493990
commit a98760f4d9
7 changed files with 124 additions and 9 deletions

View File

@@ -1015,7 +1015,15 @@ class SportsUpcoming(SportsCore):
self.current_game = self.games_list[self.current_game_index] self.current_game = self.games_list[self.current_game_index]
self.last_game_switch = current_time self.last_game_switch = current_time
force_clear = True # Force redraw on switch force_clear = True # Force redraw on switch
self.logger.debug(f"Switched to game index {self.current_game_index}") # Changed log prefix
# Log team switching with sport prefix
if self.current_game:
away_abbr = self.current_game.get('away_abbr', 'UNK')
home_abbr = self.current_game.get('home_abbr', 'UNK')
sport_prefix = self.sport_key.upper() if hasattr(self, 'sport_key') else 'SPORT'
self.logger.info(f"[{sport_prefix} Upcoming] Showing {away_abbr} vs {home_abbr}")
else:
self.logger.debug(f"Switched to game index {self.current_game_index}")
if self.current_game: if self.current_game:
self._draw_scorebug_layout(self.current_game, force_clear) self._draw_scorebug_layout(self.current_game, force_clear)
@@ -1304,7 +1312,15 @@ class SportsRecent(SportsCore):
self.current_game = self.games_list[self.current_game_index] self.current_game = self.games_list[self.current_game_index]
self.last_game_switch = current_time self.last_game_switch = current_time
force_clear = True # Force redraw on switch force_clear = True # Force redraw on switch
self.logger.debug(f"Switched to game index {self.current_game_index}") # Changed log prefix
# Log team switching with sport prefix
if self.current_game:
away_abbr = self.current_game.get('away_abbr', 'UNK')
home_abbr = self.current_game.get('home_abbr', 'UNK')
sport_prefix = self.sport_key.upper() if hasattr(self, 'sport_key') else 'SPORT'
self.logger.info(f"[{sport_prefix} Recent] Showing {away_abbr} vs {home_abbr}")
else:
self.logger.debug(f"Switched to game index {self.current_game_index}")
if self.current_game: if self.current_game:
self._draw_scorebug_layout(self.current_game, force_clear) self._draw_scorebug_layout(self.current_game, force_clear)

View File

@@ -918,6 +918,13 @@ class MLBLiveManager(BaseMLBManager, BaseballLive):
self.current_game_index = (self.current_game_index + 1) % len(self.live_games) self.current_game_index = (self.current_game_index + 1) % len(self.live_games)
self.current_game = self.live_games[self.current_game_index] self.current_game = self.live_games[self.current_game_index]
self.last_game_switch = current_time self.last_game_switch = current_time
# Log team switching
if self.current_game:
away_abbr = self.current_game.get('away_abbr', 'UNK')
home_abbr = self.current_game.get('home_abbr', 'UNK')
self.logger.info(f"[MLB Live] Showing {away_abbr} vs {home_abbr}")
# Force display update when switching games # Force display update when switching games
# self.display(force_clear=True) # REMOVED: DisplayController handles this # self.display(force_clear=True) # REMOVED: DisplayController handles this
self.last_display_update = current_time self.last_display_update = current_time
@@ -1314,6 +1321,12 @@ class MLBRecentManager(BaseMLBManager, SportsRecent):
self.last_game_switch = current_time self.last_game_switch = current_time
force_clear = True # Force clear when switching games force_clear = True # Force clear when switching games
# Log team switching
if self.current_game:
away_abbr = self.current_game.get('away_abbr', 'UNK')
home_abbr = self.current_game.get('home_abbr', 'UNK')
self.logger.info(f"[MLB Recent] Showing {away_abbr} vs {home_abbr}")
# Create and display the game image # Create and display the game image
game_image = self._create_game_display(self.current_game) game_image = self._create_game_display(self.current_game)
self.display_manager.image = game_image self.display_manager.image = game_image
@@ -1455,6 +1468,12 @@ class MLBUpcomingManager(BaseMLBManager, SportsUpcoming):
self.last_game_switch = current_time self.last_game_switch = current_time
force_clear = True # Force clear when switching games force_clear = True # Force clear when switching games
# Log team switching
if self.current_game:
away_abbr = self.current_game.get('away_abbr', 'UNK')
home_abbr = self.current_game.get('home_abbr', 'UNK')
self.logger.info(f"[MLB Upcoming] Showing {away_abbr} vs {home_abbr}")
# Create and display the game image # Create and display the game image
game_image = self._create_game_display(self.current_game) game_image = self._create_game_display(self.current_game)
self.display_manager.image = game_image self.display_manager.image = game_image

View File

@@ -834,6 +834,12 @@ class NBARecentManager(BaseNBAManager):
self.last_game_switch = current_time self.last_game_switch = current_time
force_clear = True force_clear = True
# Log team switching
if self.current_game:
away_abbr = self.current_game.get('away_abbr', 'UNK')
home_abbr = self.current_game.get('home_abbr', 'UNK')
self.logger.info(f"[NBA Recent] Showing {away_abbr} vs {home_abbr}")
# Draw the scorebug layout # Draw the scorebug layout
self._draw_scorebug_layout(self.current_game, force_clear) self._draw_scorebug_layout(self.current_game, force_clear)
@@ -928,6 +934,12 @@ class NBAUpcomingManager(BaseNBAManager):
self.last_game_switch = current_time self.last_game_switch = current_time
force_clear = True force_clear = True
# Log team switching
if self.current_game:
away_abbr = self.current_game.get('away_abbr', 'UNK')
home_abbr = self.current_game.get('home_abbr', 'UNK')
self.logger.info(f"[NBA Upcoming] Showing {away_abbr} vs {home_abbr}")
# Draw the scorebug layout # Draw the scorebug layout
self._draw_scorebug_layout(self.current_game, force_clear) self._draw_scorebug_layout(self.current_game, force_clear)

View File

@@ -680,6 +680,13 @@ class NCAABaseballLiveManager(BaseNCAABaseballManager, BaseballLive):
self.current_game_index = (self.current_game_index + 1) % len(self.live_games) self.current_game_index = (self.current_game_index + 1) % len(self.live_games)
self.current_game = self.live_games[self.current_game_index] self.current_game = self.live_games[self.current_game_index]
self.last_game_switch = current_time self.last_game_switch = current_time
# Log team switching
if self.current_game:
away_team = self.current_game.get('away_team', 'UNK')
home_team = self.current_game.get('home_team', 'UNK')
self.logger.info(f"[NCAABASEBALL Live] Showing {away_team} vs {home_team}")
# Force display update when switching games # Force display update when switching games
# self.display(force_clear=True) # REMOVED: DisplayController handles this # self.display(force_clear=True) # REMOVED: DisplayController handles this
self.last_display_update = current_time # Track last successful update that *would* have displayed self.last_display_update = current_time # Track last successful update that *would* have displayed
@@ -967,6 +974,12 @@ class NCAABaseballRecentManager(BaseNCAABaseballManager, SportsRecent):
self.last_game_switch = current_time self.last_game_switch = current_time
force_clear = True force_clear = True
# Log team switching
if self.current_game:
away_team = self.current_game.get('away_team', 'UNK')
home_team = self.current_game.get('home_team', 'UNK')
logger.info(f"[NCAABASEBALL Recent] Showing {away_team} vs {home_team}")
if self.current_game: if self.current_game:
game_image = self._create_game_display(self.current_game) game_image = self._create_game_display(self.current_game)
self.display_manager.image = game_image self.display_manager.image = game_image
@@ -1087,6 +1100,12 @@ class NCAABaseballUpcomingManager(BaseNCAABaseballManager, SportsUpcoming):
self.last_game_switch = current_time self.last_game_switch = current_time
force_clear = True force_clear = True
# Log team switching
if self.current_game:
away_team = self.current_game.get('away_team', 'UNK')
home_team = self.current_game.get('home_team', 'UNK')
logger.info(f"[NCAABASEBALL Upcoming] Showing {away_team} vs {home_team}")
if self.current_game: if self.current_game:
game_image = self._create_game_display(self.current_game) game_image = self._create_game_display(self.current_game)
self.display_manager.image = game_image self.display_manager.image = game_image

View File

@@ -779,6 +779,12 @@ class NCAAMBasketballLiveManager(BaseNCAAMBasketballManager):
self.current_game = self.live_games[self.current_game_index] self.current_game = self.live_games[self.current_game_index]
self.last_game_switch = current_time self.last_game_switch = current_time
# Log team switching
if self.current_game:
away_abbr = self.current_game.get('away_abbr', 'UNK')
home_abbr = self.current_game.get('home_abbr', 'UNK')
self.logger.info(f"[NCAAMBASKETBALL Live] Showing {away_abbr} vs {home_abbr}")
# Only update display if we have new data and enough time has passed # Only update display if we have new data and enough time has passed
if current_time - self.last_display_update >= 1.0: if current_time - self.last_display_update >= 1.0:
@@ -935,6 +941,12 @@ class NCAAMBasketballRecentManager(BaseNCAAMBasketballManager):
self.last_game_switch = current_time self.last_game_switch = current_time
force_clear = True # Force clear when switching games force_clear = True # Force clear when switching games
# Log team switching
if self.current_game:
away_abbr = self.current_game.get('away_abbr', 'UNK')
home_abbr = self.current_game.get('home_abbr', 'UNK')
self.logger.info(f"[NCAAMBASKETBALL Recent] Showing {away_abbr} vs {home_abbr}")
# If only one game, ensure it's set correctly # If only one game, ensure it's set correctly
elif len(self.recent_games) == 1: elif len(self.recent_games) == 1:
self.current_game = self.recent_games[0] self.current_game = self.recent_games[0]
@@ -1078,6 +1090,12 @@ class NCAAMBasketballUpcomingManager(BaseNCAAMBasketballManager):
self.last_game_switch = current_time self.last_game_switch = current_time
force_clear = True # Force clear when switching games force_clear = True # Force clear when switching games
# Log team switching
if self.current_game:
away_abbr = self.current_game.get('away_abbr', 'UNK')
home_abbr = self.current_game.get('home_abbr', 'UNK')
self.logger.info(f"[NCAAMBASKETBALL Upcoming] Showing {away_abbr} vs {home_abbr}")
# If only one game, ensure it's set # If only one game, ensure it's set
elif len(self.upcoming_games) == 1: elif len(self.upcoming_games) == 1:
self.current_game = self.upcoming_games[0] self.current_game = self.upcoming_games[0]

View File

@@ -681,6 +681,13 @@ class NHLLiveManager(BaseNHLManager):
self.current_game_index = (self.current_game_index + 1) % len(self.live_games) self.current_game_index = (self.current_game_index + 1) % len(self.live_games)
self.current_game = self.live_games[self.current_game_index] self.current_game = self.live_games[self.current_game_index]
self.last_game_switch = current_time self.last_game_switch = current_time
# Log team switching
if self.current_game:
away_abbr = self.current_game.get('away_abbr', 'UNK')
home_abbr = self.current_game.get('home_abbr', 'UNK')
self.logger.info(f"[NHL Live] Showing {away_abbr} vs {home_abbr}")
# self.display(force_clear=True) # REMOVED: DisplayController handles this # self.display(force_clear=True) # REMOVED: DisplayController handles this
self.last_display_update = current_time # Track time for potential display update self.last_display_update = current_time # Track time for potential display update
@@ -793,6 +800,12 @@ class NHLRecentManager(BaseNHLManager):
self.last_game_switch = current_time self.last_game_switch = current_time
force_clear = True # Force clear when switching games force_clear = True # Force clear when switching games
# Log team switching
if self.current_game:
away_abbr = self.current_game.get('away_abbr', 'UNK')
home_abbr = self.current_game.get('home_abbr', 'UNK')
self.logger.info(f"[NHL Recent] Showing {away_abbr} vs {home_abbr}")
# Draw the scorebug layout # Draw the scorebug layout
self._draw_scorebug_layout(self.current_game, force_clear) self._draw_scorebug_layout(self.current_game, force_clear)
@@ -926,6 +939,12 @@ class NHLUpcomingManager(BaseNHLManager):
self.last_game_switch = current_time self.last_game_switch = current_time
force_clear = True # Force clear when switching games force_clear = True # Force clear when switching games
# Log team switching
if self.current_game:
away_abbr = self.current_game.get('away_abbr', 'UNK')
home_abbr = self.current_game.get('home_abbr', 'UNK')
self.logger.info(f"[NHL Upcoming] Showing {away_abbr} vs {home_abbr}")
# Draw the scorebug layout # Draw the scorebug layout
self._draw_scorebug_layout(self.current_game, force_clear) self._draw_scorebug_layout(self.current_game, force_clear)

View File

@@ -1090,6 +1090,12 @@ class SoccerRecentManager(BaseSoccerManager):
self.last_game_switch = current_time self.last_game_switch = current_time
force_clear = True # Force clear when switching games force_clear = True # Force clear when switching games
# Log team switching
if self.current_game:
away_abbr = self.current_game.get('away_abbr', 'UNK')
home_abbr = self.current_game.get('home_abbr', 'UNK')
self.logger.info(f"[SOCCER Recent] Showing {away_abbr} vs {home_abbr}")
# Ensure current_game is set (it might be None initially) # Ensure current_game is set (it might be None initially)
if not self.current_game and self.games_list: if not self.current_game and self.games_list:
self.current_game = self.games_list[self.current_game_index] self.current_game = self.games_list[self.current_game_index]
@@ -1229,6 +1235,12 @@ class SoccerUpcomingManager(BaseSoccerManager):
self.last_game_switch = current_time self.last_game_switch = current_time
force_clear = True # Force clear when switching games force_clear = True # Force clear when switching games
# Log team switching
if self.current_game:
away_abbr = self.current_game.get('away_abbr', 'UNK')
home_abbr = self.current_game.get('home_abbr', 'UNK')
self.logger.info(f"[SOCCER Upcoming] Showing {away_abbr} vs {home_abbr}")
# Ensure current_game is set # Ensure current_game is set
if not self.current_game and self.upcoming_games: if not self.current_game and self.upcoming_games:
self.current_game = self.upcoming_games[self.current_game_index] self.current_game = self.upcoming_games[self.current_game_index]