mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-10 21:03:01 +00:00
* Fix leaderboard scrolling performance after PR #39 merge - Restore leaderboard background updates that were accidentally removed - Fix duration method call from get_dynamic_duration() back to get_duration() - Restore proper fallback duration (600s instead of 60s) for leaderboard - Add back sports manager updates that feed data to leaderboard - Fix leaderboard defer_update priority to prevent scrolling lag These changes restore the leaderboard's dynamic duration calculation and ensure it gets proper background updates for smooth scrolling. * Apply PR #60 leaderboard performance optimizations - Change scroll_delay from 0.05s to 0.01s (100fps instead of 20fps) - Remove conditional scrolling logic - scroll every frame for smooth animation - Add FPS tracking and logging for performance monitoring - Restore high-framerate scrolling that was working before PR #39 merge These changes restore the smooth leaderboard scrolling performance that was achieved in PR #60 but was lost during the PR #39 merge. * Fix critical bugs identified in PR #39 review - Fix record filtering logic bug: change away_record == set to away_record in set - Fix incorrect sport specification: change 'nfl' to 'ncaa_fb' for NCAA Football data requests - These bugs were causing incorrect data display and wrong sport data fetching Addresses issues found by cursor bot in PR #39 review: - Record filtering was always evaluating to False - NCAA Football was fetching NFL data instead of college football data * Enhance cache clearing implementation from PR #39 - Add detailed logging to cache clearing process for better visibility - Log cache clearing statistics (memory entries and file count) - Improve startup logging to show cache clearing and data refetch process - Addresses legoguy1000's comment about preventing stale data issues This enhances the cache clearing implementation that was added in PR #39 to help prevent legacy cache issues and stale data problems. * continuing on base_classes - added baseball and api extractor since we don't use ESPN api for all sports * tests * fix missing duration * ensure milb, mlb, ncaa bb are all using new baseball base class properly * cursor rule to help with PR creation * fix image call * fix _scoreboard suffix on milb, MLB
This commit is contained in:
@@ -14,6 +14,10 @@ import pytz
|
||||
from src.odds_manager import OddsManager
|
||||
from src.background_data_service import get_background_service
|
||||
|
||||
# Import baseball and standard sports classes
|
||||
from .base_classes.baseball import Baseball, BaseballLive
|
||||
from .base_classes.sports import SportsRecent, SportsUpcoming
|
||||
|
||||
# Import the API counter function from web interface
|
||||
try:
|
||||
from web_interface_v2 import increment_api_counter
|
||||
@@ -25,20 +29,21 @@ except ImportError:
|
||||
# Get logger
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class BaseMLBManager:
|
||||
"""Base class for MLB managers with common functionality."""
|
||||
class BaseMLBManager(Baseball):
|
||||
"""Base class for MLB managers using new baseball architecture."""
|
||||
def __init__(self, config: Dict[str, Any], display_manager, cache_manager: CacheManager):
|
||||
self.config = config
|
||||
self.display_manager = display_manager
|
||||
# Store reference to config instead of creating new ConfigManager
|
||||
self.config_manager = None # Not used in this class
|
||||
self.mlb_config = config.get('mlb', {})
|
||||
# Initialize with sport_key for MLB
|
||||
super().__init__(config, display_manager, cache_manager, logger, "mlb")
|
||||
|
||||
# MLB-specific configuration
|
||||
self.mlb_config = config.get('mlb_scoreboard', {})
|
||||
self.show_odds = self.mlb_config.get("show_odds", False)
|
||||
self.favorite_teams = self.mlb_config.get('favorite_teams', [])
|
||||
self.show_records = self.mlb_config.get('show_records', False)
|
||||
self.cache_manager = cache_manager
|
||||
|
||||
# Store reference to config instead of creating new ConfigManager
|
||||
self.config_manager = None # Not used in this class
|
||||
self.odds_manager = OddsManager(self.cache_manager, self.config_manager)
|
||||
self.logger = logging.getLogger(__name__)
|
||||
|
||||
# Logo handling
|
||||
self.logo_dir = self.mlb_config.get('logo_dir', os.path.join('assets', 'sports', 'mlb_logos'))
|
||||
@@ -744,7 +749,7 @@ class BaseMLBManager:
|
||||
|
||||
self._draw_text_with_outline(draw, ou_text, (ou_x, ou_y), font, fill=(0, 255, 0))
|
||||
|
||||
class MLBLiveManager(BaseMLBManager):
|
||||
class MLBLiveManager(BaseMLBManager, BaseballLive):
|
||||
"""Manager for displaying live MLB games."""
|
||||
def __init__(self, config: Dict[str, Any], display_manager, cache_manager: CacheManager):
|
||||
super().__init__(config, display_manager, cache_manager)
|
||||
@@ -1157,7 +1162,7 @@ class MLBLiveManager(BaseMLBManager):
|
||||
except Exception as e:
|
||||
logger.error(f"[MLB] Error displaying live game: {e}", exc_info=True)
|
||||
|
||||
class MLBRecentManager(BaseMLBManager):
|
||||
class MLBRecentManager(BaseMLBManager, SportsRecent):
|
||||
"""Manager for displaying recent MLB games."""
|
||||
def __init__(self, config: Dict[str, Any], display_manager, cache_manager: CacheManager):
|
||||
super().__init__(config, display_manager, cache_manager)
|
||||
@@ -1318,7 +1323,7 @@ class MLBRecentManager(BaseMLBManager):
|
||||
except Exception as e:
|
||||
logger.error(f"[MLB] Error displaying recent game: {e}", exc_info=True)
|
||||
|
||||
class MLBUpcomingManager(BaseMLBManager):
|
||||
class MLBUpcomingManager(BaseMLBManager, SportsUpcoming):
|
||||
"""Manager for displaying upcoming MLB games."""
|
||||
def __init__(self, config: Dict[str, Any], display_manager, cache_manager: CacheManager):
|
||||
super().__init__(config, display_manager, cache_manager)
|
||||
|
||||
Reference in New Issue
Block a user