diff --git a/frigate/api/debug_replay.py b/frigate/api/debug_replay.py index ff912b228..5dfbb71e0 100644 --- a/frigate/api/debug_replay.py +++ b/frigate/api/debug_replay.py @@ -59,6 +59,11 @@ class DebugReplayStopResponse(BaseModel): @router.post( "/debug_replay/start", 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"]))], summary="Start debug replay", description="Start a debug replay session from camera recordings. Returns " diff --git a/frigate/debug_replay.py b/frigate/debug_replay.py index f7e67266b..ac04090e4 100644 --- a/frigate/debug_replay.py +++ b/frigate/debug_replay.py @@ -124,9 +124,7 @@ class DebugReplayManager: try: new_config = FrigateConfig.parse_object(config_data) except Exception as e: - raise RuntimeError( - f"Failed to validate replay camera config: {e}" - ) from e + raise RuntimeError(f"Failed to validate replay camera config: {e}") from e frigate_config.cameras[replay_name] = new_config.cameras[replay_name] config_publisher.publish_update( diff --git a/frigate/test/test_debug_replay.py b/frigate/test/test_debug_replay.py index f89ae489c..e7f9df42d 100644 --- a/frigate/test/test_debug_replay.py +++ b/frigate/test/test_debug_replay.py @@ -100,9 +100,7 @@ class TestDebugReplayManagerStop(unittest.TestCase): with ( patch.object(manager, "_cleanup_db"), patch.object(manager, "_cleanup_files"), - patch( - "frigate.debug_replay.cancel_debug_replay_job", return_value=False - ), + patch("frigate.debug_replay.cancel_debug_replay_job", return_value=False), ): manager.stop(frigate_config=frigate_config, config_publisher=publisher) @@ -127,9 +125,7 @@ class TestDebugReplayManagerStop(unittest.TestCase): with ( patch.object(manager, "_cleanup_db"), patch.object(manager, "_cleanup_files"), - patch( - "frigate.debug_replay.cancel_debug_replay_job", return_value=True - ), + patch("frigate.debug_replay.cancel_debug_replay_job", return_value=True), ): manager.stop(frigate_config=frigate_config, config_publisher=publisher) diff --git a/frigate/test/test_ffmpeg_progress.py b/frigate/test/test_ffmpeg_progress.py index ae9c4b94f..521051116 100644 --- a/frigate/test/test_ffmpeg_progress.py +++ b/frigate/test/test_ffmpeg_progress.py @@ -1,6 +1,5 @@ """Tests for the shared ffmpeg progress helper.""" -import subprocess as sp import unittest from unittest.mock import MagicMock, patch @@ -13,7 +12,17 @@ class TestInjectProgressFlags(unittest.TestCase): result = inject_progress_flags(cmd) self.assertEqual( 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):