From 24770148a79da5b4d3e93db7ee801d37138c1160 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Mon, 17 Jun 2024 07:56:24 -0600 Subject: [PATCH] Don't fail when preview restore fails (#12022) * Don't fail when preview restore fails * Cleanup --- frigate/output/output.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/frigate/output/output.py b/frigate/output/output.py index d257f785c..e458d3242 100644 --- a/frigate/output/output.py +++ b/frigate/output/output.py @@ -174,10 +174,13 @@ def move_preview_frames(loc: str): preview_holdover = os.path.join(CLIPS_DIR, "preview_restart_cache") preview_cache = os.path.join(CACHE_DIR, "preview_frames") - if loc == "clips": - shutil.move(preview_cache, preview_holdover) - elif loc == "cache": - if not os.path.exists(preview_holdover): - return + try: + if loc == "clips": + shutil.move(preview_cache, preview_holdover) + elif loc == "cache": + if not os.path.exists(preview_holdover): + return - shutil.move(preview_holdover, preview_cache) + shutil.move(preview_holdover, preview_cache) + except shutil.Error: + logger.error("Failed to restore preview cache.")