From 69e40984f22df917d4c25c50072b464590142da3 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, 15 May 2026 12:45:16 +0300 Subject: [PATCH] =?UTF-8?q?=D1=83=D0=B1=D1=80=D0=B0=D0=BB=20=D1=81=D1=82?= =?UTF-8?q?=D0=B0=D1=80=D1=8B=D0=B5=20=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8?= =?UTF-8?q?=D0=B8=20=D0=B8=20=D1=81=D0=B4=D0=B5=D0=BB=D0=B0=D0=BB=20=D0=B0?= =?UTF-8?q?=D0=B2=D1=82=D0=BE=D0=BE=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=B2=D0=B5=D1=80=D1=81=D0=B8=D0=B9=20js?= =?UTF-8?q?=20=D0=B8=20css?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.py | 12 +++++ static/script.js | 89 ---------------------------------- templates/match_workspace.html | 7 +-- 3 files changed, 16 insertions(+), 92 deletions(-) diff --git a/app.py b/app.py index bec88a0..f900b24 100644 --- a/app.py +++ b/app.py @@ -18,6 +18,7 @@ import time from urllib.parse import quote import traceback import contextlib +import os from parsers.parser_game import run_parser_game from parsers.parser_players import run_parser_players from parsers.parser_schedule import run_parser_schedule @@ -310,6 +311,17 @@ def root(request: Request): return RedirectResponse(url="/admin/matches") return RedirectResponse(url="/login") +@app.context_processor +def inject_static_version(): + def static_version(filename): + path = os.path.join(app.root_path, "static", filename) + try: + return int(os.path.getmtime(path)) + except OSError: + return "1" + + return dict(static_version=static_version) + def log_action( request: Request, diff --git a/static/script.js b/static/script.js index 952eb91..8a40ac7 100644 --- a/static/script.js +++ b/static/script.js @@ -290,7 +290,6 @@ function restoreMatchState() { matchEvents = Array.isArray(state.matchEvents) ? state.matchEvents : []; scoreState = state.scoreState || { home: 0, away: 0 }; extraTimeMinutes = state.extraTimeMinutes || { first: 0, second: 0 }; - // originalLineupState = state.originalLineupState || originalLineupState; pausedAccumulatedSeconds = Number(state.pausedAccumulatedSeconds ?? 0); periodStartedAt = state.periodStartedAt ?? null; @@ -510,7 +509,6 @@ function addPeriodMarker(type, title, forcedSeconds = null) { }; matchEvents.push(item); - // matchEvents = sortEventsForStorage(matchEvents); renderEvents(); saveMatchState(); @@ -841,10 +839,6 @@ function updateEditModeUI() { btn.classList.toggle("active", editModeEnabled); } - // document.querySelectorAll("[data-edit-only]").forEach((el) => { - // el.style.display = editModeEnabled ? "" : "none"; - // }); - document.querySelectorAll("[data-edit-lock]").forEach((el) => { if ("disabled" in el) { el.disabled = !editModeEnabled; @@ -1138,7 +1132,6 @@ async function triggerVmixEventCommand(eventPayload) { console.log("VMIX DIRECT EVENT:", eventPayload); console.log("VMIX DIRECT COMMANDS:", commands); - // await executeVmixCommands(commands.join("\n")); await sendDirectVmixCommands(commands); } @@ -2259,51 +2252,6 @@ function convertPitchYToPan(y) { } - -// function buildVmixCommandsFromFormation(side) { -// const players = Array.isArray(formationState[side]) ? formationState[side] : []; -// const commands = []; -// const playerPrefix = side === "home" ? "HOME" : "AWAY"; -// const inputName = side === "home" ? "РАССТАНОВКА - ХОЗЯЕВА" : "РАССТАНОВКА - ГОСТИ"; - - -// if (players.length < 2) { -// return []; -// } - -// // Вратарь players[0], полевые players[1..10] -// players.slice(1, 11).forEach((player, index) => { -// const playerNumber = index + 1; -// const playerInputName = `${playerPrefix} - Игрок${playerNumber}`; - -// const x = convertPitchXToPan(player.x).toFixed(3); -// const y = convertPitchYToPan(player.y).toFixed(3); - - -// for (let i = 1; i <= 10; i++) { -// commands.push( -// vmixCmd(`Function=ResetInput&Input=${encodeURIComponent(`${playerPrefix} - Игрок${i}`)}`) -// ); -// }; - -// commands.push( -// vmixCmd(`Function=ResetInput&Input=${encodeURIComponent(inputName)}`) -// ); - - - -// commands.push( -// vmixCmd(`Function=SetPanX&Input=${encodeURIComponent(playerInputName)}&Value=${x}`) -// ); - -// commands.push( -// vmixCmd(`Function=SetPanY&Input=${encodeURIComponent(playerInputName)}&Value=${y}`) -// ); -// }); - -// return commands; -// } - function buildVmixCommandsFromFormation(side) { const players = Array.isArray(formationState[side]) ? formationState[side] : []; const commands = []; @@ -2440,43 +2388,6 @@ const FORMATION_TEMPLATE_442 = { ] }; -// function getDistributedXSlots(count) { -// if (count <= 0) return []; -// if (count === 1) return [50]; -// if (count === 2) return [25, 75]; -// if (count === 3) return [8, 50, 92]; -// if (count === 4) return [0, 30, 70, 100]; -// if (count === 5) return [0, 18, 50, 82, 100]; -// if (count === 6) return [0, 16, 36, 64, 84, 100]; - -// return Array.from({ length: count }, (_, i) => (i / (count - 1)) * 100); -// } - -// function getArcYOffsetSlots(count, strength = 10) { -// if (count < 4) { -// return Array(count).fill(0); -// } - -// if (count === 5) { -// return [ -// strength * 0.11, // левый фланг ниже -// -strength * 0.5, // левый полуфланг чуть выше базы -// -strength, // центр выше всех -// -strength * 0.5, // правый полуфланг чуть выше базы -// strength * 0.11 // правый фланг ниже -// ]; -// } - -// const center = (count - 1) / 2; - -// return Array.from({ length: count }, (_, i) => { -// const dist = Math.abs(i - center); -// const maxDist = center || 1; -// const normalized = dist / maxDist; - -// return -strength * Math.pow(1 - normalized, 1.5); -// }); -// } function clamp(value, min, max) { return Math.max(min, Math.min(max, value)); diff --git a/templates/match_workspace.html b/templates/match_workspace.html index 82655d7..52d4b89 100644 --- a/templates/match_workspace.html +++ b/templates/match_workspace.html @@ -10,8 +10,9 @@ ЖФЛ Управление vMix - - + + +