From 3d70d2967234f1341d136e8bec66420e82845325 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Mon, 30 Oct 2023 18:24:11 -0600 Subject: [PATCH] Delete export if it fails (#8381) * Delete export if it fails * Fix import --- frigate/record/export.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/frigate/record/export.py b/frigate/record/export.py index f608853fc..65ebf13c9 100644 --- a/frigate/record/export.py +++ b/frigate/record/export.py @@ -6,6 +6,7 @@ import os import subprocess as sp import threading from enum import Enum +from pathlib import Path from frigate.config import FrigateConfig from frigate.const import EXPORT_DIR, MAX_PLAYLIST_SECONDS @@ -121,6 +122,7 @@ class RecordingExporter(threading.Thread): f"Failed to export recording for command {' '.join(ffmpeg_cmd)}" ) logger.error(p.stderr) + Path(file_name).unlink(missing_ok=True) return logger.debug(f"Updating finalized export {file_name}")