mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-11 21:33:00 +00:00
adjustments to formatting of odds
This commit is contained in:
@@ -267,16 +267,16 @@ class BaseMiLBManager:
|
|||||||
# Using textbbox is more accurate for height than .size
|
# Using textbbox is more accurate for height than .size
|
||||||
record_bbox = draw.textbbox((0,0), "0-0", font=record_font)
|
record_bbox = draw.textbbox((0,0), "0-0", font=record_font)
|
||||||
record_height = record_bbox[3] - record_bbox[1]
|
record_height = record_bbox[3] - record_bbox[1]
|
||||||
record_y = height - record_height - 1
|
record_y = height - record_height
|
||||||
|
|
||||||
if away_record:
|
if away_record:
|
||||||
away_record_x = 2
|
away_record_x = 0
|
||||||
self._draw_text_with_outline(draw, away_record, (away_record_x, record_y), record_font)
|
self._draw_text_with_outline(draw, away_record, (away_record_x, record_y), record_font)
|
||||||
|
|
||||||
if home_record:
|
if home_record:
|
||||||
home_record_bbox = draw.textbbox((0,0), home_record, font=record_font)
|
home_record_bbox = draw.textbbox((0,0), home_record, font=record_font)
|
||||||
home_record_width = home_record_bbox[2] - home_record_bbox[0]
|
home_record_width = home_record_bbox[2] - home_record_bbox[0]
|
||||||
home_record_x = width - home_record_width - 2
|
home_record_x = width - home_record_width
|
||||||
self._draw_text_with_outline(draw, home_record, (home_record_x, record_y), record_font)
|
self._draw_text_with_outline(draw, home_record, (home_record_x, record_y), record_font)
|
||||||
|
|
||||||
return image
|
return image
|
||||||
|
|||||||
@@ -279,6 +279,7 @@ class BaseMLBManager:
|
|||||||
display_width = draw.textlength(display_text, font=font)
|
display_width = draw.textlength(display_text, font=font)
|
||||||
display_x = (width - display_width) // 2
|
display_x = (width - display_width) // 2
|
||||||
display_y = (height - font.size) // 2
|
display_y = (height - font.size) // 2
|
||||||
|
display_y += 4
|
||||||
self._draw_text_with_outline(draw, display_text, (display_x, display_y), font, fill=(255, 255, 255))
|
self._draw_text_with_outline(draw, display_text, (display_x, display_y), font, fill=(255, 255, 255))
|
||||||
|
|
||||||
# Show spreads and over/under if available (on top of scores)
|
# Show spreads and over/under if available (on top of scores)
|
||||||
@@ -328,16 +329,16 @@ class BaseMLBManager:
|
|||||||
# Using textbbox is more accurate for height than .size
|
# Using textbbox is more accurate for height than .size
|
||||||
record_bbox = draw.textbbox((0,0), "0-0", font=record_font)
|
record_bbox = draw.textbbox((0,0), "0-0", font=record_font)
|
||||||
record_height = record_bbox[3] - record_bbox[1]
|
record_height = record_bbox[3] - record_bbox[1]
|
||||||
record_y = height - record_height - 1
|
record_y = height - record_height
|
||||||
|
|
||||||
if away_record:
|
if away_record:
|
||||||
away_record_x = 2
|
away_record_x = 0
|
||||||
self._draw_text_with_outline(draw, away_record, (away_record_x, record_y), record_font)
|
self._draw_text_with_outline(draw, away_record, (away_record_x, record_y), record_font)
|
||||||
|
|
||||||
if home_record:
|
if home_record:
|
||||||
home_record_bbox = draw.textbbox((0,0), home_record, font=record_font)
|
home_record_bbox = draw.textbbox((0,0), home_record, font=record_font)
|
||||||
home_record_width = home_record_bbox[2] - home_record_bbox[0]
|
home_record_width = home_record_bbox[2] - home_record_bbox[0]
|
||||||
home_record_x = width - home_record_width - 2
|
home_record_x = width - home_record_width
|
||||||
self._draw_text_with_outline(draw, home_record, (home_record_x, record_y), record_font)
|
self._draw_text_with_outline(draw, home_record, (home_record_x, record_y), record_font)
|
||||||
|
|
||||||
return image
|
return image
|
||||||
@@ -624,14 +625,14 @@ class BaseMLBManager:
|
|||||||
if favored_side == 'home':
|
if favored_side == 'home':
|
||||||
# Home team is favored, show spread on right side
|
# Home team is favored, show spread on right side
|
||||||
spread_width = draw.textlength(spread_text, font=font)
|
spread_width = draw.textlength(spread_text, font=font)
|
||||||
spread_x = width - spread_width - 2 # Top right
|
spread_x = width - spread_width # Top right
|
||||||
spread_y = 2
|
spread_y = 0
|
||||||
self._draw_text_with_outline(draw, spread_text, (spread_x, spread_y), font, fill=(0, 255, 0))
|
self._draw_text_with_outline(draw, spread_text, (spread_x, spread_y), font, fill=(0, 255, 0))
|
||||||
self.logger.debug(f"Showing home spread '{spread_text}' on right side")
|
self.logger.debug(f"Showing home spread '{spread_text}' on right side")
|
||||||
else:
|
else:
|
||||||
# Away team is favored, show spread on left side
|
# Away team is favored, show spread on left side
|
||||||
spread_x = 2 # Top left
|
spread_x = 0 # Top left
|
||||||
spread_y = 2
|
spread_y = 0
|
||||||
self._draw_text_with_outline(draw, spread_text, (spread_x, spread_y), font, fill=(0, 255, 0))
|
self._draw_text_with_outline(draw, spread_text, (spread_x, spread_y), font, fill=(0, 255, 0))
|
||||||
self.logger.debug(f"Showing away spread '{spread_text}' on left side")
|
self.logger.debug(f"Showing away spread '{spread_text}' on left side")
|
||||||
|
|
||||||
@@ -644,18 +645,18 @@ class BaseMLBManager:
|
|||||||
|
|
||||||
if favored_side == 'home':
|
if favored_side == 'home':
|
||||||
# Home team is favored, show O/U on left side (opposite of spread)
|
# Home team is favored, show O/U on left side (opposite of spread)
|
||||||
ou_x = 2 # Top left
|
ou_x = 0 # Top left
|
||||||
ou_y = 2
|
ou_y = 0
|
||||||
self.logger.debug(f"Showing O/U '{ou_text}' on left side (home favored)")
|
self.logger.debug(f"Showing O/U '{ou_text}' on left side (home favored)")
|
||||||
elif favored_side == 'away':
|
elif favored_side == 'away':
|
||||||
# Away team is favored, show O/U on right side (opposite of spread)
|
# Away team is favored, show O/U on right side (opposite of spread)
|
||||||
ou_x = width - ou_width - 2 # Top right
|
ou_x = width - ou_width # Top right
|
||||||
ou_y = 2
|
ou_y = 0
|
||||||
self.logger.debug(f"Showing O/U '{ou_text}' on right side (away favored)")
|
self.logger.debug(f"Showing O/U '{ou_text}' on right side (away favored)")
|
||||||
else:
|
else:
|
||||||
# No clear favorite, show O/U in center
|
# No clear favorite, show O/U in center
|
||||||
ou_x = (width - ou_width) // 2
|
ou_x = (width - ou_width) // 2
|
||||||
ou_y = 2
|
ou_y = 0
|
||||||
self.logger.debug(f"Showing O/U '{ou_text}' in center (no clear favorite)")
|
self.logger.debug(f"Showing O/U '{ou_text}' in center (no clear favorite)")
|
||||||
|
|
||||||
self._draw_text_with_outline(draw, ou_text, (ou_x, ou_y), font, fill=(0, 255, 0))
|
self._draw_text_with_outline(draw, ou_text, (ou_x, ou_y), font, fill=(0, 255, 0))
|
||||||
|
|||||||
@@ -598,16 +598,16 @@ class BaseNBAManager:
|
|||||||
|
|
||||||
record_bbox = draw.textbbox((0,0), "0-0", font=record_font)
|
record_bbox = draw.textbbox((0,0), "0-0", font=record_font)
|
||||||
record_height = record_bbox[3] - record_bbox[1]
|
record_height = record_bbox[3] - record_bbox[1]
|
||||||
record_y = self.display_height - record_height - 1
|
record_y = self.display_height - record_height
|
||||||
|
|
||||||
if away_record:
|
if away_record:
|
||||||
away_record_x = 2
|
away_record_x = 0
|
||||||
self._draw_text_with_outline(draw, away_record, (away_record_x, record_y), record_font)
|
self._draw_text_with_outline(draw, away_record, (away_record_x, record_y), record_font)
|
||||||
|
|
||||||
if home_record:
|
if home_record:
|
||||||
home_record_bbox = draw.textbbox((0,0), home_record, font=record_font)
|
home_record_bbox = draw.textbbox((0,0), home_record, font=record_font)
|
||||||
home_record_width = home_record_bbox[2] - home_record_bbox[0]
|
home_record_width = home_record_bbox[2] - home_record_bbox[0]
|
||||||
home_record_x = self.display_width - home_record_width - 2
|
home_record_x = self.display_width - home_record_width
|
||||||
self._draw_text_with_outline(draw, home_record, (home_record_x, record_y), record_font)
|
self._draw_text_with_outline(draw, home_record, (home_record_x, record_y), record_font)
|
||||||
|
|
||||||
# Display the image
|
# Display the image
|
||||||
@@ -674,14 +674,14 @@ class BaseNBAManager:
|
|||||||
if favored_side == 'home':
|
if favored_side == 'home':
|
||||||
# Home team is favored, show spread on right side
|
# Home team is favored, show spread on right side
|
||||||
spread_width = draw.textlength(spread_text, font=font)
|
spread_width = draw.textlength(spread_text, font=font)
|
||||||
spread_x = width - spread_width - 2 # Top right
|
spread_x = width - spread_width # Top right
|
||||||
spread_y = 2
|
spread_y = 0
|
||||||
self._draw_text_with_outline(draw, spread_text, (spread_x, spread_y), font, fill=(0, 255, 0))
|
self._draw_text_with_outline(draw, spread_text, (spread_x, spread_y), font, fill=(0, 255, 0))
|
||||||
self.logger.debug(f"Showing home spread '{spread_text}' on right side")
|
self.logger.debug(f"Showing home spread '{spread_text}' on right side")
|
||||||
else:
|
else:
|
||||||
# Away team is favored, show spread on left side
|
# Away team is favored, show spread on left side
|
||||||
spread_x = 2 # Top left
|
spread_x = 0 # Top left
|
||||||
spread_y = 2
|
spread_y = 0
|
||||||
self._draw_text_with_outline(draw, spread_text, (spread_x, spread_y), font, fill=(0, 255, 0))
|
self._draw_text_with_outline(draw, spread_text, (spread_x, spread_y), font, fill=(0, 255, 0))
|
||||||
self.logger.debug(f"Showing away spread '{spread_text}' on left side")
|
self.logger.debug(f"Showing away spread '{spread_text}' on left side")
|
||||||
|
|
||||||
@@ -694,18 +694,18 @@ class BaseNBAManager:
|
|||||||
|
|
||||||
if favored_side == 'home':
|
if favored_side == 'home':
|
||||||
# Home team is favored, show O/U on left side (opposite of spread)
|
# Home team is favored, show O/U on left side (opposite of spread)
|
||||||
ou_x = 2 # Top left
|
ou_x = 0 # Top left
|
||||||
ou_y = 2
|
ou_y = 0
|
||||||
self.logger.debug(f"Showing O/U '{ou_text}' on left side (home favored)")
|
self.logger.debug(f"Showing O/U '{ou_text}' on left side (home favored)")
|
||||||
elif favored_side == 'away':
|
elif favored_side == 'away':
|
||||||
# Away team is favored, show O/U on right side (opposite of spread)
|
# Away team is favored, show O/U on right side (opposite of spread)
|
||||||
ou_x = width - ou_width - 2 # Top right
|
ou_x = width - ou_width # Top right
|
||||||
ou_y = 2
|
ou_y = 0
|
||||||
self.logger.debug(f"Showing O/U '{ou_text}' on right side (away favored)")
|
self.logger.debug(f"Showing O/U '{ou_text}' on right side (away favored)")
|
||||||
else:
|
else:
|
||||||
# No clear favorite, show O/U in center
|
# No clear favorite, show O/U in center
|
||||||
ou_x = (width - ou_width) // 2
|
ou_x = (width - ou_width) // 2
|
||||||
ou_y = 2
|
ou_y = 0
|
||||||
self.logger.debug(f"Showing O/U '{ou_text}' in center (no clear favorite)")
|
self.logger.debug(f"Showing O/U '{ou_text}' in center (no clear favorite)")
|
||||||
|
|
||||||
self._draw_text_with_outline(draw, ou_text, (ou_x, ou_y), font, fill=(0, 255, 0))
|
self._draw_text_with_outline(draw, ou_text, (ou_x, ou_y), font, fill=(0, 255, 0))
|
||||||
|
|||||||
@@ -288,16 +288,16 @@ class BaseNCAABaseballManager:
|
|||||||
|
|
||||||
record_bbox = draw.textbbox((0, 0), "0-0", font=record_font)
|
record_bbox = draw.textbbox((0, 0), "0-0", font=record_font)
|
||||||
record_height = record_bbox[3] - record_bbox[1]
|
record_height = record_bbox[3] - record_bbox[1]
|
||||||
record_y = height - record_height - 1
|
record_y = height - record_height
|
||||||
|
|
||||||
if away_record:
|
if away_record:
|
||||||
away_record_x = 2
|
away_record_x = 0
|
||||||
self._draw_text_with_outline(draw, away_record, (away_record_x, record_y), record_font)
|
self._draw_text_with_outline(draw, away_record, (away_record_x, record_y), record_font)
|
||||||
|
|
||||||
if home_record:
|
if home_record:
|
||||||
home_record_bbox = draw.textbbox((0, 0), home_record, font=record_font)
|
home_record_bbox = draw.textbbox((0, 0), home_record, font=record_font)
|
||||||
home_record_width = home_record_bbox[2] - home_record_bbox[0]
|
home_record_width = home_record_bbox[2] - home_record_bbox[0]
|
||||||
home_record_x = width - home_record_width - 2
|
home_record_x = width - home_record_width
|
||||||
self._draw_text_with_outline(draw, home_record, (home_record_x, record_y), record_font)
|
self._draw_text_with_outline(draw, home_record, (home_record_x, record_y), record_font)
|
||||||
|
|
||||||
# Draw betting odds if available and enabled
|
# Draw betting odds if available and enabled
|
||||||
@@ -324,14 +324,14 @@ class BaseNCAABaseballManager:
|
|||||||
|
|
||||||
# Draw away team odds
|
# Draw away team odds
|
||||||
if away_spread != 'N/A':
|
if away_spread != 'N/A':
|
||||||
away_odds_x = 5
|
away_odds_x = 0
|
||||||
away_odds_y = height - 10
|
away_odds_y = 0
|
||||||
self._draw_text_with_outline(draw, str(away_spread), (away_odds_x, away_odds_y), odds_font, odds_color, outline_color)
|
self._draw_text_with_outline(draw, str(away_spread), (away_odds_x, away_odds_y), odds_font, odds_color, outline_color)
|
||||||
|
|
||||||
# Draw home team odds
|
# Draw home team odds
|
||||||
if home_spread != 'N/A':
|
if home_spread != 'N/A':
|
||||||
home_odds_x = width - 30
|
home_odds_x = width - draw.textlength(str(home_spread), font=odds_font)
|
||||||
home_odds_y = height - 10
|
home_odds_y = 0
|
||||||
self._draw_text_with_outline(draw, str(home_spread), (home_odds_x, home_odds_y), odds_font, odds_color, outline_color)
|
self._draw_text_with_outline(draw, str(home_spread), (home_odds_x, home_odds_y), odds_font, odds_color, outline_color)
|
||||||
|
|
||||||
return image
|
return image
|
||||||
|
|||||||
@@ -323,14 +323,14 @@ class BaseNCAAFBManager: # Renamed class
|
|||||||
if favored_side == 'home':
|
if favored_side == 'home':
|
||||||
# Home team is favored, show spread on right side
|
# Home team is favored, show spread on right side
|
||||||
spread_width = draw.textlength(spread_text, font=font)
|
spread_width = draw.textlength(spread_text, font=font)
|
||||||
spread_x = width - spread_width - 2 # Top right
|
spread_x = width - spread_width # Top right
|
||||||
spread_y = 2
|
spread_y = 0
|
||||||
self._draw_text_with_outline(draw, spread_text, (spread_x, spread_y), font, fill=(0, 255, 0))
|
self._draw_text_with_outline(draw, spread_text, (spread_x, spread_y), font, fill=(0, 255, 0))
|
||||||
self.logger.debug(f"Showing home spread '{spread_text}' on right side")
|
self.logger.debug(f"Showing home spread '{spread_text}' on right side")
|
||||||
else:
|
else:
|
||||||
# Away team is favored, show spread on left side
|
# Away team is favored, show spread on left side
|
||||||
spread_x = 2 # Top left
|
spread_x = 0 # Top left
|
||||||
spread_y = 2
|
spread_y = 0
|
||||||
self._draw_text_with_outline(draw, spread_text, (spread_x, spread_y), font, fill=(0, 255, 0))
|
self._draw_text_with_outline(draw, spread_text, (spread_x, spread_y), font, fill=(0, 255, 0))
|
||||||
self.logger.debug(f"Showing away spread '{spread_text}' on left side")
|
self.logger.debug(f"Showing away spread '{spread_text}' on left side")
|
||||||
|
|
||||||
@@ -343,18 +343,18 @@ class BaseNCAAFBManager: # Renamed class
|
|||||||
|
|
||||||
if favored_side == 'home':
|
if favored_side == 'home':
|
||||||
# Home team is favored, show O/U on left side (opposite of spread)
|
# Home team is favored, show O/U on left side (opposite of spread)
|
||||||
ou_x = 2 # Top left
|
ou_x = 0 # Top left
|
||||||
ou_y = 2
|
ou_y = 0
|
||||||
self.logger.debug(f"Showing O/U '{ou_text}' on left side (home favored)")
|
self.logger.debug(f"Showing O/U '{ou_text}' on left side (home favored)")
|
||||||
elif favored_side == 'away':
|
elif favored_side == 'away':
|
||||||
# Away team is favored, show O/U on right side (opposite of spread)
|
# Away team is favored, show O/U on right side (opposite of spread)
|
||||||
ou_x = width - ou_width - 2 # Top right
|
ou_x = width - ou_width # Top right
|
||||||
ou_y = 2
|
ou_y = 0
|
||||||
self.logger.debug(f"Showing O/U '{ou_text}' on right side (away favored)")
|
self.logger.debug(f"Showing O/U '{ou_text}' on right side (away favored)")
|
||||||
else:
|
else:
|
||||||
# No clear favorite, show O/U in center
|
# No clear favorite, show O/U in center
|
||||||
ou_x = (width - ou_width) // 2
|
ou_x = (width - ou_width) // 2
|
||||||
ou_y = 2
|
ou_y = 0
|
||||||
self.logger.debug(f"Showing O/U '{ou_text}' in center (no clear favorite)")
|
self.logger.debug(f"Showing O/U '{ou_text}' in center (no clear favorite)")
|
||||||
|
|
||||||
self._draw_text_with_outline(draw, ou_text, (ou_x, ou_y), font, fill=(0, 255, 0))
|
self._draw_text_with_outline(draw, ou_text, (ou_x, ou_y), font, fill=(0, 255, 0))
|
||||||
@@ -1036,16 +1036,16 @@ class NCAAFBRecentManager(BaseNCAAFBManager): # Renamed class
|
|||||||
|
|
||||||
record_bbox = draw_overlay.textbbox((0,0), "0-0", font=record_font)
|
record_bbox = draw_overlay.textbbox((0,0), "0-0", font=record_font)
|
||||||
record_height = record_bbox[3] - record_bbox[1]
|
record_height = record_bbox[3] - record_bbox[1]
|
||||||
record_y = self.display_height - record_height - 1
|
record_y = self.display_height - record_height
|
||||||
|
|
||||||
if away_record:
|
if away_record:
|
||||||
away_record_x = 2
|
away_record_x = 0
|
||||||
self._draw_text_with_outline(draw_overlay, away_record, (away_record_x, record_y), record_font)
|
self._draw_text_with_outline(draw_overlay, away_record, (away_record_x, record_y), record_font)
|
||||||
|
|
||||||
if home_record:
|
if home_record:
|
||||||
home_record_bbox = draw_overlay.textbbox((0,0), home_record, font=record_font)
|
home_record_bbox = draw_overlay.textbbox((0,0), home_record, font=record_font)
|
||||||
home_record_width = home_record_bbox[2] - home_record_bbox[0]
|
home_record_width = home_record_bbox[2] - home_record_bbox[0]
|
||||||
home_record_x = self.display_width - home_record_width - 2
|
home_record_x = self.display_width - home_record_width
|
||||||
self._draw_text_with_outline(draw_overlay, home_record, (home_record_x, record_y), record_font)
|
self._draw_text_with_outline(draw_overlay, home_record, (home_record_x, record_y), record_font)
|
||||||
|
|
||||||
# Composite and display
|
# Composite and display
|
||||||
@@ -1254,16 +1254,16 @@ class NCAAFBUpcomingManager(BaseNCAAFBManager): # Renamed class
|
|||||||
|
|
||||||
record_bbox = draw_overlay.textbbox((0,0), "0-0", font=record_font)
|
record_bbox = draw_overlay.textbbox((0,0), "0-0", font=record_font)
|
||||||
record_height = record_bbox[3] - record_bbox[1]
|
record_height = record_bbox[3] - record_bbox[1]
|
||||||
record_y = self.display_height - record_height - 1
|
record_y = self.display_height - record_height
|
||||||
|
|
||||||
if away_record:
|
if away_record:
|
||||||
away_record_x = 2
|
away_record_x = 0
|
||||||
self._draw_text_with_outline(draw_overlay, away_record, (away_record_x, record_y), record_font)
|
self._draw_text_with_outline(draw_overlay, away_record, (away_record_x, record_y), record_font)
|
||||||
|
|
||||||
if home_record:
|
if home_record:
|
||||||
home_record_bbox = draw_overlay.textbbox((0,0), home_record, font=record_font)
|
home_record_bbox = draw_overlay.textbbox((0,0), home_record, font=record_font)
|
||||||
home_record_width = home_record_bbox[2] - home_record_bbox[0]
|
home_record_width = home_record_bbox[2] - home_record_bbox[0]
|
||||||
home_record_x = self.display_width - home_record_width - 2
|
home_record_x = self.display_width - home_record_width
|
||||||
self._draw_text_with_outline(draw_overlay, home_record, (home_record_x, record_y), record_font)
|
self._draw_text_with_outline(draw_overlay, home_record, (home_record_x, record_y), record_font)
|
||||||
|
|
||||||
# Composite and display
|
# Composite and display
|
||||||
|
|||||||
@@ -609,16 +609,16 @@ class BaseNCAAMBasketballManager:
|
|||||||
|
|
||||||
record_bbox = draw.textbbox((0,0), "0-0", font=record_font)
|
record_bbox = draw.textbbox((0,0), "0-0", font=record_font)
|
||||||
record_height = record_bbox[3] - record_bbox[1]
|
record_height = record_bbox[3] - record_bbox[1]
|
||||||
record_y = self.display_height - record_height - 1
|
record_y = self.display_height - record_height
|
||||||
|
|
||||||
if away_record:
|
if away_record:
|
||||||
away_record_x = 2
|
away_record_x = 0
|
||||||
self._draw_text_with_outline(draw, away_record, (away_record_x, record_y), record_font)
|
self._draw_text_with_outline(draw, away_record, (away_record_x, record_y), record_font)
|
||||||
|
|
||||||
if home_record:
|
if home_record:
|
||||||
home_record_bbox = draw.textbbox((0,0), home_record, font=record_font)
|
home_record_bbox = draw.textbbox((0,0), home_record, font=record_font)
|
||||||
home_record_width = home_record_bbox[2] - home_record_bbox[0]
|
home_record_width = home_record_bbox[2] - home_record_bbox[0]
|
||||||
home_record_x = self.display_width - home_record_width - 2
|
home_record_x = self.display_width - home_record_width
|
||||||
self._draw_text_with_outline(draw, home_record, (home_record_x, record_y), record_font)
|
self._draw_text_with_outline(draw, home_record, (home_record_x, record_y), record_font)
|
||||||
|
|
||||||
# Display the image
|
# Display the image
|
||||||
|
|||||||
@@ -323,14 +323,14 @@ class BaseNFLManager: # Renamed class
|
|||||||
if favored_side == 'home':
|
if favored_side == 'home':
|
||||||
# Home team is favored, show spread on right side
|
# Home team is favored, show spread on right side
|
||||||
spread_width = draw.textlength(spread_text, font=font)
|
spread_width = draw.textlength(spread_text, font=font)
|
||||||
spread_x = width - spread_width - 2 # Top right
|
spread_x = width - spread_width # Top right
|
||||||
spread_y = 2
|
spread_y = 0
|
||||||
self._draw_text_with_outline(draw, spread_text, (spread_x, spread_y), font, fill=(0, 255, 0))
|
self._draw_text_with_outline(draw, spread_text, (spread_x, spread_y), font, fill=(0, 255, 0))
|
||||||
self.logger.debug(f"Showing home spread '{spread_text}' on right side")
|
self.logger.debug(f"Showing home spread '{spread_text}' on right side")
|
||||||
else:
|
else:
|
||||||
# Away team is favored, show spread on left side
|
# Away team is favored, show spread on left side
|
||||||
spread_x = 2 # Top left
|
spread_x = 0 # Top left
|
||||||
spread_y = 2
|
spread_y = 0
|
||||||
self._draw_text_with_outline(draw, spread_text, (spread_x, spread_y), font, fill=(0, 255, 0))
|
self._draw_text_with_outline(draw, spread_text, (spread_x, spread_y), font, fill=(0, 255, 0))
|
||||||
self.logger.debug(f"Showing away spread '{spread_text}' on left side")
|
self.logger.debug(f"Showing away spread '{spread_text}' on left side")
|
||||||
|
|
||||||
@@ -343,18 +343,18 @@ class BaseNFLManager: # Renamed class
|
|||||||
|
|
||||||
if favored_side == 'home':
|
if favored_side == 'home':
|
||||||
# Home team is favored, show O/U on left side (opposite of spread)
|
# Home team is favored, show O/U on left side (opposite of spread)
|
||||||
ou_x = 2 # Top left
|
ou_x = 0 # Top left
|
||||||
ou_y = 2
|
ou_y = 0
|
||||||
self.logger.debug(f"Showing O/U '{ou_text}' on left side (home favored)")
|
self.logger.debug(f"Showing O/U '{ou_text}' on left side (home favored)")
|
||||||
elif favored_side == 'away':
|
elif favored_side == 'away':
|
||||||
# Away team is favored, show O/U on right side (opposite of spread)
|
# Away team is favored, show O/U on right side (opposite of spread)
|
||||||
ou_x = width - ou_width - 2 # Top right
|
ou_x = width - ou_width # Top right
|
||||||
ou_y = 2
|
ou_y = 0
|
||||||
self.logger.debug(f"Showing O/U '{ou_text}' on right side (away favored)")
|
self.logger.debug(f"Showing O/U '{ou_text}' on right side (away favored)")
|
||||||
else:
|
else:
|
||||||
# No clear favorite, show O/U in center
|
# No clear favorite, show O/U in center
|
||||||
ou_x = (width - ou_width) // 2
|
ou_x = (width - ou_width) // 2
|
||||||
ou_y = 2
|
ou_y = 0
|
||||||
self.logger.debug(f"Showing O/U '{ou_text}' in center (no clear favorite)")
|
self.logger.debug(f"Showing O/U '{ou_text}' in center (no clear favorite)")
|
||||||
|
|
||||||
self._draw_text_with_outline(draw, ou_text, (ou_x, ou_y), font, fill=(0, 255, 0))
|
self._draw_text_with_outline(draw, ou_text, (ou_x, ou_y), font, fill=(0, 255, 0))
|
||||||
@@ -1025,16 +1025,16 @@ class NFLRecentManager(BaseNFLManager): # Renamed class
|
|||||||
|
|
||||||
record_bbox = draw_overlay.textbbox((0,0), "0-0", font=record_font)
|
record_bbox = draw_overlay.textbbox((0,0), "0-0", font=record_font)
|
||||||
record_height = record_bbox[3] - record_bbox[1]
|
record_height = record_bbox[3] - record_bbox[1]
|
||||||
record_y = self.display_height - record_height - 1
|
record_y = self.display_height - record_height
|
||||||
|
|
||||||
if away_record:
|
if away_record:
|
||||||
away_record_x = 2
|
away_record_x = 0
|
||||||
self._draw_text_with_outline(draw_overlay, away_record, (away_record_x, record_y), record_font)
|
self._draw_text_with_outline(draw_overlay, away_record, (away_record_x, record_y), record_font)
|
||||||
|
|
||||||
if home_record:
|
if home_record:
|
||||||
home_record_bbox = draw_overlay.textbbox((0,0), home_record, font=record_font)
|
home_record_bbox = draw_overlay.textbbox((0,0), home_record, font=record_font)
|
||||||
home_record_width = home_record_bbox[2] - home_record_bbox[0]
|
home_record_width = home_record_bbox[2] - home_record_bbox[0]
|
||||||
home_record_x = self.display_width - home_record_width - 2
|
home_record_x = self.display_width - home_record_width
|
||||||
self._draw_text_with_outline(draw_overlay, home_record, (home_record_x, record_y), record_font)
|
self._draw_text_with_outline(draw_overlay, home_record, (home_record_x, record_y), record_font)
|
||||||
|
|
||||||
# Composite and display
|
# Composite and display
|
||||||
@@ -1246,16 +1246,16 @@ class NFLUpcomingManager(BaseNFLManager): # Renamed class
|
|||||||
|
|
||||||
record_bbox = draw_overlay.textbbox((0,0), "0-0", font=record_font)
|
record_bbox = draw_overlay.textbbox((0,0), "0-0", font=record_font)
|
||||||
record_height = record_bbox[3] - record_bbox[1]
|
record_height = record_bbox[3] - record_bbox[1]
|
||||||
record_y = self.display_height - record_height - 1
|
record_y = self.display_height - record_height
|
||||||
|
|
||||||
if away_record:
|
if away_record:
|
||||||
away_record_x = 2
|
away_record_x = 0
|
||||||
self._draw_text_with_outline(draw_overlay, away_record, (away_record_x, record_y), record_font)
|
self._draw_text_with_outline(draw_overlay, away_record, (away_record_x, record_y), record_font)
|
||||||
|
|
||||||
if home_record:
|
if home_record:
|
||||||
home_record_bbox = draw_overlay.textbbox((0,0), home_record, font=record_font)
|
home_record_bbox = draw_overlay.textbbox((0,0), home_record, font=record_font)
|
||||||
home_record_width = home_record_bbox[2] - home_record_bbox[0]
|
home_record_width = home_record_bbox[2] - home_record_bbox[0]
|
||||||
home_record_x = self.display_width - home_record_width - 2
|
home_record_x = self.display_width - home_record_width
|
||||||
self._draw_text_with_outline(draw_overlay, home_record, (home_record_x, record_y), record_font)
|
self._draw_text_with_outline(draw_overlay, home_record, (home_record_x, record_y), record_font)
|
||||||
|
|
||||||
# Composite and display
|
# Composite and display
|
||||||
|
|||||||
@@ -553,7 +553,7 @@ class BaseNHLManager:
|
|||||||
text_color = (100, 255, 100) # Greenish
|
text_color = (100, 255, 100) # Greenish
|
||||||
spread_x = 2
|
spread_x = 2
|
||||||
|
|
||||||
spread_y = self.display_height - 8
|
spread_y = 0
|
||||||
self._draw_text_with_outline(draw, spread_text, (spread_x, spread_y), self.fonts['status'], fill=text_color)
|
self._draw_text_with_outline(draw, spread_text, (spread_x, spread_y), self.fonts['status'], fill=text_color)
|
||||||
|
|
||||||
# Draw records if enabled
|
# Draw records if enabled
|
||||||
@@ -568,7 +568,7 @@ class BaseNHLManager:
|
|||||||
|
|
||||||
record_bbox = draw.textbbox((0,0), "0-0", font=record_font)
|
record_bbox = draw.textbbox((0,0), "0-0", font=record_font)
|
||||||
record_height = record_bbox[3] - record_bbox[1]
|
record_height = record_bbox[3] - record_bbox[1]
|
||||||
record_y = self.display_height - record_height - 1
|
record_y = self.display_height - record_height
|
||||||
|
|
||||||
if away_record:
|
if away_record:
|
||||||
away_record_x = 2
|
away_record_x = 2
|
||||||
|
|||||||
@@ -729,12 +729,12 @@ class BaseSoccerManager:
|
|||||||
# Choose color and position based on which team has the spread
|
# Choose color and position based on which team has the spread
|
||||||
if odds.get('spread', {}).get('team') == game['home_abbr']:
|
if odds.get('spread', {}).get('team') == game['home_abbr']:
|
||||||
text_color = (255, 100, 100) # Reddish
|
text_color = (255, 100, 100) # Reddish
|
||||||
spread_x = self.display_width - draw.textlength(spread_text, font=self.fonts['status']) - 2
|
spread_x = self.display_width - draw.textlength(spread_text, font=self.fonts['status'])
|
||||||
else:
|
else:
|
||||||
text_color = (100, 255, 100) # Greenish
|
text_color = (100, 255, 100) # Greenish
|
||||||
spread_x = 2
|
spread_x = 0
|
||||||
|
|
||||||
spread_y = self.display_height - 8
|
spread_y = 0
|
||||||
self._draw_text_with_outline(draw, spread_text, (spread_x, spread_y), self.fonts['status'], fill=text_color)
|
self._draw_text_with_outline(draw, spread_text, (spread_x, spread_y), self.fonts['status'], fill=text_color)
|
||||||
|
|
||||||
# Draw records if enabled
|
# Draw records if enabled
|
||||||
@@ -749,16 +749,16 @@ class BaseSoccerManager:
|
|||||||
|
|
||||||
record_bbox = draw.textbbox((0,0), "0-0", font=record_font)
|
record_bbox = draw.textbbox((0,0), "0-0", font=record_font)
|
||||||
record_height = record_bbox[3] - record_bbox[1]
|
record_height = record_bbox[3] - record_bbox[1]
|
||||||
record_y = self.display_height - record_height - 1
|
record_y = self.display_height - record_height
|
||||||
|
|
||||||
if away_record:
|
if away_record:
|
||||||
away_record_x = 2
|
away_record_x = 0
|
||||||
self._draw_text_with_outline(draw, away_record, (away_record_x, record_y), record_font)
|
self._draw_text_with_outline(draw, away_record, (away_record_x, record_y), record_font)
|
||||||
|
|
||||||
if home_record:
|
if home_record:
|
||||||
home_record_bbox = draw.textbbox((0,0), home_record, font=record_font)
|
home_record_bbox = draw.textbbox((0,0), home_record, font=record_font)
|
||||||
home_record_width = home_record_bbox[2] - home_record_bbox[0]
|
home_record_width = home_record_bbox[2] - home_record_bbox[0]
|
||||||
home_record_x = self.display_width - home_record_width - 2
|
home_record_x = self.display_width - home_record_width
|
||||||
self._draw_text_with_outline(draw, home_record, (home_record_x, record_y), record_font)
|
self._draw_text_with_outline(draw, home_record, (home_record_x, record_y), record_font)
|
||||||
|
|
||||||
# --- Display Image ---
|
# --- Display Image ---
|
||||||
|
|||||||
Reference in New Issue
Block a user