From 2199dd4e05b3d24c86e0cf9e449c04f1ccbf239c Mon Sep 17 00:00:00 2001 From: Chuck <33324927+ChuckBuilds@users.noreply.github.com> Date: Tue, 22 Jul 2025 17:24:46 -0500 Subject: [PATCH] channel logo movement --- src/milb_manager.py | 39 +++++++++++++++++++++----------------- src/odds_ticker_manager.py | 3 +++ 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/src/milb_manager.py b/src/milb_manager.py index fc2cf423..2dafbcf2 100644 --- a/src/milb_manager.py +++ b/src/milb_manager.py @@ -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) diff --git a/src/odds_ticker_manager.py b/src/odds_ticker_manager.py index 44dab6a5..d2b389ea 100644 --- a/src/odds_ticker_manager.py +++ b/src/odds_ticker_manager.py @@ -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