Files

26 lines
1.1 KiB
Markdown

# teamidmatcher — Team ID Mapping
Maintains a bi-directional mapping between Tippliga (phpBB) team IDs and API-Football team IDs. Uses a Guava `HashBiMap` loaded from `Team_ID_Matcher_Config.json`.
## Classes
### TeamIDMatcher
Singleton `HashBiMap<Integer, Integer>` mapping Tippliga IDs ↔ API-Football IDs.
- `getApiFootballIdFromTippligaId(id)` — Tippliga → API-Football
- `getTippligaIdFromApiFootballId(match, homeguest)` — API-Football → Tippliga, for a given match and team side
- `getTeamNameFromTippligaId(id)` — human-readable team name
Sets `StatusHolder.setError()` if a lookup fails. Used by `TLWMatch`, `TLWMatchesUpdaterFootball`, `TLWMatchesResultsUpdater`.
Config format (`Team_ID_Matcher_Config.json`):
```json
[
{ "tippligaID": 1, "teamname": "Team Name", "apiFootballID": 12345 },
...
]
```
### TeamIDMatcherTemplateCreator
Utility that fetches teams from API-Football for a given league and generates a JSON config template. Useful when setting up new seasons — outputs skeleton entries with `apiFootballID` pre-filled, `tippligaID` left blank.