Migrate export filenames (#11005)

* Migrate export filenames

* formatting

* Remove test.yaml saving
This commit is contained in:
Nicolas Mowen 2024-04-17 15:26:16 -06:00 committed by GitHub
parent 392ff1319d
commit 8230813b79
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 3 deletions

View File

@ -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)

View File

@ -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))