mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-05-07 05:55:27 +03:00
formatting
This commit is contained in:
parent
393d4dd423
commit
23f18505f5
@ -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 "
|
||||||
|
|||||||
@ -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(
|
||||||
|
|||||||
@ -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)
|
||||||
|
|
||||||
|
|||||||
@ -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):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user