From ea34b6521fd6ccd72698538572c3ae4fbd8ebd51 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: Tue, 28 Oct 2025 16:12:18 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BF=D0=BE=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=BD=D0=BE=D1=80=D0=BC=D0=B0=D0=BB=D1=8C=D0=BD=D0=BE?= =?UTF-8?q?=D0=B5=20=D0=BE=D1=82=D0=BE=D0=B1=D1=80=D0=B0=D0=B6=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=B4=D0=B0=D0=BD=D0=BD=D1=8B=D1=85,=20=D0=BF?= =?UTF-8?q?=D0=BE=D0=BA=D0=B0=20=D0=B4=D0=B0=D0=BD=D0=BD=D1=8B=D1=85=20?= =?UTF-8?q?=D0=BF=D0=BE=20=D0=BC=D0=B0=D1=82=D1=87=D1=83=20=D0=BD=D0=B5?= =?UTF-8?q?=D1=82.=201.=20=D0=BE=D1=82=D0=BE=D0=B1=D1=80=D0=B0=D0=B6=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BB=D0=BE=D0=B3=D0=BE=D1=82=D0=B8=D0=BF?= =?UTF-8?q?=D0=BE=D0=B2=20=D1=81=D0=B5=D0=B3=D0=BE=D0=B4=D0=BD=D1=8F=D1=88?= =?UTF-8?q?=D0=B5=D0=B3=D0=BE=20=D0=BC=D0=B0=D1=82=D1=87=D0=B0=20=D0=B8=20?= =?UTF-8?q?=D0=BD=D0=B0=D0=B4=D0=BF=D0=B8=D1=81=D0=B8=20=D0=BA=D1=82=D0=BE?= =?UTF-8?q?=20=D1=81=20=D0=BA=D0=B5=D0=BC=202.=20=D0=BE=D1=82=D0=BE=D0=B1?= =?UTF-8?q?=D1=80=D0=B0=D0=B6=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=81=D1=80=D0=B5?= =?UTF-8?q?=D0=B4=D0=BD=D0=B8=D1=85=20=D0=BF=D0=BE=D0=BA=D0=B0=D0=B7=D0=B0?= =?UTF-8?q?=D1=82=D0=B5=D0=BB=D0=B5=D0=B9=20=D0=BA=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=B4=20=D0=B7=D0=B0=20=D1=81=D0=B5=D0=B7=D0=BE=D0=BD=203.=20?= =?UTF-8?q?=D1=82=D1=83=D1=80=D0=BD=D0=B8=D1=80=D0=BD=D0=B0=D1=8F=20=D1=82?= =?UTF-8?q?=D0=B0=D0=B1=D0=BB=D0=B8=D1=86=D0=B0=20=D1=81=20=D0=BF=D0=BE?= =?UTF-8?q?=D0=B4=D1=81=D0=B2=D0=B5=D1=82=D0=BA=D0=BE=D0=B9=20=D1=82=D0=B5?= =?UTF-8?q?=D0=BA=D1=83=D1=89=D0=B8=D1=85=20=D0=BA=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- visual.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/visual.py b/visual.py index 8130314..99d0778 100644 --- a/visual.py +++ b/visual.py @@ -426,6 +426,9 @@ prefix = _ipcheck() load_data_from_json("game") cached_game_online = st.session_state.get("game") +load_data_from_json("api_game") +cached_api_game = st.session_state.get("api_game") + load_data_from_json("team1") cached_team1 = st.session_state.get("team1") @@ -437,9 +440,9 @@ cached_referee = st.session_state.get("referee") # standings — может не быть тега/файла league_tag = None -if isinstance(cached_game_online, dict): - league_tag = (cached_game_online.get("league") or {}).get("tag") - comp_name = (cached_game_online.get("comp") or {}).get("name").replace(" ", "_").replace("|", "") +if isinstance(cached_api_game, dict): + league_tag = (cached_api_game["result"].get("league") or {}).get("tag") + comp_name = (cached_api_game["result"].get("comp") or {}).get("name").replace(" ", "_").replace("|", "") if league_tag: load_data_from_json(f"standings_{league_tag}_{comp_name}") cached_standings = ( @@ -556,8 +559,8 @@ if isinstance(cached_play_by_play, list) and isinstance(cached_game_online, dict timeout1 = [] timeout2 = [] -if isinstance(cached_game_online, dict): - result = cached_game_online +if isinstance(cached_api_game, dict): + result = cached_api_game["result"] plays = result.get("plays") or [] timeout1, timeout2 = [], [] @@ -1241,8 +1244,8 @@ column_config_ref = { def highlight_teams(s): try: if s.iloc[0] in ( - cached_game_online["result"]["team1"]["teamId"], - cached_game_online["result"]["team2"]["teamId"], + cached_api_game["result"]["team1"]["teamId"], + cached_api_game["result"]["team2"]["teamId"], ): return ["background-color: #FF4B4B"] * len(s) else: @@ -1256,8 +1259,8 @@ if cached_standings: def highlight_teams(s): try: - t1 = (cached_game_online or {}).get("team1", {}).get("teamId") - t2 = (cached_game_online or {}).get("team2", {}).get("teamId") + t1 = (cached_api_game["result"] or {}).get("team1", {}).get("teamId") + t2 = (cached_api_game["result"] or {}).get("team2", {}).get("teamId") if s.iloc[0] in (t1, t2): return ["background-color: #FF4B4B"] * len(s) if s.iloc[0] in (t1, t2):