63 lines
1.6 KiB
Python
63 lines
1.6 KiB
Python
import json
|
|
from datetime import datetime
|
|
from pathlib import Path
|
|
|
|
import pytz
|
|
|
|
TZ = pytz.timezone("America/New_York")
|
|
|
|
now = datetime.now(TZ)
|
|
|
|
UA = (
|
|
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
|
|
"AppleWebKit/537.36 (KHTML, like Gecko) "
|
|
"Chrome/134.0.0.0 Safari/537.36 Edg/134.0.0.0"
|
|
)
|
|
|
|
live_img = "https://i.gyazo.com/978f2eb4a199ca5b56b447aded0cb9e3.png"
|
|
|
|
leagues_file = Path(__file__).parent / "leagues.json"
|
|
|
|
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
|
|
|
|
for base, aliases in alias_map.items():
|
|
for alias in aliases:
|
|
LEAGUES[alias] = LEAGUES[base]
|
|
|
|
|
|
def league_info(name: str) -> dict:
|
|
return LEAGUES.get(name, LEAGUES["default"])
|