fix(logos): register NCAA lacrosse in logo downloader#308
Merged
ChuckBuilds merged 1 commit intomainfrom Apr 8, 2026
Merged
Conversation
The lacrosse-scoreboard plugin renders broken on hardware: school
logos never appear, and SportsRecent/SportsUpcoming
_draw_scorebug_layout() falls into its "Logo Error" fallback
branch instead of drawing the normal logo-centric scorebug.
Root cause: src/logo_downloader.py LOGO_DIRECTORIES and
API_ENDPOINTS were missing entries for ncaam_lacrosse and
ncaaw_lacrosse, even though the plugin's manager files set those
exact sport_key values (ncaam_lacrosse_managers.py:29,
ncaaw_lacrosse_managers.py:29). The plugin's vendored sports.py
asks the main LogoDownloader to resolve sport_key →
on-disk directory the same way every other sports plugin does
(football, basketball, baseball, hockey), and
get_logo_directory() fell through to the safe fallback
f'assets/sports/{league}_logos' = 'assets/sports/ncaam_lacrosse_logos',
a directory that does not exist. Logo loads then failed for
every team and the scorebug layout collapsed to "Logo Error".
Adding the two lacrosse rows (and the missing ncaaw_hockey row
in API_ENDPOINTS, while we're here) makes lacrosse a first-class
peer to the other NCAA sports — same shared assets/sports/ncaa_logos
directory, same canonical ESPN team-list endpoint pattern. No
plugin-side change is needed because the plugin already imports
the main LogoDownloader.
Existing NCAA football/hockey schools that also play lacrosse
(DUKE, UVA, MD, NAVY, ARMY, YALE, SYR, …) get picked up
immediately on first render. Lacrosse-specific schools (JHU,
Loyola, Princeton, Cornell, Stony Brook, …) lazily download
into the shared directory via download_missing_logo() the first
time they appear in a scoreboard payload — verified locally
with both the team_id fallback path (ESPN sports.core.api) and
the direct logo_url path used by the plugin at runtime.
Verification (all from a clean clone):
python3 -c "
from src.logo_downloader import LogoDownloader
d = LogoDownloader()
for k in ('ncaam_lacrosse','ncaaw_lacrosse','ncaam_hockey','ncaaw_hockey'):
print(k, '->', d.get_logo_directory(k))
"
# All four print .../assets/sports/ncaa_logos
python3 -c "
from pathlib import Path
from src.logo_downloader import download_missing_logo
ok = download_missing_logo(
'ncaam_lacrosse', team_id='120', team_abbreviation='JHU',
logo_path=Path('assets/sports/ncaa_logos/_jhu_test.png'),
logo_url='https://a.espncdn.com/i/teamlogos/ncaa/500/120.png',
)
print('downloaded:', ok) # True, ~40KB PNG
"
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughExtends the LogoDownloader class with three new NCAA league API endpoint mappings for women's hockey and men's and women's lacrosse, along with logo directory configurations for the lacrosse leagues to support additional sports data resolution. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the lacrosse-scoreboard plugin's "missing layout + missing
school logos" symptom on hardware. Single-file change in
`src/logo_downloader.py` adds two NCAA lacrosse rows (and one
missing women's hockey row) to the canonical sport_key registry.
Root cause
The lacrosse-scoreboard plugin renders broken on the LED matrix:
school logos never appear, and the scoreboard collapses to a tiny
"Logo Error" text instead of the normal logo-centric scorebug
that hockey, basketball, football, and baseball all draw.
Tracing the rendering pipeline shows the apparent
"two issues" (no layout + no logos) are one bug:
`ncaaw_lacrosse_managers.py:29` set
`sport_key="ncaam_lacrosse"` / `"ncaaw_lacrosse"` —
matching the same naming pattern hockey uses
(`ncaam_hockey`, `ncaaw_hockey`).
`src/logo_downloader.py`:
`MainLogoDownloader().get_logo_directory(sport_key)` to
resolve where logo PNGs live on disk — exactly the same
pattern every other sports plugin uses.
`ncaaw_lacrosse`. `get_logo_directory()` fell through at
line 165 to the safe fallback
`f'assets/sports/{league}_logos'` =
`assets/sports/ncaam_lacrosse_logos`, a directory that does
not exist and is not the shared `ncaa_logos/` directory
where every other NCAA sport stores its logos.
`_load_and_resize_logo()` call returned `None`. Both
`SportsRecent._draw_scorebug_layout()` (line 1191) and
`SportsUpcoming._draw_scorebug_layout()` (line 1698) bail out
on missing logos and draw the literal text "Logo Error"
before returning. That is the user-visible symptom.
The plugin's `sports.py` is otherwise nearly identical to
hockey's (a `diff` shows only 3 lines different — all about
`period >= 4` for lacrosse quarters vs `period >= 3` for
hockey periods). The layout code is fine; it just never gets
executed because logo loading fails first.
Pattern verification
Every sports plugin in `ledmatrix-plugins/plugins/` follows the
same vendored architecture and resolves `sport_key` through the
main `LogoDownloader`. Every NCAA `sport_key` was already in
`LOGO_DIRECTORIES` — except lacrosse:
Changes
`src/logo_downloader.py` only:
and (drive-by) `ncaaw_hockey` — the women's hockey entry was
already in `LOGO_DIRECTORIES` but its corresponding ESPN URL
was missing, leaving `fetch_teams_data('ncaaw_hockey')`
silently broken.
`ncaaw_lacrosse` pointing at the existing shared
`assets/sports/ncaa_logos` directory.
5 lines added, 0 removed. No structural changes, no plugin-side
edits, no version bumps, no asset commits.
Why no plugin-side change
The plugin's `sports.py` already imports the main
`LogoDownloader` and asks it to resolve the directory. Once
the registry has the right answer, every sport plugin (current
and future) gets it for free. This is the canonical pattern —
adding lacrosse here makes it a first-class peer.
Why no prefetch script
Existing NCAA football/hockey schools that also play lacrosse
(DUKE, UVA, MD, NAVY, ARMY, YALE, SYR, …) are already
present in `assets/sports/ncaa_logos/` and get picked up
immediately on first render with zero downloads. Lacrosse-only
schools (JHU, Loyola, Princeton, Cornell, Stony Brook, …)
download lazily into the shared directory the first time they
appear in an ESPN scoreboard payload, via the existing
`download_missing_logo(logo_url=…)` path the plugin already
exercises at runtime.
Verification done locally
Directory resolution (no network):
```
ncaam_lacrosse -> .../assets/sports/ncaa_logos
ncaaw_lacrosse -> .../assets/sports/ncaa_logos
ncaam_hockey -> .../assets/sports/ncaa_logos
ncaaw_hockey -> .../assets/sports/ncaa_logos
```
All four collapse to the shared NCAA directory.
Lazy single-team download with a real ESPN logo URL
(Johns Hopkins, team_id=120):
```
downloaded: True | exists: True | size: 40787
```
Real PNG (~40KB), saved to `assets/sports/ncaa_logos/`,
then cleaned up.
Test plan
favorite team
(home/away logos at the edges, score in the center,
period/clock on top, records at the bottom) instead of the
"Logo Error" fallback
isn't already in `ncaa_logos/` from the football days
(e.g. JHU, Loyola, Princeton, Cornell) — proving the lazy
download path is now live
`Logo directory for sport_key='ncaam_lacrosse': …/ncaa_logos`
(the existing INFO log at `sports.py:75`) instead of the
old `…/ncaam_lacrosse_logos` fallback path
Out of scope
download covers it)
`sports.py` / `game_renderer.py` in favor of the main
`src/base_classes/` (hockey doesn't either; that's a separate
architectural cleanup)
surfaced while verifying the pattern — same shape of bug, but
separate report
🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes