e
This commit is contained in:
parent
5a61e2a8d5
commit
00000d9db0
11 changed files with 809 additions and 162 deletions
|
|
@ -22,42 +22,15 @@ LEAGUES: dict[str, dict[str, str]] = json.loads(
|
|||
leagues_file.read_text(encoding="utf-8")
|
||||
)
|
||||
|
||||
alias_map = {
|
||||
"Bundesliga": ["German Bundesliga", "Bundeslig"],
|
||||
"F1": ["Formula 1", "Formula One"],
|
||||
"La Liga": ["Spanish La Liga", "Laliga"],
|
||||
"MLB": ["Major League Baseball", "Baseball"],
|
||||
"MLS": ["Major League Soccer"],
|
||||
"Moto GP": ["MotoGP"],
|
||||
"NCAA": ["CBB", "CFB", "NCAAB", "NCAAF"],
|
||||
"NFL": ["American Football", "USA NFL"],
|
||||
"Premier League": ["EPL"],
|
||||
"Primeira Liga": ["Liga Portugal"],
|
||||
"Racing": ["Motorsports", "Motorsport"],
|
||||
"Soccer": [
|
||||
"Eredivisie",
|
||||
"FA WSL",
|
||||
"Football",
|
||||
"Liga I",
|
||||
"Liga Profesional Argentina",
|
||||
"Ligue 2",
|
||||
"NWSL",
|
||||
"UEFA Europa League",
|
||||
"World Cup",
|
||||
"World Cup Qualifiers",
|
||||
],
|
||||
"UEFA Champions League": ["Champions League", "UCL"],
|
||||
"WNBA": ["NBA W"],
|
||||
}
|
||||
|
||||
for k, v in LEAGUES.items():
|
||||
if not v["logo"]:
|
||||
LEAGUES[k]["logo"] = live_img
|
||||
def league_info(name: str) -> tuple[str | None, str]:
|
||||
league_name_map: dict[str, tuple[str, str]] = {
|
||||
league_name: (tvg_id, league_data.get("logo"))
|
||||
for tvg_id, leagues in LEAGUES.items()
|
||||
for league_entry in leagues
|
||||
for league_name, league_data in league_entry.items()
|
||||
}
|
||||
|
||||
for base, aliases in alias_map.items():
|
||||
for alias in aliases:
|
||||
LEAGUES[alias] = LEAGUES[base]
|
||||
tvg_id, logo = league_name_map.get(name, (None, None))
|
||||
|
||||
|
||||
def league_info(name: str) -> dict:
|
||||
return LEAGUES.get(name, LEAGUES["default"])
|
||||
return tvg_id, logo or live_img
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue