mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-03-23 08:38:22 +03:00
add wildcard support for camera config updates in config_set
This commit is contained in:
parent
9cbd007b77
commit
4ba33184a3
@ -596,23 +596,33 @@ 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 field == "add":
|
if camera == "*":
|
||||||
settings = config.cameras[camera]
|
# Wildcard: fan out update to all cameras
|
||||||
elif field == "remove":
|
enum_value = CameraConfigUpdateEnum[field]
|
||||||
settings = old_config.cameras[camera]
|
for camera_name in config.cameras:
|
||||||
else:
|
settings = config.get_nested_object(
|
||||||
settings = config.get_nested_object(body.update_topic)
|
f"config/cameras/{camera_name}/{field}"
|
||||||
|
)
|
||||||
request.app.config_publisher.publish_update(
|
request.app.config_publisher.publish_update(
|
||||||
CameraConfigUpdateTopic(
|
CameraConfigUpdateTopic(enum_value, camera_name),
|
||||||
CameraConfigUpdateEnum[field], camera
|
|
||||||
),
|
|
||||||
settings,
|
settings,
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
|
if field == "add":
|
||||||
|
settings = config.cameras[camera]
|
||||||
|
elif field == "remove":
|
||||||
|
settings = old_config.cameras[camera]
|
||||||
else:
|
else:
|
||||||
# Generic handling for global config updates
|
|
||||||
settings = config.get_nested_object(body.update_topic)
|
settings = config.get_nested_object(body.update_topic)
|
||||||
|
|
||||||
|
request.app.config_publisher.publish_update(
|
||||||
|
CameraConfigUpdateTopic(CameraConfigUpdateEnum[field], camera),
|
||||||
|
settings,
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
# Generic handling for global config updates
|
||||||
|
settings = config.get_nested_object(body.update_topic)
|
||||||
|
|
||||||
# Publish None for removal, actual config for add/update
|
# Publish None for removal, actual config for add/update
|
||||||
request.app.config_publisher.publisher.publish(
|
request.app.config_publisher.publisher.publish(
|
||||||
body.update_topic, settings
|
body.update_topic, settings
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user