Migrate export filenames

This commit is contained in:
Nicolas Mowen 2024-04-17 06:49:09 -06:00
parent 392ff1319d
commit 57044da3c3

View File

@ -6,7 +6,7 @@ import shutil
from ruamel.yaml import YAML from ruamel.yaml import YAML
from frigate.const import CONFIG_DIR from frigate.const import CONFIG_DIR, EXPORT_DIR
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -46,6 +46,14 @@ def migrate_frigate_config(config_file: str):
yaml.dump(new_config, f) yaml.dump(new_config, f)
previous_version = 0.14 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: with open(version_file, "w") as f:
f.write(str(CURRENT_CONFIG_VERSION)) f.write(str(CURRENT_CONFIG_VERSION))