Skip to content

fix(football): NCAA and NFL teams sharing an abbreviation swap logos - #472

Merged
ChuckBuilds merged 1 commit into
mainfrom
fix/football-logo-cache-league-scope
Sep 8, 2026
Merged

fix(football): NCAA and NFL teams sharing an abbreviation swap logos#472
ChuckBuilds merged 1 commit into
mainfrom
fix/football-logo-cache-league-scope

Conversation

@ChuckBuilds

Copy link
Copy Markdown
Owner

Reported: the NCAA Football Recent card for Miami vs Stanford drew the Dolphins badge instead of the Hurricanes.

Cause

NCAA and NFL share ten abbreviations, and their logos live in different directories:

CAR CIN DAL DEN HOU LAC MIA NE TB TBD

ncaa_logos/MIA.png is the Hurricanes. nfl_logos/MIA.png is the Dolphins. Both correct on disk — I pulled and looked at them.

_logo_cache_key scopes by logo slot size only:

returnf"{name}@{self._logo_slot_width()}x{self.display_height}"

and one _logo_cache is shared by every renderer this plugin builds — manager.py creates a single ScrollDisplayManager, and prepare_scroll_content(games, game_type, leagues, …) takes leagues plural, so one strip carries both. Both leagues resolved MIA to MIA@40x64, and whichever rendered first won the slot.

Fix

Scoped on the logo directory rather than the league string. That is what actually decides which file gets opened, it is already in hand wherever a logo is loaded, and two teams sharing an abbreviation within one directory really are the same team — so the cache does not fragment and re-decode the same PNG per card.

basketball-scoreboard and lacrosse-scoreboard already prefix the name for this reason (f"{league}:{abbr}" and f"{league}_{abbr}"); this follows them rather than inventing a third convention. nrl and afl are single-league, and every soccer_* league maps to one soccer_logos directory, so neither collides.

Test

test_logo_cache_league_scope.py writes two real PNGs in different colours, loads both through the real _load_and_resize_logo, and checks the colour that comes back. Against the unfixed code:

FAIL the NCAA card draws the NCAA logo, not the NFL one
drew (0, 133, 122), expected (240, 130, 0)
FAIL the two leagues occupy separate cache entries
1 entry: [MIA@40x64]

It also checks all ten colliding abbreviations, that the slot size is still in the key, that one directory still shares a single entry, and that a missing path does not raise on the render thread.

Scope — please read

This is the scroll and Vegas path. I could not reproduce it in switch mode, which is what the report described.

Switch mode goes through sports.py, whose _logo_cache is per-league-manager, so it does not collide. On the rig I checked end to end:

Logo directory: .../assets/sports/ncaa_logos (ncaa_fb managers)
Logo directory: .../assets/sports/nfl_logos (nfl managers)
ncaa_fb -> ncaa_logos/MIA.png 300x300 md5 92349b4c7585 (Hurricanes)
nfl -> nfl_logos/MIA.png 480x480 md5 6ca31ff5bf51 (Dolphins)

So a switch-mode sighting is more likely a wrong file on that particular device than this bug. Worth checking on the affected display:

md5sum ~/LEDMatrix/assets/sports/ncaa_logos/MIA.png
# 92349b4c7585a70dd4a5fe16e35c0e9a = correct (Hurricanes)

If it differs, delete it and let the downloader refetch. I could not reach ledpi or devpi to check them.

42 plugin tests pass, safety harness clean at all 8 sizes, repo guards pass. Manifest 3.5.3 → 3.5.4.

🤖 Generated with Claude Code

https://claude.ai/code/session_014RRtqXDCnvnY6EQwhT5CV9

NCAA and NFL share ten abbreviations -- CAR CIN DAL DEN HOU LAC MIA NE TB
TBD -- and their logos live in different directories. ncaa_logos/MIA.png
is the Hurricanes; nfl_logos/MIA.png is the Dolphins.
_logo_cache_key scopes by logo slot size only, and one _logo_cache is
shared by every renderer this plugin builds: manager.py creates a single
ScrollDisplayManager, and prepare_scroll_content takes `leagues` plural,
so one strip carries both. Both leagues therefore resolved "MIA" to
MIA@40x64 and whichever rendered first won the slot.
Scoped on the logo directory rather than the league string. That is what
actually decides which file gets opened, it is already in hand wherever a
logo is loaded, and two teams sharing an abbreviation within one
directory really are the same team -- so the cache does not fragment and
re-decode the same PNG per card. basketball-scoreboard and
lacrosse-scoreboard already prefix the name for this reason
(f"{league}:{abbr}" / f"{league}_{abbr}"); this follows them.
test_logo_cache_league_scope.py loads two real files through
_load_and_resize_logo and checks the colour that comes back. Against the
unfixed code:
FAIL the NCAA card draws the NCAA logo, not the NFL one
drew (0, 133, 122), expected (240, 130, 0)
FAIL the two leagues occupy separate cache entries
1 entry: ['MIA@40x64']
Scope, for the record. This is the scroll and Vegas path. I could not
reproduce it in switch mode: that path goes through sports.py, whose
_logo_cache is per-league-manager, and on a rig I checked end to end the
directories resolve correctly (ncaa_fb -> ncaa_logos, nfl -> nfl_logos)
and both MIA.png files are the right badge. A switch-mode sighting is
more likely a wrong file on that device than this bug.
42 plugin tests pass, harness clean at all 8 sizes, repo guards pass.
Manifest 3.5.3 -> 3.5.4.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014RRtqXDCnvnY6EQwhT5CV9
@coderabbitai

Copy link
Copy Markdown
Contributor

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 3b3bc172-1d88-4104-9a8f-330204f5b041


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics20 complexity

MetricResults
Complexity20

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@ChuckBuilds
ChuckBuilds merged commit a092e37 into mainSep 8, 2026
4 checks passed
@ChuckBuilds
ChuckBuilds deleted the fix/football-logo-cache-league-scope branch September 8, 2026 15:49
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@ChuckBuilds@claude