mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-05-04 23:14:12 +02:00
Dynamic Management of Cameras (#18671)
* Add base class for global config updates * Add or remove camera states * Move camera process management to separate thread * Move camera management fully to separate class * Cleanup * Stop camera processes when stop command is sent * Start processes dynamically when needed * Adjust * Leave extra room in tracked object queue for two cameras * Dynamically set extra config pieces * Add some TODOs * Fix type check * Simplify config updates * Improve typing * Correctly handle indexed entries * Cleanup * Create out SHM * Use ZMQ for signaling object detectoin is completed * Get camera correctly created * Cleanup for updating the cameras config * Cleanup * Don't enable audio if no cameras have audio transcription * Use exact string so similar camera names don't interfere * Add ability to update config via json body to config/set endpoint Additionally, update the config in a single rather than multiple calls for each updated key * fix autotracking calibration to support new config updater function --------- Co-authored-by: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com>
This commit is contained in:
committed by
Blake Blackshear
parent
4b57e5e265
commit
faadea8e1f
21
frigate/comms/object_detector_signaler.py
Normal file
21
frigate/comms/object_detector_signaler.py
Normal file
@@ -0,0 +1,21 @@
|
||||
"""Facilitates communication between processes for object detection signals."""
|
||||
|
||||
from .zmq_proxy import Publisher, Subscriber
|
||||
|
||||
|
||||
class ObjectDetectorPublisher(Publisher):
|
||||
"""Publishes signal for object detection to different processes."""
|
||||
|
||||
topic_base = "object_detector/"
|
||||
|
||||
|
||||
class ObjectDetectorSubscriber(Subscriber):
|
||||
"""Simplifies receiving a signal for object detection."""
|
||||
|
||||
topic_base = "object_detector/"
|
||||
|
||||
def __init__(self, topic: str) -> None:
|
||||
super().__init__(topic)
|
||||
|
||||
def check_for_update(self):
|
||||
return super().check_for_update(timeout=5)
|
||||
@@ -81,7 +81,7 @@ class WebPushClient(Communicator): # type: ignore[misc]
|
||||
"config/notifications", exact=True
|
||||
)
|
||||
self.config_subscriber = CameraConfigUpdateSubscriber(
|
||||
self.config.cameras, [CameraConfigUpdateEnum.notifications]
|
||||
self.config, self.config.cameras, [CameraConfigUpdateEnum.notifications]
|
||||
)
|
||||
|
||||
def subscribe(self, receiver: Callable) -> None:
|
||||
@@ -170,7 +170,12 @@ class WebPushClient(Communicator): # type: ignore[misc]
|
||||
if updated_notification_config:
|
||||
self.config.notifications = updated_notification_config
|
||||
|
||||
self.config_subscriber.check_for_updates()
|
||||
updates = self.config_subscriber.check_for_updates()
|
||||
|
||||
if "add" in updates:
|
||||
for camera in updates["add"]:
|
||||
self.suspended_cameras[camera] = 0
|
||||
self.last_camera_notification_time[camera] = 0
|
||||
|
||||
if topic == "reviews":
|
||||
decoded = json.loads(payload)
|
||||
|
||||
Reference in New Issue
Block a user