remove sync_recordings and add config migrator

This commit is contained in:
Josh Hawkins 2026-01-04 11:48:12 -06:00
parent b708055de8
commit c0a30fe3a4
2 changed files with 29 additions and 4 deletions

View File

@ -77,9 +77,6 @@ class RecordExportConfig(FrigateBaseModel):
class RecordConfig(FrigateBaseModel): class RecordConfig(FrigateBaseModel):
enabled: bool = Field(default=False, title="Enable record on all cameras.") enabled: bool = Field(default=False, title="Enable record on all cameras.")
sync_recordings: bool = Field(
default=False, title="Sync recordings with disk on startup and once a day."
)
expire_interval: int = Field( expire_interval: int = Field(
default=60, default=60,
title="Number of minutes to wait between cleanup runs.", title="Number of minutes to wait between cleanup runs.",

View File

@ -13,7 +13,7 @@ from frigate.util.services import get_video_properties
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
CURRENT_CONFIG_VERSION = "0.17-0" CURRENT_CONFIG_VERSION = "0.18-0"
DEFAULT_CONFIG_FILE = os.path.join(CONFIG_DIR, "config.yml") DEFAULT_CONFIG_FILE = os.path.join(CONFIG_DIR, "config.yml")
@ -98,6 +98,13 @@ def migrate_frigate_config(config_file: str):
yaml.dump(new_config, f) yaml.dump(new_config, f)
previous_version = "0.17-0" previous_version = "0.17-0"
if previous_version < "0.18-0":
logger.info(f"Migrating frigate config from {previous_version} to 0.18-0...")
new_config = migrate_018_0(config)
with open(config_file, "w") as f:
yaml.dump(new_config, f)
previous_version = "0.18-0"
logger.info("Finished frigate config migration...") logger.info("Finished frigate config migration...")
@ -427,6 +434,27 @@ def migrate_017_0(config: dict[str, dict[str, Any]]) -> dict[str, dict[str, Any]
return new_config return new_config
def migrate_018_0(config: dict[str, dict[str, Any]]) -> dict[str, dict[str, Any]]:
"""Handle migrating frigate config to 0.18-0"""
new_config = config.copy()
# Remove deprecated sync_recordings from global record config
if new_config.get("record", {}).get("sync_recordings") is not None:
del new_config["record"]["sync_recordings"]
# Remove deprecated sync_recordings from camera-specific record configs
for name, camera in config.get("cameras", {}).items():
camera_config: dict[str, dict[str, Any]] = camera.copy()
if camera_config.get("record", {}).get("sync_recordings") is not None:
del camera_config["record"]["sync_recordings"]
new_config["cameras"][name] = camera_config
new_config["version"] = "0.18-0"
return new_config
def get_relative_coordinates( def get_relative_coordinates(
mask: Optional[Union[str, list]], frame_shape: tuple[int, int] mask: Optional[Union[str, list]], frame_shape: tuple[int, int]
) -> Union[str, list]: ) -> Union[str, list]: