Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix audio events not being ended #6981

Merged
merged 3 commits into from Jul 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion frigate/events/audio.py
Expand Up @@ -202,18 +202,21 @@ def expire_detections(self) -> None:
now = datetime.datetime.now().timestamp()

for detection in self.detections.values():
if not detection:
continue

if (
now - detection.get("last_detection", now)
> self.config.audio.max_not_heard
):
del self.detections[detection["label"]]
requests.put(
f"{FRIGATE_LOCALHOST}/api/events/{detection['id']}/end",
json={
"end_time": detection["last_detection"]
+ self.config.record.events.post_capture
},
)
self.detections[detection["label"]] = None

def restart_audio_pipe(self) -> None:
try:
Expand Down
2 changes: 1 addition & 1 deletion frigate/events/maintainer.py
Expand Up @@ -239,6 +239,6 @@ def handle_external_detection(self, type: str, event_data: Event) -> None:
}

try:
Event.update(event).execute()
Event.update(event).where(Event.id == event_data["id"]).execute()
except Exception:
logger.warning(f"Failed to update manual event: {event_data['id']}")