1. исправил agent.py
2. поменял явки и пароли для создания операторов 3. убрал из maches.html оператора, и добавил галочку завершенные матчи
This commit is contained in:
4
agent.py
4
agent.py
@@ -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
|
||||
|
||||
20
app.py
20
app.py
@@ -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,13 +476,14 @@ 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),
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
# @app.get("/admin/matches/{match_id}/select")
|
||||
# def select_match(
|
||||
# request: Request, match_id: int, operator_name: str = Form(default="")
|
||||
@@ -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",
|
||||
}
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
@@ -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()
|
||||
Binary file not shown.
@@ -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()
|
||||
|
||||
@@ -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> </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>
|
||||
|
||||
Reference in New Issue
Block a user