mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-06-13 01:16:53 +02:00
Remove PyYAML usages and dependency (#13889)
This commit is contained in:
parent
e8763b3697
commit
6bafb68d77
@ -15,12 +15,10 @@ peewee_migrate == 1.13.*
|
|||||||
psutil == 5.9.*
|
psutil == 5.9.*
|
||||||
pydantic == 2.8.*
|
pydantic == 2.8.*
|
||||||
git+https://github.com/fbcotter/py3nvml#egg=py3nvml
|
git+https://github.com/fbcotter/py3nvml#egg=py3nvml
|
||||||
PyYAML == 6.0.*
|
|
||||||
pytz == 2024.1
|
pytz == 2024.1
|
||||||
pyzmq == 26.2.*
|
pyzmq == 26.2.*
|
||||||
ruamel.yaml == 0.18.*
|
ruamel.yaml == 0.18.*
|
||||||
tzlocal == 5.2
|
tzlocal == 5.2
|
||||||
types-PyYAML == 6.0.*
|
|
||||||
requests == 2.32.*
|
requests == 2.32.*
|
||||||
types-requests == 2.32.*
|
types-requests == 2.32.*
|
||||||
scipy == 1.13.*
|
scipy == 1.13.*
|
||||||
|
@ -6,7 +6,7 @@ import shutil
|
|||||||
import sys
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import yaml
|
from ruamel.yaml import YAML
|
||||||
|
|
||||||
sys.path.insert(0, "/opt/frigate")
|
sys.path.insert(0, "/opt/frigate")
|
||||||
from frigate.const import (
|
from frigate.const import (
|
||||||
@ -18,6 +18,7 @@ from frigate.ffmpeg_presets import parse_preset_hardware_acceleration_encode
|
|||||||
|
|
||||||
sys.path.remove("/opt/frigate")
|
sys.path.remove("/opt/frigate")
|
||||||
|
|
||||||
|
yaml = YAML()
|
||||||
|
|
||||||
FRIGATE_ENV_VARS = {k: v for k, v in os.environ.items() if k.startswith("FRIGATE_")}
|
FRIGATE_ENV_VARS = {k: v for k, v in os.environ.items() if k.startswith("FRIGATE_")}
|
||||||
# read docker secret files as env vars too
|
# read docker secret files as env vars too
|
||||||
@ -40,7 +41,7 @@ try:
|
|||||||
raw_config = f.read()
|
raw_config = f.read()
|
||||||
|
|
||||||
if config_file.endswith((".yaml", ".yml")):
|
if config_file.endswith((".yaml", ".yml")):
|
||||||
config: dict[str, any] = yaml.safe_load(raw_config)
|
config: dict[str, any] = yaml.load(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:
|
||||||
|
@ -3,7 +3,9 @@
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import yaml
|
from ruamel.yaml import YAML
|
||||||
|
|
||||||
|
yaml = YAML()
|
||||||
|
|
||||||
config_file = os.environ.get("CONFIG_FILE", "/config/config.yml")
|
config_file = os.environ.get("CONFIG_FILE", "/config/config.yml")
|
||||||
|
|
||||||
@ -17,7 +19,7 @@ try:
|
|||||||
raw_config = f.read()
|
raw_config = f.read()
|
||||||
|
|
||||||
if config_file.endswith((".yaml", ".yml")):
|
if config_file.endswith((".yaml", ".yml")):
|
||||||
config: dict[str, any] = yaml.safe_load(raw_config)
|
config: dict[str, any] = yaml.load(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:
|
||||||
|
@ -3,7 +3,9 @@
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import yaml
|
from ruamel.yaml import YAML
|
||||||
|
|
||||||
|
yaml = YAML()
|
||||||
|
|
||||||
config_file = os.environ.get("CONFIG_FILE", "/config/config.yml")
|
config_file = os.environ.get("CONFIG_FILE", "/config/config.yml")
|
||||||
|
|
||||||
@ -17,7 +19,7 @@ try:
|
|||||||
raw_config = f.read()
|
raw_config = f.read()
|
||||||
|
|
||||||
if config_file.endswith((".yaml", ".yml")):
|
if config_file.endswith((".yaml", ".yml")):
|
||||||
config: dict[str, any] = yaml.safe_load(raw_config)
|
config: dict[str, any] = yaml.load(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:
|
||||||
|
@ -1762,7 +1762,7 @@ class FrigateConfig(FrigateBaseModel):
|
|||||||
elif ext == ".json":
|
elif ext == ".json":
|
||||||
is_json = True
|
is_json = True
|
||||||
|
|
||||||
# At this point, ry to sniff the config string, to guess if it is json or not.
|
# At this point, try to sniff the config string, to guess if it is json or not.
|
||||||
if is_json is None:
|
if is_json is None:
|
||||||
is_json = REGEX_JSON.match(config) is not None
|
is_json = REGEX_JSON.match(config) is not None
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user