mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
Fix audio events not being ended (#6981)
* Fix audio events not being ended * Fix audio events not being ended correctly * Clean up debug code
This commit is contained in:
parent
7ee17c7af8
commit
c25367221e
@ -202,11 +202,13 @@ class AudioEventMaintainer(threading.Thread):
|
|||||||
now = datetime.datetime.now().timestamp()
|
now = datetime.datetime.now().timestamp()
|
||||||
|
|
||||||
for detection in self.detections.values():
|
for detection in self.detections.values():
|
||||||
|
if not detection:
|
||||||
|
continue
|
||||||
|
|
||||||
if (
|
if (
|
||||||
now - detection.get("last_detection", now)
|
now - detection.get("last_detection", now)
|
||||||
> self.config.audio.max_not_heard
|
> self.config.audio.max_not_heard
|
||||||
):
|
):
|
||||||
del self.detections[detection["label"]]
|
|
||||||
requests.put(
|
requests.put(
|
||||||
f"{FRIGATE_LOCALHOST}/api/events/{detection['id']}/end",
|
f"{FRIGATE_LOCALHOST}/api/events/{detection['id']}/end",
|
||||||
json={
|
json={
|
||||||
@ -214,6 +216,7 @@ class AudioEventMaintainer(threading.Thread):
|
|||||||
+ self.config.record.events.post_capture
|
+ self.config.record.events.post_capture
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
self.detections[detection["label"]] = None
|
||||||
|
|
||||||
def restart_audio_pipe(self) -> None:
|
def restart_audio_pipe(self) -> None:
|
||||||
try:
|
try:
|
||||||
|
@ -239,6 +239,6 @@ class EventProcessor(threading.Thread):
|
|||||||
}
|
}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
Event.update(event).execute()
|
Event.update(event).where(Event.id == event_data["id"]).execute()
|
||||||
except Exception:
|
except Exception:
|
||||||
logger.warning(f"Failed to update manual event: {event_data['id']}")
|
logger.warning(f"Failed to update manual event: {event_data['id']}")
|
||||||
|
Loading…
Reference in New Issue
Block a user