mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-11 21:33:00 +00:00
fixed linter errors in NFL and NCAA FB
This commit is contained in:
@@ -452,6 +452,11 @@ class NCAAFBLiveManager(BaseNCAAFBManager): # Renamed class
|
|||||||
else:
|
else:
|
||||||
logging.info("[NCAAFB] Initialized NCAAFBLiveManager in live mode") # Updated log message
|
logging.info("[NCAAFB] Initialized NCAAFBLiveManager in live mode") # Updated log message
|
||||||
|
|
||||||
|
def update(self):
|
||||||
|
"""Update live game data and handle game switching."""
|
||||||
|
if not self.is_enabled:
|
||||||
|
return
|
||||||
|
|
||||||
# Define current_time and interval before the problematic line (originally line 455)
|
# Define current_time and interval before the problematic line (originally line 455)
|
||||||
# Ensure 'import time' is present at the top of the file.
|
# Ensure 'import time' is present at the top of the file.
|
||||||
current_time = time.time()
|
current_time = time.time()
|
||||||
@@ -521,8 +526,9 @@ class NCAAFBLiveManager(BaseNCAAFBManager): # Renamed class
|
|||||||
new_live_games.append(details)
|
new_live_games.append(details)
|
||||||
|
|
||||||
# Log changes or periodically
|
# Log changes or periodically
|
||||||
|
current_time_for_log = time.time() # Use a consistent time for logging comparison
|
||||||
should_log = (
|
should_log = (
|
||||||
current_time - self.last_log_time >= self.log_interval or
|
current_time_for_log - self.last_log_time >= self.log_interval or
|
||||||
len(new_live_games) != len(self.live_games) or
|
len(new_live_games) != len(self.live_games) or
|
||||||
any(g1['id'] != g2.get('id') for g1, g2 in zip(self.live_games, new_live_games)) or # Check if game IDs changed
|
any(g1['id'] != g2.get('id') for g1, g2 in zip(self.live_games, new_live_games)) or # Check if game IDs changed
|
||||||
(not self.live_games and new_live_games) # Log if games appeared
|
(not self.live_games and new_live_games) # Log if games appeared
|
||||||
@@ -531,11 +537,11 @@ class NCAAFBLiveManager(BaseNCAAFBManager): # Renamed class
|
|||||||
if should_log:
|
if should_log:
|
||||||
if new_live_games:
|
if new_live_games:
|
||||||
self.logger.info(f"[NCAAFB] Found {len(new_live_games)} live/halftime games for fav teams.") # Changed log prefix
|
self.logger.info(f"[NCAAFB] Found {len(new_live_games)} live/halftime games for fav teams.") # Changed log prefix
|
||||||
for game in new_live_games:
|
for game_info in new_live_games: # Renamed game to game_info
|
||||||
self.logger.info(f" - {game['away_abbr']}@{game['home_abbr']} ({game.get('status_text', 'N/A')})")
|
self.logger.info(f" - {game_info['away_abbr']}@{game_info['home_abbr']} ({game_info.get('status_text', 'N/A')})")
|
||||||
else:
|
else:
|
||||||
self.logger.info("[NCAAFB] No live/halftime games found for favorite teams.") # Changed log prefix
|
self.logger.info("[NCAAFB] No live/halftime games found for favorite teams.") # Changed log prefix
|
||||||
self.last_log_time = current_time
|
self.last_log_time = current_time_for_log
|
||||||
|
|
||||||
|
|
||||||
# Update game list and current game
|
# Update game list and current game
|
||||||
@@ -1045,4 +1051,4 @@ class NCAAFBUpcomingManager(BaseNCAAFBManager): # Renamed class
|
|||||||
# update_display() is called within _draw_scorebug_layout for upcoming
|
# update_display() is called within _draw_scorebug_layout for upcoming
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.logger.error(f"[NCAAFB Upcoming] Error in display loop: {e}", exc_info=True) # Changed log prefix
|
self.logger.error(f"[NCAAFB Upcoming] Error in display loop: {e}", exc_info=True) # Changed log prefix
|
||||||
@@ -712,7 +712,7 @@ class NFLRecentManager(BaseNFLManager): # Renamed class
|
|||||||
for event in events:
|
for event in events:
|
||||||
game = self._extract_game_details(event)
|
game = self._extract_game_details(event)
|
||||||
# Filter criteria: must be final, within time window
|
# Filter criteria: must be final, within time window
|
||||||
if game and game['is_final'] and game['is_within_window']:
|
if game and game['is_final'] and game.get('is_within_window', True): # Assume within window if key missing
|
||||||
processed_games.append(game)
|
processed_games.append(game)
|
||||||
|
|
||||||
# Filter for favorite teams
|
# Filter for favorite teams
|
||||||
@@ -884,7 +884,7 @@ class NFLUpcomingManager(BaseNFLManager): # Renamed class
|
|||||||
for event in events:
|
for event in events:
|
||||||
game = self._extract_game_details(event)
|
game = self._extract_game_details(event)
|
||||||
# Filter criteria: must be upcoming ('pre' state) and within time window
|
# Filter criteria: must be upcoming ('pre' state) and within time window
|
||||||
if game and game['is_upcoming'] and game['is_within_window']:
|
if game and game['is_upcoming'] and game.get('is_within_window', True): # Assume within window if key missing
|
||||||
processed_games.append(game)
|
processed_games.append(game)
|
||||||
|
|
||||||
# Filter for favorite teams
|
# Filter for favorite teams
|
||||||
|
|||||||
Reference in New Issue
Block a user