Add ATP/WTA tennis provider (Live Tennis API) — issue #230 - #232
Open
bensynapse wants to merge 1 commit into
Open
Add ATP/WTA tennis provider (Live Tennis API) — issue #230#232bensynapse wants to merge 1 commit into
bensynapse wants to merge 1 commit into
Conversation
Adds a new providers/LiveTennisAPI.js following the existing CPL/PWHL provider conventions: a shared-cache poller that normalizes matches into the module's game object (hTeam/vTeam/hScore/vScore/status/gameMode) and serves every configured tennis league from one cache. Registers the provider in node_helper.js and adds ATP and WTA to the league map in MMM-MyScoreboard.js. No other sport/provider is touched. Tennis is player-based, so the existing `teams` array holds player surnames. The big score is sets won; the status line carries the set-by-set games, current points and the serving player, so no renderer changes are needed. The API key is read server-side only from LIVETENNIS_API_KEY and never sent to the browser. README documents setup and the free tier's 100 requests/day cap, including how to stay inside it via LIVETENNIS_POLL_INTERVAL. Adds unit tests for normalization, sets-won logic, polling and filtering. 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.
Implements the tennis provider proposed in #230, targeting
developmentas requested.Disclosure: this provider is contributed by the Live Tennis API team (we run https://livetennisapi.com) — vendor-authored, so please judge it on the merits. The README section says the same up front.
What this adds
providers/LiveTennisAPI.js— a new provider following the existingCPL.js/PWHL.jsconventions: a singleton shared-cache poller (POLL_FREQUENCY,startDataPoll,getData) that normalizes each match into the module's existing game object (hTeam/vTeam/hTeamLong/vTeamLong/hScore/vScore/status/gameMode) and returns via the samegetScores(payload, gameDate, callback)contract as PWHL (callback(games, sortIdx, noGamesToday)).node_helper.js— registers the provider (one line, alongside CPL/PWHL).MMM-MyScoreboard.js— addsATPandWTAto the league map. Nothing else changes; no other sport or provider is modified.README.md— adds ATP/WTA to the leagues list and a "Tennis (ATP / WTA)" section covering config, the API key, and the rate limits.package.json— adds Tennis/ATP/WTA keywords.tests/unit/providers/LiveTennisAPI.test.js(12 tests).Design (per the two questions in #230)
teamsarray holds player surnames (teams: ["Alcaraz", "Gauff"]). No schema change. Omitteamsto show the whole tour slate.6-4 3-6 2-1), current points and the serving player go in the existingstatusline. Players map to the home/visitor slots and the leagues sethomeTeamFirst, so it renders "Player 1 vs Player 2".API key & rate limits (documented in the README)
LIVETENNIS_API_KEYenvironment variable and is never sent to the browser.LIVETENNIS_POLL_INTERVAL(minutes) lets a free key stay inside the cap (e.g. 45 min ≈ 96/day for one tour). A free key: https://livetennisapi.com/subscribe/freeChecks
eslintclean across the whole repo (matches the module's@stylisticconfig).node --checkpasses on all touched JS.test:e2ehere (it downloads a MagicMirror bootstrap + Chromium); happy to iterate if CI surfaces anything.I don't follow racquet sports either, so I've kept this self-contained and additive — glad to adjust naming (e.g. a combined
TENNISleague) or rendering to your preference.