mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-09-26 19:41:29 +08:00

* Move database and config from homeassistant /config to addon /config * Re-implement config migration for the add-on * Align some terms * Improve function name * Use local variables * Add model.path migration * Fix homeassistant config path * Ensure migration scripts run before go2rtc and frigate * Migrate all files I know * Add ffmpeg.path migration * Update docker/main/rootfs/etc/s6-overlay/s6-rc.d/prepare/run Co-authored-by: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> * Improve some variable names and organization * Update docs to reflect addon config dir * Update live.md with /addon_configs * Move addon config section to configuration doc * Align several terminologies and improve text * Fix webrtc example config title * Capitalize Add-on in more places * Improve specific add-on config dir docs * Align bash and python scripts to prefer config.yml over config.yaml * Support config.json in migration shell scripts * Change docs to reflect config.yml is preferred over config.yaml * If previous config was yaml, migrate to yaml * Fix typo in edgetpu.md * Fix formatting of Python files * Remove HailoRT Beta add-on variant from docs * Add migration for labelmap and certs * Fix variable name * Fix new_config_file var unset * Fix addon config directories table * Improve db migration to avoid migrating files like .db.bak * Fix echo location --------- Co-authored-by: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com>
37 lines
904 B
Python
37 lines
904 B
Python
import json
|
|
import sys
|
|
|
|
from ruamel.yaml import YAML
|
|
|
|
sys.path.insert(0, "/opt/frigate")
|
|
from frigate.const import (
|
|
DEFAULT_FFMPEG_VERSION,
|
|
INCLUDED_FFMPEG_VERSIONS,
|
|
)
|
|
from frigate.util.config import find_config_file
|
|
|
|
sys.path.remove("/opt/frigate")
|
|
|
|
yaml = YAML()
|
|
|
|
config_file = find_config_file()
|
|
|
|
try:
|
|
with open(config_file) as f:
|
|
raw_config = f.read()
|
|
|
|
if config_file.endswith((".yaml", ".yml")):
|
|
config: dict[str, any] = yaml.load(raw_config)
|
|
elif config_file.endswith(".json"):
|
|
config: dict[str, any] = json.loads(raw_config)
|
|
except FileNotFoundError:
|
|
config: dict[str, any] = {}
|
|
|
|
path = config.get("ffmpeg", {}).get("path", "default")
|
|
if path == "default":
|
|
print(f"/usr/lib/ffmpeg/{DEFAULT_FFMPEG_VERSION}/bin/ffmpeg")
|
|
elif path in INCLUDED_FFMPEG_VERSIONS:
|
|
print(f"/usr/lib/ffmpeg/{path}/bin/ffmpeg")
|
|
else:
|
|
print(f"{path}/bin/ffmpeg")
|