mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-03-31 20:34:53 +03:00
add wildcard support for camera config updates in config_set
This commit is contained in:
parent
9cbd007b77
commit
4ba33184a3
@ -596,6 +596,18 @@ def config_set(request: Request, body: AppConfigSetBody):
|
|||||||
if body.update_topic.startswith("config/cameras/"):
|
if body.update_topic.startswith("config/cameras/"):
|
||||||
_, _, camera, field = body.update_topic.split("/")
|
_, _, camera, field = body.update_topic.split("/")
|
||||||
|
|
||||||
|
if camera == "*":
|
||||||
|
# Wildcard: fan out update to all cameras
|
||||||
|
enum_value = CameraConfigUpdateEnum[field]
|
||||||
|
for camera_name in config.cameras:
|
||||||
|
settings = config.get_nested_object(
|
||||||
|
f"config/cameras/{camera_name}/{field}"
|
||||||
|
)
|
||||||
|
request.app.config_publisher.publish_update(
|
||||||
|
CameraConfigUpdateTopic(enum_value, camera_name),
|
||||||
|
settings,
|
||||||
|
)
|
||||||
|
else:
|
||||||
if field == "add":
|
if field == "add":
|
||||||
settings = config.cameras[camera]
|
settings = config.cameras[camera]
|
||||||
elif field == "remove":
|
elif field == "remove":
|
||||||
@ -604,9 +616,7 @@ def config_set(request: Request, body: AppConfigSetBody):
|
|||||||
settings = config.get_nested_object(body.update_topic)
|
settings = config.get_nested_object(body.update_topic)
|
||||||
|
|
||||||
request.app.config_publisher.publish_update(
|
request.app.config_publisher.publish_update(
|
||||||
CameraConfigUpdateTopic(
|
CameraConfigUpdateTopic(CameraConfigUpdateEnum[field], camera),
|
||||||
CameraConfigUpdateEnum[field], camera
|
|
||||||
),
|
|
||||||
settings,
|
settings,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user