From cd87f3e6f47854718a8058e74558ebbea8e5c151 Mon Sep 17 00:00:00 2001 From: Blake Blackshear Date: Thu, 21 Oct 2021 20:46:25 -0500 Subject: [PATCH] fix old style recording cleanup --- frigate/record.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/frigate/record.py b/frigate/record.py index b26551c9c..8dc1b9186 100644 --- a/frigate/record.py +++ b/frigate/record.py @@ -290,9 +290,7 @@ class RecordingCleanup(threading.Thread): # find all the recordings older than the oldest recording in the db try: - oldest_recording = ( - Recordings.select().order_by(Recordings.start_time.desc()).get() - ) + oldest_recording = Recordings.select().order_by(Recordings.start_time).get() p = Path(oldest_recording.path) oldest_timestamp = p.stat().st_mtime - 1 @@ -301,7 +299,7 @@ class RecordingCleanup(threading.Thread): logger.debug(f"Oldest recording in the db: {oldest_timestamp}") process = sp.run( - ["find", RECORD_DIR, "-type", "f", "-newermt", f"@{oldest_timestamp}"], + ["find", RECORD_DIR, "-type", "f", "!", "-newermt", f"@{oldest_timestamp}"], capture_output=True, text=True, )