From e25e853de625d23274fa4a61b8d560585190d51e Mon Sep 17 00:00:00 2001 From: Chuck <33324927+ChuckBuilds@users.noreply.github.com> Date: Tue, 22 Jul 2025 12:35:14 -0500 Subject: [PATCH] fix import error and method order --- config/config.json | 12 ++++++------ src/odds_ticker_manager.py | 34 +++++++++++++++++----------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/config/config.json b/config/config.json index 0b1334f3..037af5f0 100644 --- a/config/config.json +++ b/config/config.json @@ -74,18 +74,18 @@ "use_short_date_format": true }, "clock": { - "enabled": true, + "enabled": false, "format": "%I:%M %p", "update_interval": 1 }, "weather": { - "enabled": true, + "enabled": false, "update_interval": 1800, "units": "imperial", "display_format": "{temp}°F\n{condition}" }, "stocks": { - "enabled": true, + "enabled": false, "update_interval": 600, "symbols": [ "ASTS", "SCHD", "INTC", "NVDA", "T", "VOO", "SMCI" @@ -93,7 +93,7 @@ "display_format": "{symbol}: ${price} ({change}%)" }, "crypto": { - "enabled": true, + "enabled": false, "update_interval": 600, "symbols": [ "BTC-USD", "ETH-USD" @@ -101,7 +101,7 @@ "display_format": "{symbol}: ${price} ({change}%)" }, "stock_news": { - "enabled": true, + "enabled": false, "update_interval": 3600, "scroll_speed": 1, "scroll_delay": 0.001, @@ -124,7 +124,7 @@ "show_channel_logos": true }, "calendar": { - "enabled": true, + "enabled": false, "credentials_file": "credentials.json", "token_file": "token.pickle", "update_interval": 3600, diff --git a/src/odds_ticker_manager.py b/src/odds_ticker_manager.py index f1d16d1e..58be236f 100644 --- a/src/odds_ticker_manager.py +++ b/src/odds_ticker_manager.py @@ -484,23 +484,6 @@ class OddsTickerManager: if away_logo: away_logo = away_logo.resize((logo_size, logo_size), Image.Resampling.LANCZOS) - # Datetime column width - day_text = local_time.strftime("%A") - date_text = local_time.strftime("%-m/%d") - time_text = local_time.strftime("%I:%M%p").lstrip('0') - datetime_col_width = max(day_width, date_width, time_width) - - if broadcast_logo: - # Resize broadcast logo to fit the datetime column width - ratio = datetime_col_width / broadcast_logo.width - new_height = int(broadcast_logo.height * ratio) - broadcast_logo = broadcast_logo.resize((datetime_col_width, new_height), Image.Resampling.LANCZOS) - - # "vs." text - vs_text = "vs." - temp_draw = ImageDraw.Draw(Image.new('RGB', (1, 1))) - vs_width = int(temp_draw.textlength(vs_text, font=vs_font)) - # Format date and time into 3 parts game_time = game['start_time'] timezone_str = self.config.get('timezone', 'UTC') @@ -517,6 +500,23 @@ class OddsTickerManager: day_text = local_time.strftime("%A") date_text = local_time.strftime("%-m/%d") time_text = local_time.strftime("%I:%M%p").lstrip('0') + + # Datetime column width + temp_draw = ImageDraw.Draw(Image.new('RGB', (1, 1))) + day_width = int(temp_draw.textlength(day_text, font=datetime_font)) + date_width = int(temp_draw.textlength(date_text, font=datetime_font)) + time_width = int(temp_draw.textlength(time_text, font=datetime_font)) + datetime_col_width = max(day_width, date_width, time_width) + + if broadcast_logo: + # Resize broadcast logo to fit the datetime column width + ratio = datetime_col_width / broadcast_logo.width + new_height = int(broadcast_logo.height * ratio) + broadcast_logo = broadcast_logo.resize((datetime_col_width, new_height), Image.Resampling.LANCZOS) + + # "vs." text + vs_text = "vs." + vs_width = int(temp_draw.textlength(vs_text, font=vs_font)) # Team and record text away_team_text = f"{game.get('away_team_name', game.get('away_team', 'N/A'))} ({game.get('away_record', '') or 'N/A'})"