Skip to content

Commit

Permalink
only save the event to the database if a snapshot or clip exists
Browse files Browse the repository at this point in the history
  • Loading branch information
blakeblackshear committed Feb 20, 2021
1 parent a803ab8 commit 1b85e56
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions frigate/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,12 @@ def run(self):
if event_type == 'end':
clips_config = self.config.cameras[camera].clips

clip_created = False
if self.should_create_clip(camera, event_data):
clip_created = False
if clips_config.enabled and (clips_config.objects is None or event_data['label'] in clips_config.objects):
clip_created = self.create_clip(camera, event_data, clips_config.pre_capture, clips_config.post_capture)


if clip_created or event_data['has_snapshot']:
Event.create(
id=event_data['id'],
label=event_data['label'],
Expand Down

0 comments on commit 1b85e56

Please sign in to comment.