From 2795c0f6c26c5076432a8dae2d3eb1724ebca0f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=AE=D1=80=D0=B8=D0=B9=20=D0=A7=D0=B5=D1=80=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D0=BA=D0=BE?= Date: Fri, 31 Oct 2025 18:08:44 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D1=8B=20=D1=86=D0=B2=D0=B5=D1=82=D0=B0=20=D1=81=D1=82?= =?UTF-8?q?=D0=B0=D1=82=D1=83=D1=81=D0=BE=D0=B2=20=D1=82=D0=B5=D0=BA=D1=81?= =?UTF-8?q?=D1=82=D0=BE=D0=BC=20=D0=B4=D0=BB=D1=8F=20vMix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- get_data.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) 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()