Commit 64a3ee4
feat(lacrosse): add NCAA men's and women's lacrosse scoreboard plugin (#91)
* feat(lacrosse): add NCAA men's and women's lacrosse scoreboard plugin
New plugin providing live, recent, and upcoming NCAA Division I men's
and women's lacrosse games via the ESPN public API, modeled on the
hockey scoreboard plugin.
Features:
- NCAA Men's and Women's lacrosse (ESPN `mens-college-lacrosse` and
`womens-college-lacrosse` endpoints)
- Live games with quarter, clock, and score (Q1-Q4, OT1+)
- Recent and upcoming game modes with records
- Favorite-team filtering, with dynamic `NCAA_MENS_TOP_5/10/20` and
`NCAA_WOMENS_TOP_5/10/25` shortcuts that resolve against the live
Inside Lacrosse / IWLCA poll feeds
- Poll rank overlays on live/recent/upcoming game cards
- Per-mode switch vs. scroll display style
- Live priority, configurable durations, update intervals, and game
counts per league
- Standalone smoke test (`test_lacrosse_plugin.py`) exercising imports,
dynamic team resolution, and real-data extraction for both leagues
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix(lacrosse): address PR review findings
Bumps to 1.0.2 with fixes across the plugin based on PR #91 review:
- dynamic_team_resolver: per-token TTL instead of a single shared
timestamp, so fetching one poll doesn't extend the apparent freshness
of unrelated cached tokens
- game_renderer: use ImageFont.load (not ImageFont.truetype) for BDF
bitmap fonts, with a warning + fallback on failure
- logo_downloader: replace bare except on font load with
except (OSError, IOError) + debug log; add explicit Optional[str]
annotation on logo_url
- ncaam/ncaaw managers: remove unused _processed_games_cache,
_shared_data, _no_data_warning_logged and related class attrs that
were dead cruft from the hockey template; guard
len(result.data.get('events')) against None in the fetch callback
- ncaam/ncaaw managers + manager adapter: use plain "live"/"recent"
/"upcoming" display-mode keys consistently between the config schema,
the config adapter, and the league managers (previously the adapter
wrote "lacrosse_*" keys, which worked but was confusing)
- lacrosse: extract _get_team_display_text helper to deduplicate the
rank-vs-record logic; use game.get("odds") instead of the redundant
membership+truthy guard; rename unused `situation` to `_situation`;
explicit `return None`
- scroll_display: collapse NCAAM/NCAAW lacrosse separator icon
constants into a single NCAA_LACROSSE_SEPARATOR_ICON since ESPN ships
one shared NCAA lacrosse mark
- config_schema: unify update_intervals.base.maximum to 900 across
both NCAA men's and women's blocks (was 600 vs 900)
- test_lacrosse_plugin: compute the scoreboard date window from the
current calendar year so the test doesn't go stale next season; skip
(instead of fail) when the ESPN feed is unreachable by recognising
requests.exceptions.RequestException and a sentinel
_NetworkUnavailable exception
Rejected findings (matching repo convention or not actual bugs):
- LICENSE short notice: all 4 sibling sport plugins ship the same
17-line notice; fixing here would introduce inconsistency
- User-Agent placeholder: identical across hockey/football/basketball
- Pillow>=9.0.0: matches hockey; security bump should be repo-wide
- README show_records/show_ranking example "conflict": the schema
defaults are actually True, so the example already matches
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix(lacrosse): address second round of PR review findings
Bumps to 1.0.3 with correctness fixes and a refactor pass based on the
second review:
- game_renderer: mirror normalized status['clock'] into
status['display_clock'] and fall back between the two keys in the
live status renderer so flat payloads render the clock correctly;
drop the external pytz dependency in the upcoming-game start-time
fallback in favor of stdlib datetime.timezone.utc
- lacrosse.py: wrap the shot-totals font load in a try/except that
falls back to ImageFont.load_default(), matching the record-font
pattern; make _test_mode_update resilient to empty/malformed clock
strings via try/except around the MM:SS split
- logo_downloader: download_missing_logo now returns False (not True)
when it falls back to creating a placeholder, matching the docstring
contract; the sole caller in sports.py discards the return value so
this is behavior-compatible for existing callers
- scroll_display: when loading separator icons, register the generic
NCAA.png fallback under the lacrosse league keys so lookups for
"ncaam_lacrosse" / "ncaaw_lacrosse" fall through to it when
ncaa_lacrosse.png is missing; switch the registration loop to
setdefault() so sport-specific icons always win over the generic
fallback regardless of iteration order
- test_lacrosse_plugin: detect partial network outages in the rankings
resolver test — if either endpoint returns an empty list, raise
_NetworkUnavailable with a per-endpoint message instead of failing
the whole test
- lacrosse.py + ncaam/ncaaw managers: extract the duplicated
_fetch_ncaa_lacrosse_api_data body into a shared
Lacrosse._fetch_season_schedule helper parameterized by sport key,
cache prefix, URL, and season window; both manager modules now call
it through thin wrappers
- ncaam/ncaaw managers: replace the isinstance(self, *LiveManager)
routing in _fetch_data with a polymorphic override on the Live
subclass; base _fetch_data returns the season schedule, Live
subclass overrides to call _fetch_todays_games()
Rejected findings:
- logo_downloader User-Agent placeholder (again): matches all four
sibling sport plugins verbatim; this is repo convention, not a
single-plugin issue
- dynamic_team_resolver per-instance cache: the class-level cache is
intentional to share fetched rankings across the six resolver
instances in the plugin's lifecycle; moving it to __init__ would
multiply ESPN API calls for no benefit. The per-token TTL bug that
matters was already fixed in 1.0.2.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Chuck <chuck@example.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 411d968 commit 64a3ee4
18 files changed
Lines changed: 9911 additions & 1 deletion
File tree
- plugins/lacrosse-scoreboard
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
717 | 717 | | |
718 | 718 | | |
719 | 719 | | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
720 | 743 | | |
721 | 744 | | |
722 | 745 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
0 commit comments