formatting

This commit is contained in:
Josh Hawkins 2026-05-03 12:07:29 -05:00
parent 393d4dd423
commit 23f18505f5
4 changed files with 19 additions and 11 deletions

View File

@ -59,6 +59,11 @@ class DebugReplayStopResponse(BaseModel):
@router.post( @router.post(
"/debug_replay/start", "/debug_replay/start",
response_model=DebugReplayStartResponse, response_model=DebugReplayStartResponse,
status_code=202,
responses={
400: {"description": "Invalid camera, time range, or no recordings"},
409: {"description": "A replay session is already active"},
},
dependencies=[Depends(require_role(["admin"]))], dependencies=[Depends(require_role(["admin"]))],
summary="Start debug replay", summary="Start debug replay",
description="Start a debug replay session from camera recordings. Returns " description="Start a debug replay session from camera recordings. Returns "

View File

@ -124,9 +124,7 @@ class DebugReplayManager:
try: try:
new_config = FrigateConfig.parse_object(config_data) new_config = FrigateConfig.parse_object(config_data)
except Exception as e: except Exception as e:
raise RuntimeError( raise RuntimeError(f"Failed to validate replay camera config: {e}") from e
f"Failed to validate replay camera config: {e}"
) from e
frigate_config.cameras[replay_name] = new_config.cameras[replay_name] frigate_config.cameras[replay_name] = new_config.cameras[replay_name]
config_publisher.publish_update( config_publisher.publish_update(

View File

@ -100,9 +100,7 @@ class TestDebugReplayManagerStop(unittest.TestCase):
with ( with (
patch.object(manager, "_cleanup_db"), patch.object(manager, "_cleanup_db"),
patch.object(manager, "_cleanup_files"), patch.object(manager, "_cleanup_files"),
patch( patch("frigate.debug_replay.cancel_debug_replay_job", return_value=False),
"frigate.debug_replay.cancel_debug_replay_job", return_value=False
),
): ):
manager.stop(frigate_config=frigate_config, config_publisher=publisher) manager.stop(frigate_config=frigate_config, config_publisher=publisher)
@ -127,9 +125,7 @@ class TestDebugReplayManagerStop(unittest.TestCase):
with ( with (
patch.object(manager, "_cleanup_db"), patch.object(manager, "_cleanup_db"),
patch.object(manager, "_cleanup_files"), patch.object(manager, "_cleanup_files"),
patch( patch("frigate.debug_replay.cancel_debug_replay_job", return_value=True),
"frigate.debug_replay.cancel_debug_replay_job", return_value=True
),
): ):
manager.stop(frigate_config=frigate_config, config_publisher=publisher) manager.stop(frigate_config=frigate_config, config_publisher=publisher)

View File

@ -1,6 +1,5 @@
"""Tests for the shared ffmpeg progress helper.""" """Tests for the shared ffmpeg progress helper."""
import subprocess as sp
import unittest import unittest
from unittest.mock import MagicMock, patch from unittest.mock import MagicMock, patch
@ -13,7 +12,17 @@ class TestInjectProgressFlags(unittest.TestCase):
result = inject_progress_flags(cmd) result = inject_progress_flags(cmd)
self.assertEqual( self.assertEqual(
result, result,
["ffmpeg", "-i", "in.mp4", "-c", "copy", "-progress", "pipe:2", "-nostats", "out.mp4"], [
"ffmpeg",
"-i",
"in.mp4",
"-c",
"copy",
"-progress",
"pipe:2",
"-nostats",
"out.mp4",
],
) )
def test_empty_cmd_returns_empty(self): def test_empty_cmd_returns_empty(self):