Добавлен проверка на лок переменной SHOTMAP
This commit is contained in:
23
get_data.py
23
get_data.py
@@ -3237,9 +3237,11 @@ def change_vmix_datasource_urls(xml_data, new_base_url: str) -> bytes:
|
|||||||
root = ET.fromstring(text)
|
root = ET.fromstring(text)
|
||||||
|
|
||||||
# 4. Меняем URL
|
# 4. Меняем URL
|
||||||
for url_tag in root.findall(".//datasource[@friendlyName='JSON']//instance//state/xml/url"):
|
for url_tag in root.findall(
|
||||||
|
".//datasource[@friendlyName='JSON']//instance//state/xml/url"
|
||||||
|
):
|
||||||
old_url = url_tag.text.strip()
|
old_url = url_tag.text.strip()
|
||||||
pattern = r'https?:\/\/[^\/]+'
|
pattern = r"https?:\/\/[^\/]+"
|
||||||
new_url = re.sub(pattern, new_base_url, old_url, count=0, flags=0)
|
new_url = re.sub(pattern, new_base_url, old_url, count=0, flags=0)
|
||||||
url_tag.text = new_url
|
url_tag.text = new_url
|
||||||
|
|
||||||
@@ -3633,11 +3635,12 @@ async def get_shotmap_image(player_id_shots: str):
|
|||||||
Отдаёт картинку карты бросков из оперативной памяти.
|
Отдаёт картинку карты бросков из оперативной памяти.
|
||||||
player_id_shots должен совпадать с ключом в SHOTMAP_CACHE, например "23_shots".
|
player_id_shots должен совпадать с ключом в SHOTMAP_CACHE, например "23_shots".
|
||||||
"""
|
"""
|
||||||
data = SHOTMAP_CACHE.get(player_id_shots)
|
async with SHOTMAPS_LOCK:
|
||||||
if not data:
|
data = SHOTMAP_CACHE.get(player_id_shots)
|
||||||
raise HTTPException(status_code=404, detail="Shotmap not found in memory")
|
if not data:
|
||||||
|
raise HTTPException(status_code=404, detail="Shotmap not found in memory")
|
||||||
|
|
||||||
return Response(content=data, media_type="image/png")
|
return Response(content=data, media_type="image/png")
|
||||||
|
|
||||||
|
|
||||||
@app.get("/last_5_games")
|
@app.get("/last_5_games")
|
||||||
@@ -3916,7 +3919,8 @@ async def commentary():
|
|||||||
plus_minus = p.get("plusMinus", "")
|
plus_minus = p.get("plusMinus", "")
|
||||||
kpi = p.get("kpi", "")
|
kpi = p.get("kpi", "")
|
||||||
|
|
||||||
rows.append(f"""
|
rows.append(
|
||||||
|
f"""
|
||||||
<tr>
|
<tr>
|
||||||
<td>{num}</td>
|
<td>{num}</td>
|
||||||
<td class="player-name"
|
<td class="player-name"
|
||||||
@@ -3939,7 +3943,8 @@ async def commentary():
|
|||||||
<td class="extra-col">{plus_minus}</td>
|
<td class="extra-col">{plus_minus}</td>
|
||||||
<td class="extra-col">{kpi}</td>
|
<td class="extra-col">{kpi}</td>
|
||||||
</tr>
|
</tr>
|
||||||
""")
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
return f"""
|
return f"""
|
||||||
<h3>{title}</h3>
|
<h3>{title}</h3>
|
||||||
@@ -4458,7 +4463,7 @@ async def dashboard():
|
|||||||
|
|
||||||
# порядок вывода метрик в центральном столбце (как на твоём дашборде)
|
# порядок вывода метрик в центральном столбце (как на твоём дашборде)
|
||||||
center_stats_order = [
|
center_stats_order = [
|
||||||
"pt-1", # штрафные
|
"pt-1", # штрафные
|
||||||
"pt-1_pro",
|
"pt-1_pro",
|
||||||
"pt-2",
|
"pt-2",
|
||||||
"pt-2_pro",
|
"pt-2_pro",
|
||||||
|
|||||||
Reference in New Issue
Block a user