From f13e9306c9742e405b5121c70dd99d309c40ad56 Mon Sep 17 00:00:00 2001 From: ChuckBuilds <33324927+ChuckBuilds@users.noreply.github.com> Date: Thu, 14 Aug 2025 16:46:48 -0500 Subject: [PATCH] more fallback errors for milb fonts --- src/milb_manager.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/milb_manager.py b/src/milb_manager.py index 2d7477a6..ae3a08ee 100644 --- a/src/milb_manager.py +++ b/src/milb_manager.py @@ -336,8 +336,13 @@ class BaseMiLBManager: date_font = getattr(self.display_manager, 'small_font', None) time_font = getattr(self.display_manager, 'small_font', None) if date_font is None or time_font is None: - date_font = ImageFont.truetype("assets/fonts/PressStart2P-Regular.ttf", 8) - time_font = ImageFont.truetype("assets/fonts/PressStart2P-Regular.ttf", 8) + try: + date_font = ImageFont.truetype("assets/fonts/PressStart2P-Regular.ttf", 8) + time_font = ImageFont.truetype("assets/fonts/PressStart2P-Regular.ttf", 8) + except Exception as e: + self.logger.warning(f"[MiLB] Could not load PressStart2P fonts: {e}, using default") + date_font = ImageFont.load_default() + time_font = ImageFont.load_default() self.logger.debug(f"[MiLB] Fonts prepared successfully") except Exception as e: self.logger.error(f"[MiLB] Failed to prepare fonts: {e}") @@ -405,8 +410,8 @@ class BaseMiLBManager: score_text = f"{away_score}-{home_score}" try: score_font = ImageFont.truetype("assets/fonts/PressStart2P-Regular.ttf", 12) - except IOError: - self.logger.warning("[MiLB] Could not load PressStart2P font, using default") + except Exception as e: + self.logger.warning(f"[MiLB] Could not load PressStart2P font: {e}, using default") score_font = ImageFont.load_default() # Calculate position for the score text @@ -420,7 +425,8 @@ class BaseMiLBManager: if self.show_records and game_data['status'] in ['status_scheduled', 'status_final', 'final', 'completed']: try: record_font = ImageFont.truetype("assets/fonts/4x6-font.ttf", 6) - except IOError: + except Exception as e: + self.logger.warning(f"[MiLB] Could not load 4x6 font: {e}, using default") record_font = ImageFont.load_default() away_record = game_data.get('away_record', '')