1. исправил agent.py

2. поменял явки и пароли для создания операторов
3. убрал из maches.html оператора, и добавил галочку завершенные матчи
This commit is contained in:
2026-04-21 11:44:58 +03:00
parent ffdaef5051
commit 7baed89b6a
7 changed files with 75 additions and 27 deletions

View File

@@ -10,8 +10,8 @@ import requests
import websockets
VMIX_API = "http://127.0.0.1:8088/api"
# WS_BASE = "wss://hostname.tvstart.ru/ws/vmix-client"
WS_BASE = "ws://127.0.0.1:8000/ws/vmix-client"
WS_BASE = "wss://wfl.tvstart.ru/ws/vmix-client"
# WS_BASE = "ws://127.0.0.1:8000/ws/vmix-client"
CLIENT_ID = f"vmix-{socket.gethostname().lower()}-{uuid.uuid4().hex[:6]}"
POLL_INTERVAL = 3

16
app.py
View File

@@ -459,8 +459,15 @@ def admin_matches(
request: Request,
today_only: bool = Query(default=False),
tour: str | None = Query(default=None),
hide_finished: str = Query(default="true"),
):
matches = list_matches_for_admin(today_only=today_only, tour=tour)
hide_finished_bool = str(hide_finished).lower() == "true"
matches = list_matches_for_admin(
today_only=today_only,
tour=tour,
hide_finished=hide_finished_bool,
)
tours = list_available_tours()
return templates.TemplateResponse(
@@ -469,6 +476,7 @@ def admin_matches(
context={
"matches": matches,
"today_only": today_only,
"hide_finished": hide_finished_bool,
"selected_tour": tour or "",
"tours": tours,
"current_user": getattr(request.state, "current_user", None),
@@ -519,7 +527,7 @@ def select_match(
session_row = create_match_session(
match_id=match_id,
operator_name=operator_name.strip() or None,
operator_name=None,
vmix_project_path=None,
)
@@ -533,7 +541,7 @@ def select_match(
match_id=match_id,
session_token=session_token,
details={
"operator_name": operator_name.strip() or None,
"operator_name": None,
},
)
@@ -1354,7 +1362,7 @@ EMPTY_PLAYER_FORMATION = {
"number": " ",
"number_lastname_amp_K": " ",
"position": " ",
"photo": " ",
"photo": r"D:\Графика\ФУТБОЛ\Женская Суперлига 2026\Photo\EMPTY.png",
}

View File

@@ -207,3 +207,45 @@ def list_available_tours():
return tours
finally:
conn.close()
def list_matches_for_admin(
today_only: bool = False,
tour: str | None = None,
hide_finished: bool = True,
):
query = """
SELECT
m.id,
m.external_id,
m.match_date,
m.status,
m.tour,
m.season,
ht.name AS home_team_name,
at.name AS away_team_name
FROM matches m
JOIN teams ht ON ht.id = m.home_team_id
JOIN teams at ON at.id = m.away_team_id
WHERE 1=1
"""
params = []
if today_only:
query += " AND DATE(m.match_date) = CURRENT_DATE "
if tour:
query += " AND m.tour = %s "
params.append(tour)
if hide_finished:
query += " AND COALESCE(m.status, 'scheduled') <> 'finished' "
query += " ORDER BY m.match_date ASC NULLS LAST, m.id ASC; "
conn = get_connection()
try:
with conn.cursor() as cur:
cur.execute(query, params)
return cur.fetchall()
finally:
conn.close()

View File

@@ -1,23 +1,13 @@
import os
import sys
from getpass import getpass
from db import get_connection
sys.path.append(os.path.dirname(os.path.dirname(__file__)))
import psycopg2
from services.auth_service import hash_password
def get_connection():
return psycopg2.connect(
host=os.getenv("DB_HOST", "localhost"),
port=os.getenv("DB_PORT", 5432),
dbname=os.getenv("DB_NAME", "wfl_db"),
user=os.getenv("DB_USER", "postgres"),
password=os.getenv("DB_PASSWORD", "159753"),
)
def main():
username = input("Username: ").strip()
password = getpass("Password: ").strip()

View File

@@ -345,6 +345,21 @@
</select>
</div>
<div class="filter-group">
<label>Статус матчей</label>
<div class="check-line">
<input type="hidden" name="hide_finished" value="false">
<input
type="checkbox"
name="hide_finished"
value="true"
{% if hide_finished %}checked{% endif %}
onchange="document.getElementById('filters-form').submit();"
>
<span>Завершенные матчи</span>
</div>
</div>
<div class="filter-group">
<label>&nbsp;</label>
<div class="check-line">
@@ -364,7 +379,6 @@
<th>Тур</th>
<th>Сезон</th>
<th>Статус</th>
<th>Оператор</th>
<th>Действие</th>
</tr>
</thead>
@@ -386,14 +400,8 @@
{{ status }}
</span>
</td>
<td colspan="2">
<td>
<form method="get" action="/admin/matches/{{ row[0] }}/select" class="select-form js-select-form">
<input
type="text"
name="operator_name"
placeholder="Имя оператора"
class="operator-input"
>
<button type="submit" class="btn">Выбрать матч</button>
</form>
</td>