only save events when a clip is created

This commit is contained in:
Blake Blackshear 2020-11-15 14:41:27 -06:00
parent 1b5b02d286
commit 00c75e9f98

View File

@ -172,6 +172,8 @@ class EventProcessor(threading.Thread):
self.events_in_process[event_data['id']] = event_data
if event_type == 'end':
if len(self.cached_clips) > 0 and not event_data['false_positive']:
self.create_clip(camera, event_data, save_clips_config.pre_capture)
Event.create(
id=event_data['id'],
label=event_data['label'],
@ -183,9 +185,6 @@ class EventProcessor(threading.Thread):
zones=list(event_data['entered_zones']),
thumbnail=event_data['thumbnail']
)
if len(self.cached_clips) > 0 and not event_data['false_positive']:
self.create_clip(camera, event_data, save_clips_config.pre_capture)
del self.events_in_process[event_data['id']]