mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-03-04 06:33:45 +00:00
Delete review thumbnails
This commit is contained in:
parent
170688cc4c
commit
a5c72db855
@ -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):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user