Uses the same loading method for the go2rtc configuration as for the main configuration

This commit is contained in:
you 2024-06-29 18:54:27 +02:00
parent 53a2a865f1
commit 0d63838f02

View File

@ -8,11 +8,16 @@ from pathlib import Path
import yaml import yaml
sys.path.insert(0, "/opt/frigate") sys.path.insert(0, "/opt/frigate")
from frigate.const import BIRDSEYE_PIPE # noqa: E402 from frigate.const import ( # noqa: E402
BIRDSEYE_PIPE,
YAML_EXT,
)
from frigate.ffmpeg_presets import ( # noqa: E402 from frigate.ffmpeg_presets import ( # noqa: E402
parse_preset_hardware_acceleration_encode, parse_preset_hardware_acceleration_encode,
) )
from frigate.util.builtin import (
load_config_with_no_duplicates,
)
sys.path.remove("/opt/frigate") sys.path.remove("/opt/frigate")
@ -36,8 +41,8 @@ try:
with open(config_file) as f: with open(config_file) as f:
raw_config = f.read() raw_config = f.read()
if config_file.endswith((".yaml", ".yml")): if config_file.endswith(YAML_EXT):
config: dict[str, any] = yaml.safe_load(raw_config) config: dict[str, any] = load_config_with_no_duplicates(raw_config)
elif config_file.endswith(".json"): elif config_file.endswith(".json"):
config: dict[str, any] = json.loads(raw_config) config: dict[str, any] = json.loads(raw_config)
except FileNotFoundError: except FileNotFoundError: