add Of The Day display

This commit is contained in:
Chuck
2025-07-22 20:39:09 -05:00
parent 3ab28e8201
commit cb81bec042
7 changed files with 4432 additions and 1 deletions

View File

@@ -32,6 +32,7 @@ from src.youtube_display import YouTubeDisplay
from src.calendar_manager import CalendarManager
from src.text_display import TextDisplay
from src.music_manager import MusicManager
from src.of_the_day_manager import OfTheDayManager
# Get logger without configuring
logger = logging.getLogger(__name__)
@@ -59,8 +60,10 @@ class DisplayController:
self.calendar = CalendarManager(self.display_manager, self.config) if self.config.get('calendar', {}).get('enabled', False) else None
self.youtube = YouTubeDisplay(self.display_manager, self.config) if self.config.get('youtube', {}).get('enabled', False) else None
self.text_display = TextDisplay(self.display_manager, self.config) if self.config.get('text_display', {}).get('enabled', False) else None
self.of_the_day = OfTheDayManager(self.display_manager, self.config) if self.config.get('of_the_day', {}).get('enabled', False) else None
logger.info(f"Calendar Manager initialized: {'Object' if self.calendar else 'None'}")
logger.info(f"Text Display initialized: {'Object' if self.text_display else 'None'}")
logger.info(f"OfTheDay Manager initialized: {'Object' if self.of_the_day else 'None'}")
logger.info("Display modes initialized in %.3f seconds", time.time() - init_time)
# Initialize Music Manager
@@ -240,6 +243,7 @@ class DisplayController:
if self.calendar: self.available_modes.append('calendar')
if self.youtube: self.available_modes.append('youtube')
if self.text_display: self.available_modes.append('text_display')
if self.of_the_day: self.available_modes.append('of_the_day')
# Add Music display mode if enabled
if self.music_manager: # Will be non-None only if successfully initialized and enabled
@@ -469,6 +473,7 @@ class DisplayController:
if self.calendar: self.calendar.update(time.time())
if self.youtube: self.youtube.update()
if self.text_display: self.text_display.update()
if self.of_the_day: self.of_the_day.update(time.time())
# Update NHL managers
if self.nhl_live: self.nhl_live.update()
@@ -939,6 +944,8 @@ class DisplayController:
logger.debug(f"Timer expired for regular mode {self.current_display_mode}. Switching.")
if self.current_display_mode == 'calendar' and self.calendar:
self.calendar.advance_event()
elif self.current_display_mode == 'of_the_day' and self.of_the_day:
self.of_the_day.advance_item()
needs_switch = True
self.current_mode_index = (self.current_mode_index + 1) % len(self.available_modes)
new_mode_after_timer = self.available_modes[self.current_mode_index]
@@ -979,6 +986,8 @@ class DisplayController:
manager_to_display = self.youtube
elif self.current_display_mode == 'text_display' and self.text_display:
manager_to_display = self.text_display
elif self.current_display_mode == 'of_the_day' and self.of_the_day:
manager_to_display = self.of_the_day
# Add other regular managers (NHL recent/upcoming, NBA, MLB, Soccer, NFL, NCAA FB)
elif self.current_display_mode == 'nhl_recent' and self.nhl_recent:
manager_to_display = self.nhl_recent
@@ -1050,6 +1059,8 @@ class DisplayController:
manager_to_display.display(force_clear=self.force_clear)
elif self.current_display_mode == 'text_display':
manager_to_display.display() # Assumes internal clearing
elif self.current_display_mode == 'of_the_day':
manager_to_display.display(force_clear=self.force_clear)
elif self.current_display_mode == 'nfl_live' and self.nfl_live:
self.nfl_live.display(force_clear=self.force_clear)
elif self.current_display_mode == 'ncaa_fb_live' and self.ncaa_fb_live: