Добавлен проверка на лок переменной SHOTMAP
This commit is contained in:
13
get_data.py
13
get_data.py
@@ -3237,9 +3237,11 @@ def change_vmix_datasource_urls(xml_data, new_base_url: str) -> bytes:
|
||||
root = ET.fromstring(text)
|
||||
|
||||
# 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()
|
||||
pattern = r'https?:\/\/[^\/]+'
|
||||
pattern = r"https?:\/\/[^\/]+"
|
||||
new_url = re.sub(pattern, new_base_url, old_url, count=0, flags=0)
|
||||
url_tag.text = new_url
|
||||
|
||||
@@ -3633,6 +3635,7 @@ async def get_shotmap_image(player_id_shots: str):
|
||||
Отдаёт картинку карты бросков из оперативной памяти.
|
||||
player_id_shots должен совпадать с ключом в SHOTMAP_CACHE, например "23_shots".
|
||||
"""
|
||||
async with SHOTMAPS_LOCK:
|
||||
data = SHOTMAP_CACHE.get(player_id_shots)
|
||||
if not data:
|
||||
raise HTTPException(status_code=404, detail="Shotmap not found in memory")
|
||||
@@ -3916,7 +3919,8 @@ async def commentary():
|
||||
plus_minus = p.get("plusMinus", "")
|
||||
kpi = p.get("kpi", "")
|
||||
|
||||
rows.append(f"""
|
||||
rows.append(
|
||||
f"""
|
||||
<tr>
|
||||
<td>{num}</td>
|
||||
<td class="player-name"
|
||||
@@ -3939,7 +3943,8 @@ async def commentary():
|
||||
<td class="extra-col">{plus_minus}</td>
|
||||
<td class="extra-col">{kpi}</td>
|
||||
</tr>
|
||||
""")
|
||||
"""
|
||||
)
|
||||
|
||||
return f"""
|
||||
<h3>{title}</h3>
|
||||
|
||||
Reference in New Issue
Block a user