diff --git a/config/config.json b/config/config.json index 0ded2037..6e4d81fe 100644 --- a/config/config.json +++ b/config/config.json @@ -223,7 +223,7 @@ } }, "ncaa_fb_scoreboard": { - "enabled": true, + "enabled": false, "live_priority": true, "live_game_duration": 20, "show_odds": true, @@ -368,7 +368,7 @@ "scroll_gap_width": 32 }, "soccer_scoreboard": { - "enabled": false, + "enabled": true, "live_priority": true, "live_game_duration": 20, "show_odds": true, @@ -380,15 +380,9 @@ "recent_game_hours": 168, "show_favorite_teams_only": true, "favorite_teams": [ - "LIV" + "DAL" ], "leagues": [ - "eng.1", - "esp.1", - "ger.1", - "ita.1", - "fra.1", - "uefa.champions", "usa.1" ], "logo_dir": "assets/sports/soccer_logos", diff --git a/src/display_controller.py b/src/display_controller.py index 42db8419..6a8cbd19 100644 --- a/src/display_controller.py +++ b/src/display_controller.py @@ -868,10 +868,17 @@ class DisplayController: manager = getattr(self, attr, None) # Only consider sports that are enabled (manager is not None) and have actual live games live_games = getattr(manager, 'live_games', None) if manager is not None else None - if manager is not None and priority and live_games and len(live_games) > 0: + # Check that manager exists, has live_priority enabled, has live_games attribute, and has at least one live game + if (manager is not None and + priority and + live_games is not None and + len(live_games) > 0): live_priority_takeover = True live_priority_sport = sport + logger.debug(f"Live priority takeover triggered by {sport} with {len(live_games)} live games") break + elif manager is not None and priority and live_games is not None: + logger.debug(f"{sport} has live_priority=True but {len(live_games)} live games (not taking over)") manager_to_display = None # --- State Machine for Display Logic --- if is_currently_live: @@ -902,16 +909,23 @@ class DisplayController: if live_priority_takeover: new_mode = f"{live_priority_sport}_live" if self.current_display_mode != new_mode: - logger.info(f"Live priority takeover: Switching to {new_mode} from {self.current_display_mode}") - if previous_mode_before_switch == 'music' and self.music_manager: - self.music_manager.deactivate_music_display() - self.current_display_mode = new_mode - # Reset logged duration when mode changes - if hasattr(self, '_last_logged_duration'): - delattr(self, '_last_logged_duration') - self.force_clear = True - self.last_switch = current_time - manager_to_display = getattr(self, f"{live_priority_sport}_live", None) + # Double-check that the manager actually has live games before switching + target_manager = getattr(self, f"{live_priority_sport}_live", None) + if target_manager and hasattr(target_manager, 'live_games') and len(target_manager.live_games) > 0: + logger.info(f"Live priority takeover: Switching to {new_mode} from {self.current_display_mode}") + logger.debug(f"[DisplayController] Live priority takeover details: sport={live_priority_sport}, manager={target_manager}, live_games={target_manager.live_games}") + if previous_mode_before_switch == 'music' and self.music_manager: + self.music_manager.deactivate_music_display() + self.current_display_mode = new_mode + # Reset logged duration when mode changes + if hasattr(self, '_last_logged_duration'): + delattr(self, '_last_logged_duration') + self.force_clear = True + self.last_switch = current_time + manager_to_display = target_manager + else: + logger.warning(f"[DisplayController] Live priority takeover attempted for {new_mode} but manager has no live games, skipping takeover") + live_priority_takeover = False else: self.force_clear = False self.last_switch = current_time @@ -1086,8 +1100,11 @@ class DisplayController: self.ncaa_baseball_live.display(force_clear=self.force_clear) elif self.current_display_mode == 'mlb_live' and self.mlb_live: self.mlb_live.display(force_clear=self.force_clear) - elif self.current_display_mode == 'milb_live' and self.milb_live: + elif self.current_display_mode == 'milb_live' and self.milb_live and len(self.milb_live.live_games) > 0: + logger.debug(f"[DisplayController] Calling MiLB live display with {len(self.milb_live.live_games)} live games") self.milb_live.display(force_clear=self.force_clear) + elif self.current_display_mode == 'milb_live' and self.milb_live: + logger.debug(f"[DisplayController] MiLB live manager exists but has {len(self.milb_live.live_games)} live games, skipping display") elif self.current_display_mode == 'ncaa_fb_upcoming' and self.ncaa_fb_upcoming: self.ncaa_fb_upcoming.display(force_clear=self.force_clear) elif self.current_display_mode == 'ncaam_basketball_recent' and self.ncaam_basketball_recent: diff --git a/src/milb_manager.py b/src/milb_manager.py index c0ff093a..3f974062 100644 --- a/src/milb_manager.py +++ b/src/milb_manager.py @@ -772,6 +772,9 @@ class MiLBLiveManager(BaseMiLBManager): logger.info("[MiLB] No live games found") self.last_log_time = current_time + # Debug: Log the live_games state for display controller + logger.debug(f"[MiLB] Live games state: {len(new_live_games)} games, live_games list will be: {len(new_live_games) if new_live_games else 0}") + if new_live_games: # Update the current game with the latest data for new_game in new_live_games: @@ -787,6 +790,7 @@ class MiLBLiveManager(BaseMiLBManager): # Only update the games list if we have new games if not self.live_games or set(game['away_team'] + game['home_team'] for game in new_live_games) != set(game['away_team'] + game['home_team'] for game in self.live_games): self.live_games = new_live_games + logger.debug(f"[MiLB] Updated live_games list to {len(self.live_games)} games") # If we don't have a current game or it's not in the new list, start from the beginning if not self.current_game or self.current_game not in self.live_games: self.current_game_index = 0 @@ -802,6 +806,7 @@ class MiLBLiveManager(BaseMiLBManager): self.logger.debug("[MiLB] No live games found in API response") self.live_games = [] self.current_game = None + logger.debug(f"[MiLB] Set live_games to empty list, length: {len(self.live_games)}") # 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: @@ -1039,9 +1044,11 @@ class MiLBLiveManager(BaseMiLBManager): def display(self, force_clear: bool = False): """Display live game information.""" if not self.current_game: + logger.debug("[MiLB] Display called but no current game, returning early") return try: + logger.debug(f"[MiLB] Displaying live game: {self.current_game.get('away_team')} @ {self.current_game.get('home_team')}") # Create and display the game image using the new method game_image = self._create_live_game_display(self.current_game) # Set the image in the display manager