Recordings - fix expire_file

This commit is contained in:
kluszczyn 2020-12-22 01:17:25 +01:00 committed by Blake Blackshear
parent e9b3b09cc2
commit 2bc8736fd9

View File

@ -98,9 +98,9 @@ class RecordingMaintainer(threading.Thread):
delete_before[name] = datetime.datetime.now().timestamp() - SECONDS_IN_DAY*camera.record.retain_days delete_before[name] = datetime.datetime.now().timestamp() - SECONDS_IN_DAY*camera.record.retain_days
for p in Path('/media/frigate/recordings').rglob("*.mp4"): for p in Path('/media/frigate/recordings').rglob("*.mp4"):
if not p.parent in delete_before: if not p.parent.name in delete_before:
continue continue
if p.stat().st_mtime < delete_before[p.parent]: if p.stat().st_mtime < delete_before[p.parent.name]:
p.unlink(missing_ok=True) p.unlink(missing_ok=True)
def run(self): def run(self):