From 42d6020865cb59a7dfe21ad16b732dc6199c9738 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Fri, 12 Apr 2024 21:08:10 -0600 Subject: [PATCH] Remove rtmp references as part of migration --- frigate/util/config.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/frigate/util/config.py b/frigate/util/config.py index 81c43eee4..46a1ea941 100644 --- a/frigate/util/config.py +++ b/frigate/util/config.py @@ -61,6 +61,7 @@ def migrate_014(config: dict[str, dict[str, any]]) -> dict[str, dict[str, any]]: ) if global_required_zones: + # migrate to new review config if not new_config.get("review"): new_config["review"] = {} @@ -70,14 +71,23 @@ def migrate_014(config: dict[str, dict[str, any]]) -> dict[str, dict[str, any]]: if not new_config["review"]["alerts"].get("required_zones"): new_config["review"]["alerts"]["required_zones"] = global_required_zones + # remove record required zones config del new_config["record"]["events"]["required_zones"] + # remove record altogether if there is not other config if not new_config["record"]["events"]: del new_config["record"]["events"] if not new_config["record"]: del new_config["record"] + # remove rtmp + if new_config.get("ffmpeg", {}).get("output_args", {}).get("rtmp"): + del new_config["ffmpeg"]["output_args"]["rtmp"] + + if new_config.get("rtmp"): + del new_config["rtmp"] + for name, camera in config.get("cameras", {}).items(): camera_config: dict[str, dict[str, any]] = camera.copy() required_zones = ( @@ -85,6 +95,7 @@ def migrate_014(config: dict[str, dict[str, any]]) -> dict[str, dict[str, any]]: ) if required_zones: + # migrate to new review config if not camera_config.get("review"): camera_config["review"] = {} @@ -94,14 +105,23 @@ def migrate_014(config: dict[str, dict[str, any]]) -> dict[str, dict[str, any]]: if not camera_config["review"]["alerts"].get("required_zones"): camera_config["review"]["alerts"]["required_zones"] = required_zones + # remove record required zones config del camera_config["record"]["events"]["required_zones"] + # remove record altogether if there is not other config if not camera_config["record"]["events"]: del camera_config["record"]["events"] if not camera_config["record"]: del camera_config["record"] + # remove rtmp + if camera_config.get("ffmpeg", {}).get("output_args", {}).get("rtmp"): + del camera_config["ffmpeg"]["output_args"]["rtmp"] + + if camera_config.get("rtmp"): + del camera_config["rtmp"] + new_config["cameras"][name] = camera_config return new_config