This commit is contained in:
Nick Mowen 2023-06-09 08:58:00 -06:00
parent f6efd930eb
commit ca27996704
3 changed files with 9 additions and 9 deletions

View File

@ -52,7 +52,7 @@ class EventCleanup(threading.Thread):
Event.camera.not_in(self.camera_keys),
Event.start_time < expire_after,
Event.label == event.label,
Event.retain_indefinitely is False,
Event.retain_indefinitely == False,
)
# delete the media from disk
for event in expired_events:
@ -72,7 +72,7 @@ class EventCleanup(threading.Thread):
Event.camera.not_in(self.camera_keys),
Event.start_time < expire_after,
Event.label == event.label,
Event.retain_indefinitely is False,
Event.retain_indefinitely == False,
)
update_query.execute()
@ -101,7 +101,7 @@ class EventCleanup(threading.Thread):
Event.camera == name,
Event.start_time < expire_after,
Event.label == event.label,
Event.retain_indefinitely is False,
Event.retain_indefinitely == False,
)
# delete the grabbed clips from disk
for event in expired_events:
@ -120,7 +120,7 @@ class EventCleanup(threading.Thread):
Event.camera == name,
Event.start_time < expire_after,
Event.label == event.label,
Event.retain_indefinitely is False,
Event.retain_indefinitely == False,
)
update_query.execute()
@ -167,7 +167,7 @@ class EventCleanup(threading.Thread):
# drop events from db where has_clip and has_snapshot are false
delete_query = Event.delete().where(
Event.has_clip is False, Event.has_snapshot is False
Event.has_clip == False, Event.has_snapshot == False
)
delete_query.execute()

View File

@ -591,7 +591,7 @@ def event_snapshot(id):
event_complete = False
jpg_bytes = None
try:
event = Event.get(Event.id == id, Event.end_time is not None)
event = Event.get(Event.id == id, Event.end_time != None)
event_complete = True
if not event.has_snapshot:
return "Snapshot not available", 404
@ -643,7 +643,7 @@ def label_snapshot(camera_name, label):
event_query = (
Event.select()
.where(Event.camera == camera_name)
.where(Event.has_snapshot is True)
.where(Event.has_snapshot == True)
.order_by(Event.start_time.desc())
)
else:
@ -651,7 +651,7 @@ def label_snapshot(camera_name, label):
Event.select()
.where(Event.camera == camera_name)
.where(Event.label == label)
.where(Event.has_snapshot is True)
.where(Event.has_snapshot == True)
.order_by(Event.start_time.desc())
)

View File

@ -107,7 +107,7 @@ class StorageMaintainer(threading.Thread):
retained_events: Event = (
Event.select()
.where(
Event.retain_indefinitely is True,
Event.retain_indefinitely == True,
Event.has_clip,
)
.order_by(Event.start_time.asc())