Skip to content

NVR with realtime local object detection for IP cameras

Don't fail when preview restore fails (#12022)

Nicolas Mowen24770148a79d
diff --git a/frigate/output/output.py b/frigate/output/output.py
index d257f785c0..e458d3242e 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
-
- shutil.move(preview_holdover, preview_cache)
+ 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)
+ except shutil.Error:
+ logger.error("Failed to restore preview cache.")