Add reset API in Dashboard

This commit is contained in:
proitlab committed 2026-07-29 15:31:14 +07:00
1 parent 2d98ea2d17
commit 7db25bf19b
3 files changed
+34

No files matched your search

+11
View File
@@ -4,6 +4,7 @@ Recounting dashboard — consumes live counter + recount APIs,
lists OUTPUT_DIR MP4 files, streams MP4 via ffmpeg RTSP → go2rtc for preview.
"""
import json
import logging
import os
import re
import subprocess
@@ -18,6 +19,9 @@ from werkzeug.serving import WSGIRequestHandler
from dotenv import load_dotenv
load_dotenv()
log = logging.getLogger('werkzeug')
log.setLevel(logging.ERROR)
app = Flask(__name__, template_folder="templates")
app.config["SECRET_KEY"] = os.getenv("SECRET_KEY", "change-me-in-production")
@@ -126,6 +130,13 @@ def start_recount():
with _streaming_lock:
_stop_ffmpeg_locked()
try:
_http_session.post(f"{RECOUNT_API_URL}/api/reset", timeout=5)
except Exception:
pass
with _streaming_lock:
_current_file = mp4_path
cmd = [
"ffmpeg", "-re", "-i", mp4_path,