NVR with realtime local object detection for IP cameras
TypeScript aicameragoogle-coralhome-assistanthome-automationhomeautomationmqttnvrobject-detectionrealtimertsptensorflow
Cleanup timeline entries when relevant recording segments are removed (#6319)
Nicolas Mowenca7790ff65c9
diff --git a/frigate/record/cleanup.py b/frigate/record/cleanup.pyindex 74c7eadf2e..d649a2d876 100644--- a/frigate/record/cleanup.py+++ b/frigate/record/cleanup.py@@ -12,7 +12,7 @@ from multiprocessing.synchronize import Event as MpEventfrom frigate.config import RetainModeEnum, FrigateConfigfrom frigate.const import RECORD_DIR, SECONDS_IN_DAY-from frigate.models import Event, Recordings+from frigate.models import Event, Recordings, Timelinefrom frigate.record.util import remove_empty_directorieslogger = logging.getLogger(__name__)@@ -140,6 +140,15 @@ class RecordingCleanup(threading.Thread):Path(recording.path).unlink(missing_ok=True)deleted_recordings.add(recording.id)+ # delete timeline entries relevant to this recording segment+ Timeline.delete(+ Timeline.timestamp.between(+ recording.start_time, recording.end_time+ ),+ Timeline.timestamp < expire_date,+ Timeline.camera == camera,+ ).execute()+logger.debug(f"Expiring {len(deleted_recordings)} recordings")# delete up to 100,000 at a timemax_deletes = 100000