Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,10 @@
"plugin_path": "plugins/baseball-scoreboard",
"stars": 0,
"downloads": 0,
"last_updated": "2026-02-12",
"last_updated": "2026-02-14",
"verified": true,
"screenshot": "",
"latest_version": "1.0.5"
"latest_version": "1.3.0"
},
{
"id": "soccer-scoreboard",
Expand Down
420 changes: 311 additions & 109 deletions plugins/baseball-scoreboard/game_renderer.py

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions plugins/baseball-scoreboard/logo_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@

from PIL import Image

# Pillow compatibility: Image.Resampling.LANCZOS is available in Pillow >= 9.1
try:
RESAMPLE_FILTER = Image.Resampling.LANCZOS
except AttributeError:
RESAMPLE_FILTER = Image.LANCZOS

try:
from src.logo_downloader import LogoDownloader, download_missing_logo
except ImportError:
Expand Down Expand Up @@ -105,19 +111,16 @@ def load_logo(self, team_id: str, team_abbr: str, logo_path: Path,

# Only try to open the logo if the file exists
if os.path.exists(actual_logo_path):
logo = Image.open(actual_logo_path)
with Image.open(actual_logo_path) as src:
logo = src.convert('RGBA')
else:
self.logger.error(f"Logo file still doesn't exist at {actual_logo_path} after download attempt")
return None

# Ensure RGBA mode
if logo.mode != 'RGBA':
logo = logo.convert('RGBA')

# Resize to fit display (130% of display dimensions to allow extending off screen)
max_width = int(self.display_width * 1.5)
max_height = int(self.display_height * 1.5)
logo.thumbnail((max_width, max_height), Image.Resampling.LANCZOS)
logo.thumbnail((max_width, max_height), RESAMPLE_FILTER)

# Cache the logo
self._logo_cache[team_abbr] = logo
Expand Down Expand Up @@ -149,19 +152,16 @@ def load_milb_logo(self, team_abbr: str, logo_dir: Path) -> Optional[Image.Image
logo_path = logo_dir / f"{team_abbr}.png"

if logo_path.exists():
logo = Image.open(logo_path)
with Image.open(logo_path) as src:
logo = src.convert('RGBA')
else:
self.logger.warning(f"MiLB logo not found for {team_abbr} at {logo_path}")
return None

# Ensure RGBA mode
if logo.mode != 'RGBA':
logo = logo.convert('RGBA')

# Resize to fit display (130% of display dimensions)
max_width = int(self.display_width * 1.5)
max_height = int(self.display_height * 1.5)
logo.thumbnail((max_width, max_height), Image.Resampling.LANCZOS)
logo.thumbnail((max_width, max_height), RESAMPLE_FILTER)

# Cache the logo
self._logo_cache[team_abbr] = logo
Expand Down
Loading