From 7b40390826abfd30acb1dbc7ca360e58b5285f59 Mon Sep 17 00:00:00 2001 From: Sergey Krashevich Date: Thu, 24 Aug 2023 21:46:59 +0300 Subject: [PATCH] Refactor audio event detection and HTTP event creation to use constants and enums respectively --- frigate/events/audio.py | 2 +- frigate/http.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/frigate/events/audio.py b/frigate/events/audio.py index 911013a38..9dfe85624 100644 --- a/frigate/events/audio.py +++ b/frigate/events/audio.py @@ -199,7 +199,7 @@ class AudioEventMaintainer(threading.Thread): continue if score > dict((self.config.audio.filters or {}).get(label, {})).get( - "threshold", 0.8 + "threshold", AUDIO_MIN_CONFIDENCE ): self.handle_detection(label, score) diff --git a/frigate/http.py b/frigate/http.py index 1cce6968e..a44969a03 100644 --- a/frigate/http.py +++ b/frigate/http.py @@ -38,6 +38,7 @@ from frigate.const import ( RECORD_DIR, ) from frigate.events.external import ExternalEventProcessor +from frigate.events.maintainer import EventTypeEnum from frigate.models import Event, Recordings, Timeline from frigate.object_processing import TrackedObject from frigate.plus import PlusApi @@ -903,7 +904,7 @@ def create_event(camera_name, label): event_id = current_app.external_processor.create_manual_event( camera_name, label, - json.get("source_type", "api"), + json.get("source_type", EventTypeEnum.api), json.get("sub_label", None), json.get("score", 0), json.get("duration", 30),