From a5c72db8558a96586e890dcddb251c0542e4228a Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Mon, 12 May 2025 07:54:37 -0600 Subject: [PATCH] Delete review thumbnails --- frigate/record/cleanup.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frigate/record/cleanup.py b/frigate/record/cleanup.py index c86c81859..1de08a899 100644 --- a/frigate/record/cleanup.py +++ b/frigate/record/cleanup.py @@ -69,7 +69,7 @@ class RecordingCleanup(threading.Thread): now - datetime.timedelta(days=config.record.detections.retain.days) ).timestamp() expired_reviews: ReviewSegment = ( - ReviewSegment.select(ReviewSegment.id) + ReviewSegment.select(ReviewSegment.id, ReviewSegment.thumb_path) .where(ReviewSegment.camera == config.name) .where( ( @@ -84,6 +84,10 @@ class RecordingCleanup(threading.Thread): .namedtuples() ) + thumbs_to_delete = list(map(lambda x: x[1], expired_reviews)) + for thumb_path in thumbs_to_delete: + Path(thumb_path).unlink(missing_ok=True) + max_deletes = 100000 deleted_reviews_list = list(map(lambda x: x[0], expired_reviews)) for i in range(0, len(deleted_reviews_list), max_deletes):