mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-11 21:33:00 +00:00
change config.json data refresh rates and modify logo imaging in nhl
This commit is contained in:
@@ -48,7 +48,7 @@
|
|||||||
},
|
},
|
||||||
"stocks": {
|
"stocks": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"update_interval": 60,
|
"update_interval": 300,
|
||||||
"symbols": [
|
"symbols": [
|
||||||
"ASTS", "SCHD", "INTC", "NVDA", "T", "VOO", "SPYG", "SMCI"
|
"ASTS", "SCHD", "INTC", "NVDA", "T", "VOO", "SPYG", "SMCI"
|
||||||
],
|
],
|
||||||
@@ -56,7 +56,7 @@
|
|||||||
},
|
},
|
||||||
"stock_news": {
|
"stock_news": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"update_interval": 300,
|
"update_interval": 800,
|
||||||
"scroll_speed": 1,
|
"scroll_speed": 1,
|
||||||
"scroll_delay": 0.001,
|
"scroll_delay": 0.001,
|
||||||
"max_headlines_per_symbol": 1,
|
"max_headlines_per_symbol": 1,
|
||||||
|
|||||||
@@ -326,13 +326,14 @@ def create_scorebug_image(game_details):
|
|||||||
try:
|
try:
|
||||||
away_logo = Image.open(game_details["away_logo_path"]).convert("RGBA")
|
away_logo = Image.open(game_details["away_logo_path"]).convert("RGBA")
|
||||||
away_logo.thumbnail(logo_size, Image.Resampling.LANCZOS)
|
away_logo.thumbnail(logo_size, Image.Resampling.LANCZOS)
|
||||||
|
away_mask = away_logo.split()[-1] # Extract alpha channel as mask
|
||||||
# Calculate box explicitly
|
# Calculate box explicitly
|
||||||
left = away_logo_pos[0]
|
left = away_logo_pos[0]
|
||||||
upper = (DISPLAY_HEIGHT - away_logo.height) // 2
|
upper = (DISPLAY_HEIGHT - away_logo.height) // 2
|
||||||
right = left + away_logo.width
|
right = left + away_logo.width
|
||||||
lower = upper + away_logo.height
|
lower = upper + away_logo.height
|
||||||
box = (left, upper, right, lower)
|
box = (left, upper, right, lower)
|
||||||
img.paste(away_logo, box, away_logo)
|
img.paste(away_logo, box, away_mask) # Use extracted mask
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error(f"Error loading/pasting away logo {game_details['away_logo_path']}: {e}")
|
logging.error(f"Error loading/pasting away logo {game_details['away_logo_path']}: {e}")
|
||||||
# Draw placeholder text if logo fails
|
# Draw placeholder text if logo fails
|
||||||
@@ -348,13 +349,14 @@ def create_scorebug_image(game_details):
|
|||||||
try:
|
try:
|
||||||
home_logo = Image.open(game_details["home_logo_path"]).convert("RGBA")
|
home_logo = Image.open(game_details["home_logo_path"]).convert("RGBA")
|
||||||
home_logo.thumbnail(logo_size, Image.Resampling.LANCZOS)
|
home_logo.thumbnail(logo_size, Image.Resampling.LANCZOS)
|
||||||
|
home_mask = home_logo.split()[-1] # Extract alpha channel as mask
|
||||||
# Calculate box explicitly
|
# Calculate box explicitly
|
||||||
left = home_logo_pos[0]
|
left = home_logo_pos[0]
|
||||||
upper = (DISPLAY_HEIGHT - home_logo.height) // 2
|
upper = (DISPLAY_HEIGHT - home_logo.height) // 2
|
||||||
right = left + home_logo.width
|
right = left + home_logo.width
|
||||||
lower = upper + home_logo.height
|
lower = upper + home_logo.height
|
||||||
box = (left, upper, right, lower)
|
box = (left, upper, right, lower)
|
||||||
img.paste(home_logo, box, home_logo)
|
img.paste(home_logo, box, home_mask) # Use extracted mask
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error(f"Error loading/pasting home logo {game_details['home_logo_path']}: {e}")
|
logging.error(f"Error loading/pasting home logo {game_details['home_logo_path']}: {e}")
|
||||||
draw.text(home_logo_pos, game_details["home_abbr"], font=team_font, fill="white")
|
draw.text(home_logo_pos, game_details["home_abbr"], font=team_font, fill="white")
|
||||||
@@ -1067,13 +1069,14 @@ class NHLScoreboardManager:
|
|||||||
try:
|
try:
|
||||||
away_logo = Image.open(game_details["away_logo_path"]).convert("RGBA")
|
away_logo = Image.open(game_details["away_logo_path"]).convert("RGBA")
|
||||||
away_logo.thumbnail(logo_size, Image.Resampling.LANCZOS)
|
away_logo.thumbnail(logo_size, Image.Resampling.LANCZOS)
|
||||||
|
away_mask = away_logo.split()[-1] # Extract alpha channel as mask
|
||||||
# Calculate box explicitly
|
# Calculate box explicitly
|
||||||
left = away_logo_x
|
left = away_logo_x
|
||||||
upper = (self.display_height - away_logo.height) // 2
|
upper = (self.display_height - away_logo.height) // 2
|
||||||
right = left + away_logo.width
|
right = left + away_logo.width
|
||||||
lower = upper + away_logo.height
|
lower = upper + away_logo.height
|
||||||
box = (left, upper, right, lower)
|
box = (left, upper, right, lower)
|
||||||
img.paste(away_logo, box, away_logo)
|
img.paste(away_logo, box, away_mask) # Use extracted mask
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error(f"[NHL] Error rendering upcoming away logo {game_details['away_logo_path']}: {e}")
|
logging.error(f"[NHL] Error rendering upcoming away logo {game_details['away_logo_path']}: {e}")
|
||||||
draw.text((away_logo_x, 5), game_details.get("away_abbr", "?"), font=font_team, fill="white")
|
draw.text((away_logo_x, 5), game_details.get("away_abbr", "?"), font=font_team, fill="white")
|
||||||
@@ -1085,13 +1088,14 @@ class NHLScoreboardManager:
|
|||||||
try:
|
try:
|
||||||
home_logo = Image.open(game_details["home_logo_path"]).convert("RGBA")
|
home_logo = Image.open(game_details["home_logo_path"]).convert("RGBA")
|
||||||
home_logo.thumbnail(logo_size, Image.Resampling.LANCZOS)
|
home_logo.thumbnail(logo_size, Image.Resampling.LANCZOS)
|
||||||
|
home_mask = home_logo.split()[-1] # Extract alpha channel as mask
|
||||||
# Calculate box explicitly
|
# Calculate box explicitly
|
||||||
left = home_logo_x
|
left = home_logo_x
|
||||||
upper = (self.display_height - home_logo.height) // 2
|
upper = (self.display_height - home_logo.height) // 2
|
||||||
right = left + home_logo.width
|
right = left + home_logo.width
|
||||||
lower = upper + home_logo.height
|
lower = upper + home_logo.height
|
||||||
box = (left, upper, right, lower)
|
box = (left, upper, right, lower)
|
||||||
img.paste(home_logo, box, home_logo)
|
img.paste(home_logo, box, home_mask) # Use extracted mask
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error(f"[NHL] Error rendering upcoming home logo {game_details['home_logo_path']}: {e}")
|
logging.error(f"[NHL] Error rendering upcoming home logo {game_details['home_logo_path']}: {e}")
|
||||||
draw.text((home_logo_x, 5), game_details.get("home_abbr", "?"), font=font_team, fill="white")
|
draw.text((home_logo_x, 5), game_details.get("home_abbr", "?"), font=font_team, fill="white")
|
||||||
@@ -1164,13 +1168,14 @@ class NHLScoreboardManager:
|
|||||||
away_logo = Image.open(game_details["away_logo_path"]).convert("RGBA")
|
away_logo = Image.open(game_details["away_logo_path"]).convert("RGBA")
|
||||||
away_logo.thumbnail(logo_size, Image.Resampling.LANCZOS)
|
away_logo.thumbnail(logo_size, Image.Resampling.LANCZOS)
|
||||||
away_logo_drawn_size = away_logo.size # Keep track of size
|
away_logo_drawn_size = away_logo.size # Keep track of size
|
||||||
|
away_mask = away_logo.split()[-1] # Extract alpha channel as mask
|
||||||
# Calculate box explicitly
|
# Calculate box explicitly
|
||||||
left = away_logo_x
|
left = away_logo_x
|
||||||
upper = (self.display_height - away_logo.height) // 2
|
upper = (self.display_height - away_logo.height) // 2
|
||||||
right = left + away_logo.width
|
right = left + away_logo.width
|
||||||
lower = upper + away_logo.height
|
lower = upper + away_logo.height
|
||||||
box = (left, upper, right, lower)
|
box = (left, upper, right, lower)
|
||||||
img.paste(away_logo, box, away_logo)
|
img.paste(away_logo, box, away_mask) # Use extracted mask
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error(f"[NHL] Error rendering away logo {game_details['away_logo_path']}: {e}")
|
logging.error(f"[NHL] Error rendering away logo {game_details['away_logo_path']}: {e}")
|
||||||
draw.text((away_logo_x + 2, 5), game_details.get("away_abbr", "?"), font=font_team, fill="white")
|
draw.text((away_logo_x + 2, 5), game_details.get("away_abbr", "?"), font=font_team, fill="white")
|
||||||
@@ -1187,13 +1192,14 @@ class NHLScoreboardManager:
|
|||||||
home_logo = Image.open(game_details["home_logo_path"]).convert("RGBA")
|
home_logo = Image.open(game_details["home_logo_path"]).convert("RGBA")
|
||||||
home_logo.thumbnail(logo_size, Image.Resampling.LANCZOS)
|
home_logo.thumbnail(logo_size, Image.Resampling.LANCZOS)
|
||||||
home_logo_drawn_size = home_logo.size # Keep track of size
|
home_logo_drawn_size = home_logo.size # Keep track of size
|
||||||
|
home_mask = home_logo.split()[-1] # Extract alpha channel as mask
|
||||||
# Calculate box explicitly
|
# Calculate box explicitly
|
||||||
left = home_logo_x
|
left = home_logo_x
|
||||||
upper = (self.display_height - home_logo.height) // 2
|
upper = (self.display_height - home_logo.height) // 2
|
||||||
right = left + home_logo.width
|
right = left + home_logo.width
|
||||||
lower = upper + home_logo.height
|
lower = upper + home_logo.height
|
||||||
box = (left, upper, right, lower)
|
box = (left, upper, right, lower)
|
||||||
img.paste(home_logo, box, home_logo)
|
img.paste(home_logo, box, home_mask) # Use extracted mask
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error(f"[NHL] Error rendering home logo {game_details['home_logo_path']}: {e}")
|
logging.error(f"[NHL] Error rendering home logo {game_details['home_logo_path']}: {e}")
|
||||||
draw.text((home_logo_x + 2, 5), game_details.get("home_abbr", "?"), font=font_team, fill="white")
|
draw.text((home_logo_x + 2, 5), game_details.get("home_abbr", "?"), font=font_team, fill="white")
|
||||||
|
|||||||
Reference in New Issue
Block a user