From e5e52bfa30b34983fc8f9b2cc66364509b44c15f Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Sat, 31 Aug 2024 08:27:22 -0600 Subject: [PATCH] Cleanup --- frigate/util/config.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/frigate/util/config.py b/frigate/util/config.py index 3f3919d47..3d6a22e97 100644 --- a/frigate/util/config.py +++ b/frigate/util/config.py @@ -202,18 +202,19 @@ def migrate_015_0(config: dict[str, dict[str, any]]) -> dict[str, dict[str, any] for name, camera in config.get("cameras", {}).items(): camera_config: dict[str, dict[str, any]] = camera.copy() - record_events = camera_config.get("record", {}).get("events") + record_events: dict[str, any] = camera_config.get("record", {}).get("events") + if record_events: alerts_retention = {"retain": {}} detections_retention = {"retain": {}} - if record_events["pre_capture"]: + if record_events.get("pre_capture"): alerts_retention["pre_capture"] = record_events["pre_capture"] - if record_events["post_capture"]: + if record_events.get("post_capture"): alerts_retention["post_capture"] = record_events["post_capture"] - if record_events["retain"]["default"]: + if record_events.get("retain", {}).get("default"): alerts_retention["retain"]["days"] = record_events["retain"]["default"] # decide logical detections retention based on current detections config