Add tennis (ATP/WTA) support via a Live Tennis API provider - #231
Open
bensynapse wants to merge 1 commit into
Open
Add tennis (ATP/WTA) support via a Live Tennis API provider#231bensynapse wants to merge 1 commit into
bensynapse wants to merge 1 commit into
Conversation
Adds a new `providers/LiveTennisAPI.js` implementing the existing `getScores(payload, gameDate, callback)` provider contract (same shape as PWHL.js), registered in node_helper.js, with `ATP`, `WTA` and `TENNIS` league codes wired into MMM-MyScoreboard.js. The `teams` array is reused for player surnames, so no schema change is needed. Scores map to the module's existing game object: sets won go in the two score slots, the status line carries the set-by-set games, current game points (including tiebreaks) and a break-point marker, and a dot marks the server — no renderer changes. Data comes from the Live Tennis API's FREE tier (live + upcoming matches; one shared 15-minute poll, two calls per refresh). The README documents the provider, the free-tier limits (30/min, 100/day) next to the key-signup link, and that completed results are a paid surface. Disclosure: I run the Live Tennis API, so this is vendor-authored — judge accordingly. We also ship a dedicated MMM-LiveTennis module; this reaches users who want tennis inside one unified scoreboard instead of a second module. Unit tests added under tests/unit/providers/. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Follows up on #230. Adds tennis (ATP/WTA) as a league, built exactly as we discussed and PR'd against
development.Disclosure: I run the Live Tennis API, so this is vendor-authored — judge accordingly. We also ship a dedicated module, MMM-LiveTennis; this provider is for people who'd rather see tennis inside one unified MMM-MyScoreboard than run a second module. No conflict from our side.
What's here
providers/LiveTennisAPI.js— new provider implementing the samegetScores(payload, gameDate, callback)contract asPWHL.js: its ownPOLL_FREQUENCY, self-starting poll, and normalization to the module's game object. Registered innode_helper.js.ATP,WTA, andTENNIS(all tours) added tosupportedLeaguesinMMM-MyScoreboard.js.teamsarray is reused for player surnames (teams: ['Alcaraz', 'Djokovic']), matched case-insensitively against both players. Omit it for the full slate.6-4 3-6 2-1), current game points (40-30, orTB 5-3in a tiebreak), and aBPmarker on break point; a•marks the server.Tennis (ATP / WTA / TENNIS)section documents setup, the surname convention, and the API caveats.API and the honest limits (documented in the README)
GET /matches?status=liveand?status=upcoming, keyed withX-API-Key. One shared 15-minute poll spends two calls per refresh regardless of how many tennis leagues you follow (one cache feeds them all) — ~96 calls/day, inside the free 100/day (also 30/min).Config example
Checks
npm run lint— clean.npm run test:unit— 129 pass, including a newtests/unit/providers/LiveTennisAPI.test.js(18 subtests: fetch/combine, tour & surname filtering, set/tiebreak/break-point formatting, error handling).Nothing touches the other sports' code paths. Happy to adjust naming, the serving/BP presentation, or anything else to fit your conventions. I can send you a free key to test against a live slate — just say where.