diff --git a/get_data.py b/get_data.py index becb136..5da5ad6 100644 --- a/get_data.py +++ b/get_data.py @@ -560,18 +560,18 @@ async def game(): @app.get("/status.json") async def status(request: Request): def color_for_status(status_value: str) -> str: - """Подбор цвета для статуса""" + """Подбор текстового цвета для статуса""" status_value = str(status_value).lower() if status_value in ["ok", "success", "live", "live_soon", "online"]: - return "🟢" + return "green" elif status_value in ["scheduled", "today_not_started", "upcoming"]: - return "🟡" + return "yellow" elif status_value in ["result", "resultconfirmed", "finished", "finished_today"]: - return "🔴" + return "red" elif status_value in ["no_game_today", "unknown", "none"]: - return "⚪" + return "white" else: - return "🔘" + return "gray" data = { "league": LEAGUE, @@ -583,7 +583,8 @@ async def status(request: Request): "name": TEAM, "status": STATUS, "ts": GAME_START_DT.strftime("%Y-%m-%d %H:%M") if GAME_START_DT else "N/A", - "link": LEAGUE + "link": LEAGUE, + "color": color_for_status(STATUS) # ← добавлено } ] + [ { @@ -601,11 +602,16 @@ async def status(request: Request): lang=LANG, game_id=GAME_ID, ), + "color": color_for_status( + latest_data[item]["data"]["status"] + if isinstance(latest_data[item]["data"], dict) and "status" in latest_data[item]["data"] + else latest_data[item]["data"] + ) # ← добавлено } for item in latest_data ], } - + accept = request.headers.get("accept", "") if "text/html" in accept: status_raw = str(STATUS).lower()