mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
ensure each camera has a detect role set
This commit is contained in:
parent
89e02b6956
commit
c1f0750526
@ -146,6 +146,12 @@ def each_role_used_once(inputs):
|
||||
raise ValueError
|
||||
return inputs
|
||||
|
||||
def detect_is_required(inputs):
|
||||
roles = [role for i in inputs for role in i['roles']]
|
||||
if not 'detect' in roles:
|
||||
raise ValueError
|
||||
return inputs
|
||||
|
||||
CAMERA_FFMPEG_SCHEMA = vol.Schema(
|
||||
{
|
||||
vol.Required('inputs'): vol.All([{
|
||||
@ -154,7 +160,8 @@ CAMERA_FFMPEG_SCHEMA = vol.Schema(
|
||||
'global_args': vol.Any(str, [str]),
|
||||
'hwaccel_args': vol.Any(str, [str]),
|
||||
'input_args': vol.Any(str, [str]),
|
||||
}], vol.Msg(each_role_used_once, msg="Each input role may only be used once")),
|
||||
}], vol.Msg(each_role_used_once, msg="Each input role may only be used once"),
|
||||
vol.Msg(detect_is_required, msg="The detect role is required")),
|
||||
'output_args': {
|
||||
vol.Optional('detect', default=DETECT_FFMPEG_OUTPUT_ARGS_DEFAULT): vol.Any(str, [str]),
|
||||
vol.Optional('record', default=RECORD_FFMPEG_OUTPUT_ARGS_DEFAULT): vol.Any(str, [str]),
|
||||
|
Loading…
Reference in New Issue
Block a user