From 173eaabddf5e52ed97e38cd1e65654247286decd Mon Sep 17 00:00:00 2001 From: Blake Blackshear Date: Fri, 19 Nov 2021 16:56:00 -0600 Subject: [PATCH] add duration to cache --- frigate/record.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/frigate/record.py b/frigate/record.py index bfa1f24d5..56bc37b7e 100644 --- a/frigate/record.py +++ b/frigate/record.py @@ -129,7 +129,7 @@ class RecordingMaintainer(threading.Thread): continue if cache_path in self.end_time_cache: - end_time = self.end_time_cache[cache_path] + end_time, duration = self.end_time_cache[cache_path] else: ffprobe_cmd = [ "ffprobe", @@ -144,9 +144,8 @@ class RecordingMaintainer(threading.Thread): p = sp.run(ffprobe_cmd, capture_output=True) if p.returncode == 0: duration = float(p.stdout.decode().strip()) - self.end_time_cache[ - cache_path - ] = end_time = start_time + datetime.timedelta(seconds=duration) + end_time = start_time + datetime.timedelta(seconds=duration) + self.end_time_cache[cache_path] = (end_time, duration) else: logger.warning(f"Discarding a corrupt recording segment: {f}") Path(cache_path).unlink(missing_ok=True)