channel logo movement

This commit is contained in:
Chuck
2025-07-22 17:24:46 -05:00
parent eed0baec53
commit 2199dd4e05
2 changed files with 25 additions and 17 deletions

View File

@@ -195,25 +195,30 @@ class BaseMiLBManager:
self.display_manager.update_display()
# Format game date and time
game_time = datetime.fromisoformat(game_data['start_time'].replace('Z', '+00:00'))
timezone_str = self.config.get('timezone', 'UTC')
try:
tz = pytz.timezone(timezone_str)
except pytz.exceptions.UnknownTimeZoneError:
logger.warning(f"Unknown timezone: {timezone_str}, falling back to UTC")
tz = pytz.UTC
if game_time.tzinfo is None:
game_time = game_time.replace(tzinfo=pytz.UTC)
local_time = game_time.astimezone(tz)
# Check date format from config
use_short_date_format = self.config.get('display', {}).get('use_short_date_format', False)
if use_short_date_format:
game_date = local_time.strftime("%-m/%-d")
game_time_str = game_data.get('start_time')
if not game_time_str or 'TBD' in game_time_str:
game_date = "TBD"
game_time_str = ""
else:
game_date = self.display_manager.format_date_with_ordinal(local_time)
game_time = datetime.fromisoformat(game_time_str.replace('Z', '+00:00'))
timezone_str = self.config.get('timezone', 'UTC')
try:
tz = pytz.timezone(timezone_str)
except pytz.exceptions.UnknownTimeZoneError:
logger.warning(f"Unknown timezone: {timezone_str}, falling back to UTC")
tz = pytz.UTC
if game_time.tzinfo is None:
game_time = game_time.replace(tzinfo=pytz.UTC)
local_time = game_time.astimezone(tz)
# Check date format from config
use_short_date_format = self.config.get('display', {}).get('use_short_date_format', False)
if use_short_date_format:
game_date = local_time.strftime("%-m/%-d")
else:
game_date = self.display_manager.format_date_with_ordinal(local_time)
game_time_str = self._format_game_time(game_data['start_time'])
game_time_str = self._format_game_time(game_data['start_time'])
# Draw date and time using NHL-style fonts
date_font = ImageFont.truetype("assets/fonts/PressStart2P-Regular.ttf", 8)

View File

@@ -722,6 +722,9 @@ class OddsTickerManager:
logo_y = (height - broadcast_logo.height) // 2
logger.debug(f"Pasting broadcast logo at ({int(current_x)}, {logo_y})")
image.paste(broadcast_logo, (int(current_x), logo_y), broadcast_logo if broadcast_logo.mode == 'RGBA' else None)
elif not broadcast_logo:
# Add padding even if there's no logo to match total_width calculation
current_x += h_padding
return image