mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-11 13:23:00 +00:00
pull live games even if missing inning info
This commit is contained in:
@@ -716,7 +716,8 @@ class MiLBLiveManager(BaseMiLBManager):
|
|||||||
self.current_game_index = 0
|
self.current_game_index = 0
|
||||||
self.last_update = 0
|
self.last_update = 0
|
||||||
self.update_interval = self.milb_config.get('live_update_interval', 20)
|
self.update_interval = self.milb_config.get('live_update_interval', 20)
|
||||||
self.no_data_interval = self.update_interval
|
# Poll at least every 300s when no live games to detect new live starts sooner
|
||||||
|
self.no_data_interval = max(300, self.update_interval)
|
||||||
self.last_game_switch = 0 # Track when we last switched games
|
self.last_game_switch = 0 # Track when we last switched games
|
||||||
self.game_display_duration = self.milb_config.get('live_game_duration', 30) # Display each live game for 30 seconds
|
self.game_display_duration = self.milb_config.get('live_game_duration', 30) # Display each live game for 30 seconds
|
||||||
self.last_display_update = 0 # Track when we last updated the display
|
self.last_display_update = 0 # Track when we last updated the display
|
||||||
@@ -837,27 +838,26 @@ class MiLBLiveManager(BaseMiLBManager):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.logger.warning(f"[MiLB] Could not parse game date {game_date_str}: {e}")
|
self.logger.warning(f"[MiLB] Could not parse game date {game_date_str}: {e}")
|
||||||
|
|
||||||
# Additional check: Verify the game has actual live data (inning info)
|
# Respect favorites-only mode if explicitly enabled in config
|
||||||
if 'inning' not in game or game['inning'] is None:
|
favorites_only = self.milb_config.get('show_favorite_teams_only', False)
|
||||||
self.logger.warning(f"[MiLB] Skipping game without inning data: {game['away_team']} @ {game['home_team']}")
|
if favorites_only and self.favorite_teams:
|
||||||
continue
|
is_favorite = (
|
||||||
|
game['home_team'] in self.favorite_teams or
|
||||||
self.logger.debug(f"[MiLB] Found live game: {game['away_team']} @ {game['home_team']}")
|
game['away_team'] in self.favorite_teams
|
||||||
if not self.favorite_teams or (
|
)
|
||||||
game['home_team'] in self.favorite_teams or
|
if not is_favorite:
|
||||||
game['away_team'] in self.favorite_teams
|
self.logger.debug(f"[MiLB] Skipping non-favorite game in favorites-only mode: {game['away_team']} @ {game['home_team']}")
|
||||||
):
|
continue
|
||||||
self.logger.info(f"[MiLB] Processing favorite team game: {game['away_team']} @ {game['home_team']} - Inning: {game.get('inning', 'N/A')}, Half: {game.get('inning_half', 'N/A')}, Count: {game.get('balls', 0)}-{game.get('strikes', 0)}, Outs: {game.get('outs', 0)}, Scores: {game.get('away_score', 0)}-{game.get('home_score', 0)}")
|
|
||||||
# Ensure scores are valid numbers
|
self.logger.info(f"[MiLB] Processing live game: {game['away_team']} @ {game['home_team']} - Inning: {game.get('inning', 'N/A')}, Half: {game.get('inning_half', 'N/A')}, Count: {game.get('balls', 0)}-{game.get('strikes', 0)}, Outs: {game.get('outs', 0)}, Scores: {game.get('away_score', 0)}-{game.get('home_score', 0)}")
|
||||||
try:
|
# Ensure scores are valid numbers
|
||||||
game['home_score'] = int(game['home_score'])
|
try:
|
||||||
game['away_score'] = int(game['away_score'])
|
game['home_score'] = int(game['home_score'])
|
||||||
new_live_games.append(game)
|
game['away_score'] = int(game['away_score'])
|
||||||
self.logger.debug(f"[MiLB] Added live game to list: {game['away_team']} @ {game['home_team']}")
|
new_live_games.append(game)
|
||||||
except (ValueError, TypeError):
|
self.logger.debug(f"[MiLB] Added live game to list: {game['away_team']} @ {game['home_team']}")
|
||||||
self.logger.warning(f"Invalid score format for game {game['away_team']} @ {game['home_team']}")
|
except (ValueError, TypeError):
|
||||||
else:
|
self.logger.warning(f"Invalid score format for game {game['away_team']} @ {game['home_team']}")
|
||||||
self.logger.debug(f"[MiLB] Skipping non-favorite team game: {game['away_team']} @ {game['home_team']}")
|
|
||||||
|
|
||||||
# Only log if there's a change in games or enough time has passed
|
# Only log if there's a change in games or enough time has passed
|
||||||
should_log = (
|
should_log = (
|
||||||
|
|||||||
Reference in New Issue
Block a user