mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
End audio event and update detections if successful, otherwise log a warning if ending audio event fails with a specific status code (#6984)
This commit is contained in:
parent
1171f01683
commit
12d4a47e3d
@ -209,14 +209,19 @@ class AudioEventMaintainer(threading.Thread):
|
|||||||
now - detection.get("last_detection", now)
|
now - detection.get("last_detection", now)
|
||||||
> self.config.audio.max_not_heard
|
> self.config.audio.max_not_heard
|
||||||
):
|
):
|
||||||
requests.put(
|
resp = requests.put(
|
||||||
f"{FRIGATE_LOCALHOST}/api/events/{detection['id']}/end",
|
f"{FRIGATE_LOCALHOST}/api/events/{detection['id']}/end",
|
||||||
json={
|
json={
|
||||||
"end_time": detection["last_detection"]
|
"end_time": detection["last_detection"]
|
||||||
+ self.config.record.events.post_capture
|
+ self.config.record.events.post_capture
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
self.detections[detection["label"]] = None
|
if resp.status_code == 200:
|
||||||
|
self.detections[detection["label"]] = None
|
||||||
|
else:
|
||||||
|
logger.warn(
|
||||||
|
f"Failed to end audio event {detection['id']} with status code {resp.status_code}"
|
||||||
|
)
|
||||||
|
|
||||||
def restart_audio_pipe(self) -> None:
|
def restart_audio_pipe(self) -> None:
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user