From 8230813b795c1b3d3669a463111e10e02d005299 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Wed, 17 Apr 2024 15:26:16 -0600 Subject: [PATCH] Migrate export filenames (#11005) * Migrate export filenames * formatting * Remove test.yaml saving --- frigate/util/builtin.py | 2 -- frigate/util/config.py | 12 +++++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/frigate/util/builtin.py b/frigate/util/builtin.py index be91421f9..1536d9799 100644 --- a/frigate/util/builtin.py +++ b/frigate/util/builtin.py @@ -223,8 +223,6 @@ def update_yaml_file(file_path, key_path, new_value): data = yaml.load(f) data = update_yaml(data, key_path, new_value) - with open("/config/test.yaml", "w") as f: - yaml.dump(data, f) with open(file_path, "w") as f: yaml.dump(data, f) diff --git a/frigate/util/config.py b/frigate/util/config.py index fb7aa3ef5..1192ac9de 100644 --- a/frigate/util/config.py +++ b/frigate/util/config.py @@ -6,7 +6,7 @@ import shutil from ruamel.yaml import YAML -from frigate.const import CONFIG_DIR +from frigate.const import CONFIG_DIR, EXPORT_DIR logger = logging.getLogger(__name__) @@ -46,6 +46,16 @@ def migrate_frigate_config(config_file: str): yaml.dump(new_config, f) previous_version = 0.14 + logger.info("Migrating export file names...") + for file in os.listdir(EXPORT_DIR): + if "@" not in file: + continue + + new_name = file.replace("@", "_") + os.rename( + os.path.join(EXPORT_DIR, file), os.path.join(EXPORT_DIR, new_name) + ) + with open(version_file, "w") as f: f.write(str(CURRENT_CONFIG_VERSION))