Refactor audio event detection and HTTP event creation to use constants and enums respectively

This commit is contained in:
Sergey Krashevich 2023-08-24 21:46:59 +03:00
parent 7c629c1874
commit 7b40390826
No known key found for this signature in database
GPG Key ID: 625171324E7D3856
2 changed files with 3 additions and 2 deletions

View File

@ -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)

View File

@ -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),