mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-10 13:02:59 +00:00
team switch logging (#73)
Works and doesn't seem to break anything else
This commit is contained in:
@@ -1015,7 +1015,15 @@ class SportsUpcoming(SportsCore):
|
||||
self.current_game = self.games_list[self.current_game_index]
|
||||
self.last_game_switch = current_time
|
||||
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:
|
||||
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.last_game_switch = current_time
|
||||
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:
|
||||
self._draw_scorebug_layout(self.current_game, force_clear)
|
||||
|
||||
@@ -918,6 +918,13 @@ class MLBLiveManager(BaseMLBManager, BaseballLive):
|
||||
self.current_game_index = (self.current_game_index + 1) % len(self.live_games)
|
||||
self.current_game = self.live_games[self.current_game_index]
|
||||
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
|
||||
# self.display(force_clear=True) # REMOVED: DisplayController handles this
|
||||
self.last_display_update = current_time
|
||||
@@ -1314,6 +1321,12 @@ class MLBRecentManager(BaseMLBManager, SportsRecent):
|
||||
self.last_game_switch = current_time
|
||||
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
|
||||
game_image = self._create_game_display(self.current_game)
|
||||
self.display_manager.image = game_image
|
||||
@@ -1455,6 +1468,12 @@ class MLBUpcomingManager(BaseMLBManager, SportsUpcoming):
|
||||
self.last_game_switch = current_time
|
||||
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
|
||||
game_image = self._create_game_display(self.current_game)
|
||||
self.display_manager.image = game_image
|
||||
|
||||
@@ -834,6 +834,12 @@ class NBARecentManager(BaseNBAManager):
|
||||
self.last_game_switch = current_time
|
||||
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
|
||||
self._draw_scorebug_layout(self.current_game, force_clear)
|
||||
|
||||
@@ -928,6 +934,12 @@ class NBAUpcomingManager(BaseNBAManager):
|
||||
self.last_game_switch = current_time
|
||||
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
|
||||
self._draw_scorebug_layout(self.current_game, force_clear)
|
||||
|
||||
|
||||
@@ -680,6 +680,13 @@ class NCAABaseballLiveManager(BaseNCAABaseballManager, BaseballLive):
|
||||
self.current_game_index = (self.current_game_index + 1) % len(self.live_games)
|
||||
self.current_game = self.live_games[self.current_game_index]
|
||||
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
|
||||
# self.display(force_clear=True) # REMOVED: DisplayController handles this
|
||||
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
|
||||
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:
|
||||
game_image = self._create_game_display(self.current_game)
|
||||
self.display_manager.image = game_image
|
||||
@@ -1087,6 +1100,12 @@ class NCAABaseballUpcomingManager(BaseNCAABaseballManager, SportsUpcoming):
|
||||
self.last_game_switch = current_time
|
||||
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:
|
||||
game_image = self._create_game_display(self.current_game)
|
||||
self.display_manager.image = game_image
|
||||
|
||||
@@ -779,6 +779,12 @@ class NCAAMBasketballLiveManager(BaseNCAAMBasketballManager):
|
||||
self.current_game = self.live_games[self.current_game_index]
|
||||
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
|
||||
if current_time - self.last_display_update >= 1.0:
|
||||
@@ -935,6 +941,12 @@ class NCAAMBasketballRecentManager(BaseNCAAMBasketballManager):
|
||||
self.last_game_switch = current_time
|
||||
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
|
||||
elif len(self.recent_games) == 1:
|
||||
self.current_game = self.recent_games[0]
|
||||
@@ -1078,6 +1090,12 @@ class NCAAMBasketballUpcomingManager(BaseNCAAMBasketballManager):
|
||||
self.last_game_switch = current_time
|
||||
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
|
||||
elif len(self.upcoming_games) == 1:
|
||||
self.current_game = self.upcoming_games[0]
|
||||
|
||||
@@ -676,13 +676,20 @@ class NHLLiveManager(BaseNHLManager):
|
||||
self.live_games = []
|
||||
self.current_game = None
|
||||
|
||||
# Check if it's time to switch games
|
||||
if len(self.live_games) > 1 and (current_time - self.last_game_switch) >= self.game_display_duration:
|
||||
self.current_game_index = (self.current_game_index + 1) % len(self.live_games)
|
||||
self.current_game = self.live_games[self.current_game_index]
|
||||
self.last_game_switch = current_time
|
||||
# self.display(force_clear=True) # REMOVED: DisplayController handles this
|
||||
self.last_display_update = current_time # Track time for potential display update
|
||||
# Check if it's time to switch games
|
||||
if len(self.live_games) > 1 and (current_time - self.last_game_switch) >= self.game_display_duration:
|
||||
self.current_game_index = (self.current_game_index + 1) % len(self.live_games)
|
||||
self.current_game = self.live_games[self.current_game_index]
|
||||
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.last_display_update = current_time # Track time for potential display update
|
||||
|
||||
def display(self, force_clear=False):
|
||||
"""Display live game information."""
|
||||
@@ -793,6 +800,12 @@ class NHLRecentManager(BaseNHLManager):
|
||||
self.last_game_switch = current_time
|
||||
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
|
||||
self._draw_scorebug_layout(self.current_game, force_clear)
|
||||
|
||||
@@ -926,6 +939,12 @@ class NHLUpcomingManager(BaseNHLManager):
|
||||
self.last_game_switch = current_time
|
||||
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
|
||||
self._draw_scorebug_layout(self.current_game, force_clear)
|
||||
|
||||
|
||||
@@ -1090,6 +1090,12 @@ class SoccerRecentManager(BaseSoccerManager):
|
||||
self.last_game_switch = current_time
|
||||
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)
|
||||
if not self.current_game and self.games_list:
|
||||
self.current_game = self.games_list[self.current_game_index]
|
||||
@@ -1229,6 +1235,12 @@ class SoccerUpcomingManager(BaseSoccerManager):
|
||||
self.last_game_switch = current_time
|
||||
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
|
||||
if not self.current_game and self.upcoming_games:
|
||||
self.current_game = self.upcoming_games[self.current_game_index]
|
||||
|
||||
Reference in New Issue
Block a user