mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-10 13:02:59 +00:00
fix favorite team toggle logic being skipped
This commit is contained in:
Submodule LEDMatrix.wiki updated: 8d2c143954...a01c72e156
@@ -1144,7 +1144,7 @@ class MiLBUpcomingManager(BaseMiLBManager):
|
||||
return
|
||||
|
||||
# --- Optimization: Filter for favorite teams before processing ---
|
||||
if self.milb_config.get("show_favorite_teams_only", False) and self.favorite_teams:
|
||||
if self.milb_config.get("show_favorite_teams_only", False):
|
||||
games = {
|
||||
game_id: game for game_id, game in games.items()
|
||||
if game['home_team'] in self.favorite_teams or game['away_team'] in self.favorite_teams
|
||||
|
||||
@@ -802,7 +802,7 @@ class MLBLiveManager(BaseMLBManager):
|
||||
if games:
|
||||
|
||||
# --- Optimization: Filter for favorite teams before processing ---
|
||||
if self.mlb_config.get("show_favorite_teams_only", False) and self.favorite_teams:
|
||||
if self.mlb_config.get("show_favorite_teams_only", False):
|
||||
games = {
|
||||
game_id: game for game_id, game in games.items()
|
||||
if game['home_team'] in self.favorite_teams or game['away_team'] in self.favorite_teams
|
||||
@@ -1163,7 +1163,7 @@ class MLBRecentManager(BaseMLBManager):
|
||||
return
|
||||
|
||||
# --- Optimization: Filter for favorite teams before processing ---
|
||||
if self.mlb_config.get("show_favorite_teams_only", False) and self.favorite_teams:
|
||||
if self.mlb_config.get("show_favorite_teams_only", False):
|
||||
games = {
|
||||
game_id: game for game_id, game in games.items()
|
||||
if game['home_team'] in self.favorite_teams or game['away_team'] in self.favorite_teams
|
||||
@@ -1307,7 +1307,7 @@ class MLBUpcomingManager(BaseMLBManager):
|
||||
return
|
||||
|
||||
# --- Optimization: Filter for favorite teams before processing ---
|
||||
if self.mlb_config.get("show_favorite_teams_only", False) and self.favorite_teams:
|
||||
if self.mlb_config.get("show_favorite_teams_only", False):
|
||||
games = {
|
||||
game_id: game for game_id, game in games.items()
|
||||
if game['home_team'] in self.favorite_teams or game['away_team'] in self.favorite_teams
|
||||
|
||||
@@ -702,7 +702,7 @@ class NBALiveManager(BaseNBAManager):
|
||||
new_live_games.append(details)
|
||||
|
||||
# Filter for favorite teams only if the config is set
|
||||
if self.nba_config.get("show_favorite_teams_only", False) and self.favorite_teams:
|
||||
if self.nba_config.get("show_favorite_teams_only", False):
|
||||
new_live_games = [game for game in new_live_games
|
||||
if game['home_abbr'] in self.favorite_teams or
|
||||
game['away_abbr'] in self.favorite_teams]
|
||||
@@ -760,7 +760,7 @@ class NBARecentManager(BaseNBAManager):
|
||||
new_recent_games.append(game)
|
||||
|
||||
# Filter for favorite teams only if the config is set
|
||||
if self.nba_config.get("show_favorite_teams_only", False) and self.favorite_teams:
|
||||
if self.nba_config.get("show_favorite_teams_only", False):
|
||||
team_games = [game for game in new_recent_games
|
||||
if game['home_abbr'] in self.favorite_teams or
|
||||
game['away_abbr'] in self.favorite_teams]
|
||||
@@ -837,7 +837,7 @@ class NBAUpcomingManager(BaseNBAManager):
|
||||
new_upcoming_games.append(game)
|
||||
|
||||
# Filter for favorite teams only if the config is set
|
||||
if self.nba_config.get("show_favorite_teams_only", False) and self.favorite_teams:
|
||||
if self.nba_config.get("show_favorite_teams_only", False):
|
||||
team_games = [game for game in new_upcoming_games
|
||||
if game['home_abbr'] in self.favorite_teams or
|
||||
game['away_abbr'] in self.favorite_teams]
|
||||
|
||||
@@ -615,7 +615,7 @@ class NCAABaseballLiveManager(BaseNCAABaseballManager):
|
||||
for game in games.values():
|
||||
if game['status_state'] == 'in':
|
||||
# Filter for favorite teams only if the config is set
|
||||
if self.ncaa_baseball_config.get("show_favorite_teams_only", False) and self.favorite_teams:
|
||||
if self.ncaa_baseball_config.get("show_favorite_teams_only", False):
|
||||
if not (game['home_team'] in self.favorite_teams or game['away_team'] in self.favorite_teams):
|
||||
continue
|
||||
|
||||
@@ -635,12 +635,12 @@ class NCAABaseballLiveManager(BaseNCAABaseballManager):
|
||||
|
||||
if should_log:
|
||||
if new_live_games:
|
||||
filter_text = "favorite teams" if self.ncaa_baseball_config.get("show_favorite_teams_only", False) and self.favorite_teams else "all teams"
|
||||
filter_text = "favorite teams" if self.ncaa_baseball_config.get("show_favorite_teams_only", False) else "all teams"
|
||||
logger.info(f"[NCAABaseball] Found {len(new_live_games)} live games involving {filter_text}")
|
||||
for game in new_live_games:
|
||||
logger.info(f"[NCAABaseball] Live game: {game['away_team']} vs {game['home_team']} - {game['inning_half']}{game['inning']}, {game['balls']}-{game['strikes']}")
|
||||
else:
|
||||
filter_text = "favorite teams" if self.ncaa_baseball_config.get("show_favorite_teams_only", False) and self.favorite_teams else "criteria"
|
||||
filter_text = "favorite teams" if self.ncaa_baseball_config.get("show_favorite_teams_only", False) else "criteria"
|
||||
logger.info(f"[NCAABaseball] No live games found matching {filter_text}")
|
||||
self.last_log_time = current_time
|
||||
|
||||
|
||||
@@ -674,7 +674,7 @@ class NCAAMBasketballLiveManager(BaseNCAAMBasketballManager):
|
||||
details = self._extract_game_details(event)
|
||||
if details and details["is_live"]: # is_live includes 'in' and 'halftime'
|
||||
# Filter for favorite teams only if the config is set
|
||||
if self.ncaam_basketball_config.get("show_favorite_teams_only", False) and self.favorite_teams:
|
||||
if self.ncaam_basketball_config.get("show_favorite_teams_only", False):
|
||||
if not (details["home_abbr"] in self.favorite_teams or details["away_abbr"] in self.favorite_teams):
|
||||
continue
|
||||
|
||||
@@ -699,7 +699,7 @@ class NCAAMBasketballLiveManager(BaseNCAAMBasketballManager):
|
||||
|
||||
if should_log:
|
||||
if new_live_games:
|
||||
filter_text = "favorite teams" if self.ncaam_basketball_config.get("show_favorite_teams_only", False) and self.favorite_teams else "all teams"
|
||||
filter_text = "favorite teams" if self.ncaam_basketball_config.get("show_favorite_teams_only", False) else "all teams"
|
||||
self.logger.info(f"[NCAAMBasketball] Found {len(new_live_games)} live games involving {filter_text}")
|
||||
for game in new_live_games:
|
||||
period = game.get('period', 0)
|
||||
@@ -719,7 +719,7 @@ class NCAAMBasketballLiveManager(BaseNCAAMBasketballManager):
|
||||
if has_favorite_team:
|
||||
self.logger.info("[NCAAMBasketball] Found live game(s) for favorite team(s)")
|
||||
else:
|
||||
filter_text = "favorite teams" if self.ncaam_basketball_config.get("show_favorite_teams_only", False) and self.favorite_teams else "criteria"
|
||||
filter_text = "favorite teams" if self.ncaam_basketball_config.get("show_favorite_teams_only", False) else "criteria"
|
||||
self.logger.info(f"[NCAAMBasketball] No live games found matching {filter_text}")
|
||||
self.last_log_time = current_time
|
||||
|
||||
|
||||
@@ -565,7 +565,7 @@ class NFLLiveManager(BaseNFLManager): # Renamed class
|
||||
events = data["events"]
|
||||
|
||||
# --- Optimization: Filter for favorite teams before extracting details/odds ---
|
||||
if self.nfl_config.get("show_favorite_teams_only", False) and self.favorite_teams:
|
||||
if self.nfl_config.get("show_favorite_teams_only", False):
|
||||
filtered_events = []
|
||||
for event in events:
|
||||
try:
|
||||
@@ -828,7 +828,7 @@ class NFLRecentManager(BaseNFLManager): # Renamed class
|
||||
events = data['events']
|
||||
|
||||
# --- Optimization: Filter for favorite teams before extracting details/odds ---
|
||||
if self.nfl_config.get("show_favorite_teams_only", False) and self.favorite_teams:
|
||||
if self.nfl_config.get("show_favorite_teams_only", False):
|
||||
filtered_events = []
|
||||
for event in events:
|
||||
try:
|
||||
@@ -1048,7 +1048,7 @@ class NFLUpcomingManager(BaseNFLManager): # Renamed class
|
||||
events = data['events']
|
||||
|
||||
# --- Optimization: Filter for favorite teams before extracting details/odds ---
|
||||
if self.nfl_config.get("show_favorite_teams_only", False) and self.favorite_teams:
|
||||
if self.nfl_config.get("show_favorite_teams_only", False):
|
||||
filtered_events = []
|
||||
for event in events:
|
||||
try:
|
||||
|
||||
@@ -592,7 +592,7 @@ class NHLLiveManager(BaseNHLManager):
|
||||
new_live_games.append(details)
|
||||
|
||||
# Filter for favorite teams only if the config is set
|
||||
if self.nhl_config.get("show_favorite_teams_only", False) and self.favorite_teams:
|
||||
if self.nhl_config.get("show_favorite_teams_only", False):
|
||||
new_live_games = [game for game in new_live_games
|
||||
if game['home_abbr'] in self.favorite_teams or
|
||||
game['away_abbr'] in self.favorite_teams]
|
||||
@@ -606,12 +606,12 @@ class NHLLiveManager(BaseNHLManager):
|
||||
|
||||
if should_log:
|
||||
if new_live_games:
|
||||
filter_text = "favorite teams" if self.nhl_config.get("show_favorite_teams_only", False) and self.favorite_teams else "all teams"
|
||||
filter_text = "favorite teams" if self.nhl_config.get("show_favorite_teams_only", False) else "all teams"
|
||||
self.logger.info(f"[NHL] Found {len(new_live_games)} live games involving {filter_text}")
|
||||
for game in new_live_games:
|
||||
self.logger.info(f"[NHL] Live game: {game['away_abbr']} vs {game['home_abbr']} - Period {game['period']}, {game['clock']}")
|
||||
else:
|
||||
filter_text = "favorite teams" if self.nhl_config.get("show_favorite_teams_only", False) and self.favorite_teams else "criteria"
|
||||
filter_text = "favorite teams" if self.nhl_config.get("show_favorite_teams_only", False) else "criteria"
|
||||
self.logger.info(f"[NHL] No live games found matching {filter_text}")
|
||||
self.last_log_time = current_time
|
||||
|
||||
@@ -701,7 +701,7 @@ class NHLRecentManager(BaseNHLManager):
|
||||
processed_games.append(game)
|
||||
|
||||
# Filter for favorite teams only if the config is set
|
||||
if self.nhl_config.get("show_favorite_teams_only", False) and self.favorite_teams:
|
||||
if self.nhl_config.get("show_favorite_teams_only", False):
|
||||
team_games = [game for game in processed_games
|
||||
if game['home_abbr'] in self.favorite_teams or
|
||||
game['away_abbr'] in self.favorite_teams]
|
||||
@@ -806,7 +806,7 @@ class NHLUpcomingManager(BaseNHLManager):
|
||||
new_upcoming_games.append(game)
|
||||
|
||||
# Filter for favorite teams only if the config is set
|
||||
if self.nhl_config.get("show_favorite_teams_only", False) and self.favorite_teams:
|
||||
if self.nhl_config.get("show_favorite_teams_only", False):
|
||||
team_games = [game for game in new_upcoming_games
|
||||
if game['home_abbr'] in self.favorite_teams or
|
||||
game['away_abbr'] in self.favorite_teams]
|
||||
|
||||
@@ -825,7 +825,7 @@ class SoccerLiveManager(BaseSoccerManager):
|
||||
new_live_games.append(details)
|
||||
|
||||
# Filter for favorite teams only if the config is set
|
||||
if self.soccer_config.get("show_favorite_teams_only", False) and self.favorite_teams:
|
||||
if self.soccer_config.get("show_favorite_teams_only", False):
|
||||
new_live_games = [game for game in new_live_games if game['home_abbr'] in self.favorite_teams or game['away_abbr'] in self.favorite_teams]
|
||||
|
||||
# Logging
|
||||
@@ -834,7 +834,7 @@ class SoccerLiveManager(BaseSoccerManager):
|
||||
not self.live_games)
|
||||
if should_log:
|
||||
if new_live_games:
|
||||
filter_text = "favorite teams" if self.soccer_config.get("show_favorite_teams_only", False) and self.favorite_teams else "all teams"
|
||||
filter_text = "favorite teams" if self.soccer_config.get("show_favorite_teams_only", False) else "all teams"
|
||||
self.logger.info(f"[Soccer] Found {len(new_live_games)} live games involving {filter_text}.")
|
||||
for game in new_live_games:
|
||||
self.logger.info(f"[Soccer] Live game: {game['away_abbr']} vs {game['home_abbr']} ({game['game_clock_display']}) - {game['league']}")
|
||||
@@ -891,7 +891,7 @@ class SoccerLiveManager(BaseSoccerManager):
|
||||
else:
|
||||
# No live games found
|
||||
if self.live_games: # Log only if previously had games
|
||||
filter_text = "favorite teams" if self.soccer_config.get("show_favorite_teams_only", False) and self.favorite_teams else "criteria"
|
||||
filter_text = "favorite teams" if self.soccer_config.get("show_favorite_teams_only", False) else "criteria"
|
||||
self.logger.info(f"[Soccer] All live games have ended or no longer match {filter_text}.")
|
||||
self.live_games = []
|
||||
self.current_game = None
|
||||
@@ -957,7 +957,7 @@ class SoccerRecentManager(BaseSoccerManager):
|
||||
new_recent_games.append(game)
|
||||
|
||||
# Filter for favorite teams only if the config is set
|
||||
if self.soccer_config.get("show_favorite_teams_only", False) and self.favorite_teams:
|
||||
if self.soccer_config.get("show_favorite_teams_only", False):
|
||||
team_games = [game for game in new_recent_games if game['home_abbr'] in self.favorite_teams or game['away_abbr'] in self.favorite_teams]
|
||||
else:
|
||||
team_games = new_recent_games
|
||||
@@ -1064,7 +1064,7 @@ class SoccerUpcomingManager(BaseSoccerManager):
|
||||
new_upcoming_games.append(game)
|
||||
|
||||
# Filter for favorite teams only if the config is set
|
||||
if self.soccer_config.get("show_favorite_teams_only", False) and self.favorite_teams:
|
||||
if self.soccer_config.get("show_favorite_teams_only", False):
|
||||
team_games = [game for game in new_upcoming_games if game['home_abbr'] in self.favorite_teams or game['away_abbr'] in self.favorite_teams]
|
||||
else:
|
||||
team_games = new_upcoming_games
|
||||
|
||||
Reference in New Issue
Block a user