mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-27 19:13:01 +00:00
Remove test data from NHLRecentManager and NHLUpcomingManager to ensure real data usage
This commit is contained in:
@@ -56,7 +56,7 @@ class BaseNHLManager:
|
||||
try:
|
||||
# Try to load the 4x6 font for scores
|
||||
fonts['score'] = ImageFont.truetype("assets/fonts/4x6-font.ttf", 12)
|
||||
fonts['time'] = ImageFont.truetype("assets/fonts/4x6-font.ttf", 10)
|
||||
fonts['time'] = ImageFont.truetype("assets/fonts/4x6-font.ttf", 8)
|
||||
fonts['team'] = ImageFont.truetype("assets/fonts/4x6-font.ttf", 8)
|
||||
fonts['status'] = ImageFont.truetype("assets/fonts/4x6-font.ttf", 9)
|
||||
logging.info("[NHL] Successfully loaded 4x6 font for all text elements")
|
||||
@@ -65,7 +65,7 @@ class BaseNHLManager:
|
||||
try:
|
||||
# Try to load the PressStart2P font as a fallback
|
||||
fonts['score'] = ImageFont.truetype("assets/fonts/PressStart2P-Regular.ttf", 12)
|
||||
fonts['time'] = ImageFont.truetype("assets/fonts/PressStart2P-Regular.ttf", 10)
|
||||
fonts['time'] = ImageFont.truetype("assets/fonts/PressStart2P-Regular.ttf", 8)
|
||||
fonts['team'] = ImageFont.truetype("assets/fonts/PressStart2P-Regular.ttf", 8)
|
||||
fonts['status'] = ImageFont.truetype("assets/fonts/PressStart2P-Regular.ttf", 9)
|
||||
logging.info("[NHL] Successfully loaded PressStart2P font for all text elements")
|
||||
@@ -238,14 +238,14 @@ class BaseNHLManager:
|
||||
center_y = self.display_height // 2
|
||||
|
||||
# Draw home team logo (far right, extending beyond screen)
|
||||
home_x = self.display_width - home_logo.width + 20 # Move 20 pixels further right
|
||||
home_x = self.display_width - home_logo.width + 15 # Moved 5 pixels back towards center
|
||||
home_y = center_y - (home_logo.height // 2)
|
||||
|
||||
# Paste the home logo onto the overlay
|
||||
overlay.paste(home_logo, (home_x, home_y), home_logo)
|
||||
|
||||
# Draw away team logo (far left, extending beyond screen)
|
||||
away_x = -20 # Move 20 pixels further left
|
||||
away_x = -15 # Moved 5 pixels back towards center
|
||||
away_y = center_y - (away_logo.height // 2)
|
||||
|
||||
# Paste the away logo onto the overlay
|
||||
@@ -294,7 +294,7 @@ class BaseNHLManager:
|
||||
# Draw period and time
|
||||
period = self.current_game.get("period", 0)
|
||||
clock = self.current_game.get("clock", "0:00")
|
||||
period_text = f"Period {period} {clock}"
|
||||
period_text = f"P:{period} {clock}"
|
||||
|
||||
# Calculate position for the period text (centered at the top)
|
||||
period_width = draw.textlength(period_text, font=self.fonts['time'])
|
||||
@@ -412,23 +412,6 @@ class NHLRecentManager(BaseNHLManager):
|
||||
self.recent_hours = self.nhl_config.get("recent_game_hours", 48) # Default 48 hours
|
||||
self.current_game = None
|
||||
|
||||
if self.test_mode:
|
||||
# Initialize with a test game
|
||||
self.current_game = {
|
||||
"home_abbr": "TBL",
|
||||
"away_abbr": "DAL",
|
||||
"home_score": "4",
|
||||
"away_score": "2",
|
||||
"status_text": "Final",
|
||||
"home_logo_path": os.path.join(self.logo_dir, "TBL.png"),
|
||||
"away_logo_path": os.path.join(self.logo_dir, "DAL.png"),
|
||||
"game_time": "7:30 PM",
|
||||
"game_date": "Apr 17"
|
||||
}
|
||||
logging.info("[NHL] Initialized NHLRecentManager with test game: TBL vs DAL")
|
||||
else:
|
||||
logging.info("[NHL] Initialized NHLRecentManager in live mode")
|
||||
|
||||
def update(self):
|
||||
"""Update recent game data."""
|
||||
current_time = time.time()
|
||||
@@ -438,10 +421,7 @@ class NHLRecentManager(BaseNHLManager):
|
||||
if current_time - self.last_update >= interval:
|
||||
self.logger.debug("Updating recent game data")
|
||||
self.last_update = current_time
|
||||
if self.test_mode:
|
||||
# In test mode, just keep the test game
|
||||
pass
|
||||
else:
|
||||
|
||||
# Fetch data for the last 48 hours
|
||||
cutoff_time = datetime.now(timezone.utc) - timedelta(hours=self.recent_hours)
|
||||
data = self._fetch_data()
|
||||
@@ -474,9 +454,7 @@ class NHLRecentManager(BaseNHLManager):
|
||||
|
||||
def display(self, force_clear: bool = False):
|
||||
"""Display recent game information."""
|
||||
self.logger.info("NHLRecentManager.display() called")
|
||||
if not self.current_game:
|
||||
logging.warning("[NHL] No recent game data available to display")
|
||||
return
|
||||
super().display(force_clear) # Call parent class's display method
|
||||
|
||||
@@ -490,22 +468,6 @@ class NHLUpcomingManager(BaseNHLManager):
|
||||
self.logger.info("Initialized NHL Upcoming Manager")
|
||||
self.current_game = None
|
||||
|
||||
if self.test_mode:
|
||||
# Initialize with a test game
|
||||
self.current_game = {
|
||||
"home_abbr": "TBL",
|
||||
"away_abbr": "DAL",
|
||||
"status_text": "7:30 PM ET",
|
||||
"home_logo_path": os.path.join(self.logo_dir, "TBL.png"),
|
||||
"away_logo_path": os.path.join(self.logo_dir, "DAL.png"),
|
||||
"game_time": "7:30 PM",
|
||||
"game_date": "Apr 17",
|
||||
"is_upcoming": True # Set this flag to indicate it's an upcoming game
|
||||
}
|
||||
logging.info("[NHL] Initialized NHLUpcomingManager with test game: TBL vs DAL")
|
||||
else:
|
||||
logging.info("[NHL] Initialized NHLUpcomingManager in live mode")
|
||||
|
||||
def update(self):
|
||||
"""Update upcoming game data."""
|
||||
current_time = time.time()
|
||||
@@ -515,10 +477,7 @@ class NHLUpcomingManager(BaseNHLManager):
|
||||
if current_time - self.last_update >= interval:
|
||||
self.logger.debug("Updating upcoming game data")
|
||||
self.last_update = current_time
|
||||
if self.test_mode:
|
||||
# In test mode, just keep the test game
|
||||
pass
|
||||
else:
|
||||
|
||||
# Fetch today's and tomorrow's data
|
||||
today = datetime.now(timezone.utc).date()
|
||||
tomorrow = today + timedelta(days=1)
|
||||
@@ -563,8 +522,6 @@ class NHLUpcomingManager(BaseNHLManager):
|
||||
|
||||
def display(self, force_clear: bool = False):
|
||||
"""Display upcoming game information."""
|
||||
self.logger.info("NHLUpcomingManager.display() called")
|
||||
if not self.current_game:
|
||||
logging.warning("[NHL] No upcoming game data available to display")
|
||||
return
|
||||
super().display(force_clear) # Call parent class's display method
|
||||
Reference in New Issue
Block a user