mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-12 05:42:59 +00:00
refactor: Reduce logo loading logging verbosity - Change routine logo loading messages from INFO to DEBUG level - Keep INFO level only for important events like test logo creation
This commit is contained in:
@@ -80,14 +80,14 @@ class BaseNHLManager:
|
|||||||
|
|
||||||
def _load_and_resize_logo(self, team_abbrev: str) -> Optional[Image.Image]:
|
def _load_and_resize_logo(self, team_abbrev: str) -> Optional[Image.Image]:
|
||||||
"""Load and resize a team logo, with caching."""
|
"""Load and resize a team logo, with caching."""
|
||||||
self.logger.info(f"Loading logo for {team_abbrev}")
|
self.logger.debug(f"Loading logo for {team_abbrev}")
|
||||||
|
|
||||||
if team_abbrev in self._logo_cache:
|
if team_abbrev in self._logo_cache:
|
||||||
self.logger.info(f"Using cached logo for {team_abbrev}")
|
self.logger.debug(f"Using cached logo for {team_abbrev}")
|
||||||
return self._logo_cache[team_abbrev]
|
return self._logo_cache[team_abbrev]
|
||||||
|
|
||||||
logo_path = os.path.join(self.logo_dir, f"{team_abbrev}.png")
|
logo_path = os.path.join(self.logo_dir, f"{team_abbrev}.png")
|
||||||
self.logger.info(f"Logo path: {logo_path}")
|
self.logger.debug(f"Logo path: {logo_path}")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Create test logos if they don't exist
|
# Create test logos if they don't exist
|
||||||
@@ -109,20 +109,20 @@ class BaseNHLManager:
|
|||||||
self.logger.info(f"Created test logo at {logo_path}")
|
self.logger.info(f"Created test logo at {logo_path}")
|
||||||
|
|
||||||
logo = Image.open(logo_path)
|
logo = Image.open(logo_path)
|
||||||
self.logger.info(f"Opened logo for {team_abbrev}, size: {logo.size}, mode: {logo.mode}")
|
self.logger.debug(f"Opened logo for {team_abbrev}, size: {logo.size}, mode: {logo.mode}")
|
||||||
|
|
||||||
# Convert to RGBA if not already
|
# Convert to RGBA if not already
|
||||||
if logo.mode != 'RGBA':
|
if logo.mode != 'RGBA':
|
||||||
self.logger.info(f"Converting {team_abbrev} logo from {logo.mode} to RGBA")
|
self.logger.debug(f"Converting {team_abbrev} logo from {logo.mode} to RGBA")
|
||||||
logo = logo.convert('RGBA')
|
logo = logo.convert('RGBA')
|
||||||
|
|
||||||
# Calculate max size based on display dimensions
|
# Calculate max size based on display dimensions
|
||||||
max_width = self.display_width // 4 # Quarter of display width
|
max_width = self.display_width // 4
|
||||||
max_height = self.display_height // 2 # Half of display height
|
max_height = self.display_height // 2 # Half of display height
|
||||||
|
|
||||||
# Resize maintaining aspect ratio
|
# Resize maintaining aspect ratio
|
||||||
logo.thumbnail((max_width, max_height), Image.Resampling.LANCZOS)
|
logo.thumbnail((max_width, max_height), Image.Resampling.LANCZOS)
|
||||||
self.logger.info(f"Resized {team_abbrev} logo to {logo.size}")
|
self.logger.debug(f"Resized {team_abbrev} logo to {logo.size}")
|
||||||
|
|
||||||
# Cache the resized logo
|
# Cache the resized logo
|
||||||
self._logo_cache[team_abbrev] = logo
|
self._logo_cache[team_abbrev] = logo
|
||||||
|
|||||||
Reference in New Issue
Block a user