mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-14 15:15:22 +03:00
Safely access all fields
This commit is contained in:
parent
5bffd02cb2
commit
bf7560d07b
@ -162,13 +162,13 @@ def migrate_015_0(config: dict[str, dict[str, any]]) -> dict[str, dict[str, any]
|
|||||||
alerts_retention = {"retain": {}}
|
alerts_retention = {"retain": {}}
|
||||||
detections_retention = {"retain": {}}
|
detections_retention = {"retain": {}}
|
||||||
|
|
||||||
if global_record_events["pre_capture"]:
|
if global_record_events.get("pre_capture"):
|
||||||
alerts_retention["pre_capture"] = global_record_events["pre_capture"]
|
alerts_retention["pre_capture"] = global_record_events["pre_capture"]
|
||||||
|
|
||||||
if global_record_events["post_capture"]:
|
if global_record_events.get("post_capture"):
|
||||||
alerts_retention["post_capture"] = global_record_events["post_capture"]
|
alerts_retention["post_capture"] = global_record_events["post_capture"]
|
||||||
|
|
||||||
if global_record_events["retain"]["default"]:
|
if global_record_events.get("retain", {}).get("default"):
|
||||||
alerts_retention["retain"]["days"] = global_record_events["retain"][
|
alerts_retention["retain"]["days"] = global_record_events["retain"][
|
||||||
"default"
|
"default"
|
||||||
]
|
]
|
||||||
@ -177,17 +177,17 @@ def migrate_015_0(config: dict[str, dict[str, any]]) -> dict[str, dict[str, any]
|
|||||||
if not config.get("review", {}).get("alerts", {}).get(
|
if not config.get("review", {}).get("alerts", {}).get(
|
||||||
"required_zones"
|
"required_zones"
|
||||||
) or config.get("review", {}).get("detections"):
|
) or config.get("review", {}).get("detections"):
|
||||||
if global_record_events["pre_capture"]:
|
if global_record_events.get("pre_capture"):
|
||||||
detections_retention["pre_capture"] = global_record_events[
|
detections_retention["pre_capture"] = global_record_events[
|
||||||
"pre_capture"
|
"pre_capture"
|
||||||
]
|
]
|
||||||
|
|
||||||
if global_record_events["post_capture"]:
|
if global_record_events.get("post_capture"):
|
||||||
detections_retention["post_capture"] = global_record_events[
|
detections_retention["post_capture"] = global_record_events[
|
||||||
"post_capture"
|
"post_capture"
|
||||||
]
|
]
|
||||||
|
|
||||||
if global_record_events["retain"]["default"]:
|
if global_record_events.get("retain", {}).get("default"):
|
||||||
detections_retention["retain"]["days"] = global_record_events["retain"][
|
detections_retention["retain"]["days"] = global_record_events["retain"][
|
||||||
"default"
|
"default"
|
||||||
]
|
]
|
||||||
@ -221,13 +221,13 @@ def migrate_015_0(config: dict[str, dict[str, any]]) -> dict[str, dict[str, any]
|
|||||||
if not camera_config.get("review", {}).get("alerts", {}).get(
|
if not camera_config.get("review", {}).get("alerts", {}).get(
|
||||||
"required_zones"
|
"required_zones"
|
||||||
) or camera_config.get("review", {}).get("detections"):
|
) or camera_config.get("review", {}).get("detections"):
|
||||||
if record_events["pre_capture"]:
|
if record_events.get("pre_capture"):
|
||||||
detections_retention["pre_capture"] = record_events["pre_capture"]
|
detections_retention["pre_capture"] = record_events["pre_capture"]
|
||||||
|
|
||||||
if record_events["post_capture"]:
|
if record_events.get("post_capture"):
|
||||||
detections_retention["post_capture"] = record_events["post_capture"]
|
detections_retention["post_capture"] = record_events["post_capture"]
|
||||||
|
|
||||||
if record_events["retain"]["default"]:
|
if record_events.get("retain", {}).get("default"):
|
||||||
detections_retention["retain"]["days"] = record_events["retain"][
|
detections_retention["retain"]["days"] = record_events["retain"][
|
||||||
"default"
|
"default"
|
||||||
]
|
]
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user