add channel logo for odds_ticker_manager
BIN
assets/broadcast_logos/abc.png
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
assets/broadcast_logos/accn.png
Normal file
|
After Width: | Height: | Size: 6.6 KiB |
BIN
assets/broadcast_logos/btn.png
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
BIN
assets/broadcast_logos/cbs.png
Normal file
|
After Width: | Height: | Size: 9.1 KiB |
BIN
assets/broadcast_logos/cbssn.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
assets/broadcast_logos/espn-sec-us.png
Normal file
|
After Width: | Height: | Size: 86 KiB |
BIN
assets/broadcast_logos/espn.png
Normal file
|
After Width: | Height: | Size: 4.0 KiB |
BIN
assets/broadcast_logos/espn2.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
assets/broadcast_logos/espn3.png
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
BIN
assets/broadcast_logos/espnu.png
Normal file
|
After Width: | Height: | Size: 6.5 KiB |
BIN
assets/broadcast_logos/fox.png
Normal file
|
After Width: | Height: | Size: 92 KiB |
BIN
assets/broadcast_logos/fs1.png
Normal file
|
After Width: | Height: | Size: 7.9 KiB |
BIN
assets/broadcast_logos/fs2.png
Normal file
|
After Width: | Height: | Size: 8.0 KiB |
BIN
assets/broadcast_logos/mlbn.png
Normal file
|
After Width: | Height: | Size: 41 KiB |
BIN
assets/broadcast_logos/nbc.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
assets/broadcast_logos/nfln.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
assets/broadcast_logos/pac12n.png
Normal file
|
After Width: | Height: | Size: 82 KiB |
BIN
assets/broadcast_logos/tbs.png
Normal file
|
After Width: | Height: | Size: 60 KiB |
BIN
assets/broadcast_logos/tnt.png
Normal file
|
After Width: | Height: | Size: 6.0 KiB |
BIN
assets/broadcast_logos/tru.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
@@ -259,6 +259,13 @@ class OddsTickerManager:
|
|||||||
away_abbr = away_team['team']['abbreviation']
|
away_abbr = away_team['team']['abbreviation']
|
||||||
home_name = home_team['team'].get('name', home_abbr)
|
home_name = home_team['team'].get('name', home_abbr)
|
||||||
away_name = away_team['team'].get('name', away_abbr)
|
away_name = away_team['team'].get('name', away_abbr)
|
||||||
|
|
||||||
|
broadcast_info = ""
|
||||||
|
broadcasts = event.get('competitions', [{}])[0].get('broadcasts', [])
|
||||||
|
if broadcasts:
|
||||||
|
broadcast_info = broadcasts[0].get('media', {}).get('shortName', "")
|
||||||
|
logger.info(f"Found broadcast info for game {game_id}: {broadcast_info}")
|
||||||
|
|
||||||
# Only process favorite teams if enabled
|
# Only process favorite teams if enabled
|
||||||
if self.show_favorite_teams_only:
|
if self.show_favorite_teams_only:
|
||||||
if not favorite_teams:
|
if not favorite_teams:
|
||||||
@@ -294,6 +301,7 @@ class OddsTickerManager:
|
|||||||
'home_record': home_record,
|
'home_record': home_record,
|
||||||
'away_record': away_record,
|
'away_record': away_record,
|
||||||
'odds': odds_data if has_odds else None,
|
'odds': odds_data if has_odds else None,
|
||||||
|
'broadcast_info': broadcast_info,
|
||||||
'logo_dir': league_config.get('logo_dir', f'assets/sports/{league.lower()}_logos')
|
'logo_dir': league_config.get('logo_dir', f'assets/sports/{league.lower()}_logos')
|
||||||
}
|
}
|
||||||
all_games.append(game)
|
all_games.append(game)
|
||||||
@@ -402,11 +410,14 @@ class OddsTickerManager:
|
|||||||
# Get team logos
|
# Get team logos
|
||||||
home_logo = self._get_team_logo(game['home_team'], game['logo_dir'])
|
home_logo = self._get_team_logo(game['home_team'], game['logo_dir'])
|
||||||
away_logo = self._get_team_logo(game['away_team'], game['logo_dir'])
|
away_logo = self._get_team_logo(game['away_team'], game['logo_dir'])
|
||||||
|
broadcast_logo = self._get_team_logo(game.get('broadcast_info', ''), 'assets/broadcast_logos')
|
||||||
|
|
||||||
if home_logo:
|
if home_logo:
|
||||||
home_logo = home_logo.resize((logo_size, logo_size), Image.Resampling.LANCZOS)
|
home_logo = home_logo.resize((logo_size, logo_size), Image.Resampling.LANCZOS)
|
||||||
if away_logo:
|
if away_logo:
|
||||||
away_logo = away_logo.resize((logo_size, logo_size), Image.Resampling.LANCZOS)
|
away_logo = away_logo.resize((logo_size, logo_size), Image.Resampling.LANCZOS)
|
||||||
|
if broadcast_logo:
|
||||||
|
broadcast_logo = broadcast_logo.resize((logo_size, logo_size), Image.Resampling.LANCZOS)
|
||||||
|
|
||||||
# Create a temporary draw object to measure text
|
# Create a temporary draw object to measure text
|
||||||
temp_draw = ImageDraw.Draw(Image.new('RGB', (1, 1)))
|
temp_draw = ImageDraw.Draw(Image.new('RGB', (1, 1)))
|
||||||
@@ -445,6 +456,9 @@ class OddsTickerManager:
|
|||||||
date_width = int(temp_draw.textlength(date_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))
|
time_width = int(temp_draw.textlength(time_text, font=datetime_font))
|
||||||
datetime_col_width = max(day_width, date_width, time_width)
|
datetime_col_width = max(day_width, date_width, time_width)
|
||||||
|
if broadcast_logo:
|
||||||
|
datetime_col_width = max(datetime_col_width, broadcast_logo.width)
|
||||||
|
|
||||||
|
|
||||||
# Odds text
|
# Odds text
|
||||||
odds = game.get('odds') or {}
|
odds = game.get('odds') or {}
|
||||||
@@ -549,6 +563,10 @@ class OddsTickerManager:
|
|||||||
draw.text((current_x, date_y), date_text, font=datetime_font, fill=(255, 255, 255))
|
draw.text((current_x, date_y), date_text, font=datetime_font, fill=(255, 255, 255))
|
||||||
draw.text((current_x, time_y), time_text, font=datetime_font, fill=(255, 255, 255))
|
draw.text((current_x, time_y), time_text, font=datetime_font, fill=(255, 255, 255))
|
||||||
|
|
||||||
|
if broadcast_logo:
|
||||||
|
broadcast_y = time_y + datetime_font_height + 2
|
||||||
|
image.paste(broadcast_logo, (int(current_x), broadcast_y), broadcast_logo if broadcast_logo.mode == 'RGBA' else None)
|
||||||
|
|
||||||
return image
|
return image
|
||||||
|
|
||||||
def _create_ticker_image(self):
|
def _create_ticker_image(self):
|
||||||
|
|||||||