mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-05-01 19:17:41 +03:00
update dispatcher with live transcription topic
This commit is contained in:
parent
c61f3524cc
commit
21f4c52f35
@ -58,6 +58,7 @@ class Dispatcher:
|
|||||||
|
|
||||||
self._camera_settings_handlers: dict[str, Callable] = {
|
self._camera_settings_handlers: dict[str, Callable] = {
|
||||||
"audio": self._on_audio_command,
|
"audio": self._on_audio_command,
|
||||||
|
"audio_transcription": self._on_audio_transcription_command,
|
||||||
"detect": self._on_detect_command,
|
"detect": self._on_detect_command,
|
||||||
"enabled": self._on_enabled_command,
|
"enabled": self._on_enabled_command,
|
||||||
"improve_contrast": self._on_motion_improve_contrast_command,
|
"improve_contrast": self._on_motion_improve_contrast_command,
|
||||||
@ -181,6 +182,9 @@ class Dispatcher:
|
|||||||
"snapshots": self.config.cameras[camera].snapshots.enabled,
|
"snapshots": self.config.cameras[camera].snapshots.enabled,
|
||||||
"record": self.config.cameras[camera].record.enabled,
|
"record": self.config.cameras[camera].record.enabled,
|
||||||
"audio": self.config.cameras[camera].audio.enabled,
|
"audio": self.config.cameras[camera].audio.enabled,
|
||||||
|
"audio_transcription": self.config.cameras[
|
||||||
|
camera
|
||||||
|
].audio_transcription.live_enabled,
|
||||||
"notifications": self.config.cameras[camera].notifications.enabled,
|
"notifications": self.config.cameras[camera].notifications.enabled,
|
||||||
"notifications_suspended": int(
|
"notifications_suspended": int(
|
||||||
self.web_push_client.suspended_cameras.get(camera, 0)
|
self.web_push_client.suspended_cameras.get(camera, 0)
|
||||||
@ -465,6 +469,37 @@ class Dispatcher:
|
|||||||
)
|
)
|
||||||
self.publish(f"{camera_name}/audio/state", payload, retain=True)
|
self.publish(f"{camera_name}/audio/state", payload, retain=True)
|
||||||
|
|
||||||
|
def _on_audio_transcription_command(self, camera_name: str, payload: str) -> None:
|
||||||
|
"""Callback for live audio transcription topic."""
|
||||||
|
audio_transcription_settings = self.config.cameras[
|
||||||
|
camera_name
|
||||||
|
].audio_transcription
|
||||||
|
|
||||||
|
if payload == "ON":
|
||||||
|
if not self.config.cameras[
|
||||||
|
camera_name
|
||||||
|
].audio_transcription.enabled_in_config:
|
||||||
|
logger.error(
|
||||||
|
"Audio transcription must be enabled in the config to be turned on via MQTT."
|
||||||
|
)
|
||||||
|
return
|
||||||
|
|
||||||
|
if not audio_transcription_settings.live_enabled:
|
||||||
|
logger.info(f"Turning on live audio transcription for {camera_name}")
|
||||||
|
audio_transcription_settings.live_enabled = True
|
||||||
|
elif payload == "OFF":
|
||||||
|
if audio_transcription_settings.live_enabled:
|
||||||
|
logger.info(f"Turning off live audio transcription for {camera_name}")
|
||||||
|
audio_transcription_settings.live_enabled = False
|
||||||
|
|
||||||
|
self.config_updater.publish_update(
|
||||||
|
CameraConfigUpdateTopic(
|
||||||
|
CameraConfigUpdateEnum.audio_transcription, camera_name
|
||||||
|
),
|
||||||
|
audio_transcription_settings,
|
||||||
|
)
|
||||||
|
self.publish(f"{camera_name}/audio_transcription/state", payload, retain=True)
|
||||||
|
|
||||||
def _on_recordings_command(self, camera_name: str, payload: str) -> None:
|
def _on_recordings_command(self, camera_name: str, payload: str) -> None:
|
||||||
"""Callback for recordings topic."""
|
"""Callback for recordings topic."""
|
||||||
record_settings = self.config.cameras[camera_name].record
|
record_settings = self.config.cameras[camera_name].record
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user