mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-11-20 04:23:01 +03:00
Miscellaneous fixes (#24970)
CI / ARM Build (push) Canceled after 0s
CI / Jetson Jetpack 6 (push) Canceled after 0s
CI / AMD64 Build (push) Canceled after 0s
CI / AMD64 Extra Build (push) Canceled after 0s
CI / AMD64 Smoke Test (push) Canceled after 0s
CI / ARM Extra Build (push) Canceled after 0s
CI / Synaptics Build (push) Canceled after 0s
CI / Assemble and push default build (push) Canceled after 0s
CI / ARM Build (push) Canceled after 0s
CI / Jetson Jetpack 6 (push) Canceled after 0s
CI / AMD64 Build (push) Canceled after 0s
CI / AMD64 Extra Build (push) Canceled after 0s
CI / AMD64 Smoke Test (push) Canceled after 0s
CI / ARM Extra Build (push) Canceled after 0s
CI / Synaptics Build (push) Canceled after 0s
CI / Assemble and push default build (push) Canceled after 0s
* analytics notifications flag and device grant warnings - report notifications as on when any camera enables them, not only the global setting - don't warn about device nodes the runtime users can already use, such as world-rw nodes in an unprivileged LXC * clarify which stream the All Cameras dashboard uses * add exception catchall for autotracking calibration * only default review api after to 24 hours when no bounds are given The review endpoint replaced a missing or zero `after` with 24 hours ago, so a `before`-only query older than 24 hours returned nothing and `after=0` couldn't mean no lower bound. The default now applies only when neither `before` nor `after` is sent, a `before`-only query has no lower bound, and both bounds use `is not None` checks. The Live dashboard alerts bar sends no bounds and keeps the 24 hour window.
This commit is contained in:
@@ -89,6 +89,37 @@ class TestHttpReview(BaseTestHttp):
|
||||
assert response_json[0]["id"] == id
|
||||
assert response_json[0]["has_been_reviewed"] == False
|
||||
|
||||
def test_get_review_before_only_has_no_lower_bound(self):
|
||||
now = datetime.now().timestamp()
|
||||
|
||||
with AuthTestClient(self.app) as client:
|
||||
id = "123456.random"
|
||||
super().insert_mock_review_segment(id, now - 72 * 3600, now - 71 * 3600)
|
||||
response = client.get("/review", params={"before": now - 48 * 3600})
|
||||
assert response.status_code == 200
|
||||
assert [r["id"] for r in response.json()] == [id]
|
||||
|
||||
def test_get_review_after_zero_is_not_defaulted(self):
|
||||
now = datetime.now().timestamp()
|
||||
|
||||
with AuthTestClient(self.app) as client:
|
||||
id = "123456.random"
|
||||
super().insert_mock_review_segment(id, now - 72 * 3600, now - 71 * 3600)
|
||||
response = client.get("/review", params={"after": 0})
|
||||
assert response.status_code == 200
|
||||
assert [r["id"] for r in response.json()] == [id]
|
||||
|
||||
def test_get_review_no_bounds_defaults_to_last_24_hours(self):
|
||||
now = datetime.now().timestamp()
|
||||
|
||||
with AuthTestClient(self.app) as client:
|
||||
super().insert_mock_review_segment(
|
||||
"123456.random", now - 72 * 3600, now - 71 * 3600
|
||||
)
|
||||
response = client.get("/review", params={"limit": 10})
|
||||
assert response.status_code == 200
|
||||
assert response.json() == []
|
||||
|
||||
def test_get_review_with_time_filter_no_matches(self):
|
||||
"""Test that review items outside the range are not returned."""
|
||||
now = datetime.now().timestamp()
|
||||
|
||||
@@ -100,6 +100,17 @@ class TestFeaturesCollector(unittest.TestCase):
|
||||
self.assertEqual(section.users, {"admin": 1, "viewer": 1, "custom": 1})
|
||||
self.assertEqual((section.camera_groups, section.profiles), (1, 0))
|
||||
self.assertFalse(section.plus_api_key)
|
||||
self.assertFalse(section.notifications)
|
||||
|
||||
def test_camera_notifications_count_as_on(self):
|
||||
config = {
|
||||
**CONFIG,
|
||||
"cameras": {"front": {**FRONT_CAMERA, "notifications": {"enabled": True}}},
|
||||
}
|
||||
|
||||
section = features.collect(make_context(make_config(config), {}))
|
||||
|
||||
self.assertTrue(section.notifications)
|
||||
|
||||
|
||||
class TestFeatureMappings(unittest.TestCase):
|
||||
|
||||
@@ -193,6 +193,35 @@ class TestAutotrackerPrediction(unittest.TestCase):
|
||||
self.assertEqual(self._target_box([-1, -2, 1, 2], 0), 0.2)
|
||||
|
||||
|
||||
class TestAutotrackerCalibrationFailure(unittest.IsolatedAsyncioTestCase):
|
||||
async def test_calibration_failure_disables_autotracking(self) -> None:
|
||||
tracker = _make_tracker()
|
||||
camera_config = tracker.config.cameras[CAMERA]
|
||||
camera_config.onvif.autotracking.calibrate_on_startup = True
|
||||
tracker.tracked_object_history = {}
|
||||
tracker.tracked_object_metrics = {}
|
||||
tracker.move_metrics = {}
|
||||
tracker.intercept = {}
|
||||
tracker.move_coefficients = {}
|
||||
tracker.zoom_time = {}
|
||||
tracker.move_queues = {}
|
||||
tracker.move_queue_locks = {}
|
||||
tracker.onvif.loop = asyncio.get_running_loop()
|
||||
tracker.onvif.cams = {CAMERA: {"init": True, "features": ["pt-r-fov"]}}
|
||||
tracker.onvif.get_service_capabilities = AsyncMock(return_value=True)
|
||||
tracker.onvif.get_camera_status = AsyncMock()
|
||||
tracker._process_move_queue = AsyncMock()
|
||||
tracker._calibrate_camera = AsyncMock(side_effect=RuntimeError("disconnected"))
|
||||
tracker.autotracker_init[CAMERA] = False
|
||||
|
||||
with self.assertLogs("frigate.ptz.autotrack", level="ERROR"):
|
||||
await tracker._autotracker_setup(camera_config, CAMERA, startup=True)
|
||||
|
||||
self.assertFalse(camera_config.onvif.autotracking.enabled)
|
||||
self.assertFalse(tracker.autotracker_init[CAMERA])
|
||||
self.assertFalse(tracker.calibrating[CAMERA])
|
||||
|
||||
|
||||
class TestAutotrackerMoveQueue(unittest.IsolatedAsyncioTestCase):
|
||||
async def test_absolute_zoom_does_not_overwrite_the_pan_tilt_sample(self) -> None:
|
||||
tracker = _make_tracker()
|
||||
|
||||
Reference in New Issue
Block a user