mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-08-08 13:51:01 +02:00
fix rtmp again
This commit is contained in:
parent
76142e9699
commit
26ae6084ea
@ -792,22 +792,21 @@ class FrigateConfig(FrigateBaseModel):
|
|||||||
**camera_config.motion.dict(exclude_unset=True),
|
**camera_config.motion.dict(exclude_unset=True),
|
||||||
)
|
)
|
||||||
|
|
||||||
config.cameras[name] = camera_config
|
|
||||||
|
|
||||||
# check runtime config
|
# check runtime config
|
||||||
for name, camera in config.cameras.items():
|
assigned_roles = list(
|
||||||
assigned_roles = list(
|
set([r for i in camera_config.ffmpeg.inputs for r in i.roles])
|
||||||
set([r for i in camera.ffmpeg.inputs for r in i.roles])
|
)
|
||||||
|
if camera_config.record.enabled and not "record" in assigned_roles:
|
||||||
|
raise ValueError(
|
||||||
|
f"Camera {name} has record enabled, but record is not assigned to an input."
|
||||||
)
|
)
|
||||||
if camera.record.enabled and not "record" in assigned_roles:
|
|
||||||
raise ValueError(
|
|
||||||
f"Camera {name} has record enabled, but record is not assigned to an input."
|
|
||||||
)
|
|
||||||
|
|
||||||
if camera.rtmp.enabled and not "rtmp" in assigned_roles:
|
if camera_config.rtmp.enabled and not "rtmp" in assigned_roles:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
f"Camera {name} has rtmp enabled, but rtmp is not assigned to an input."
|
f"Camera {name} has rtmp enabled, but rtmp is not assigned to an input."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
config.cameras[name] = camera_config
|
||||||
|
|
||||||
return config
|
return config
|
||||||
|
|
||||||
|
@ -752,6 +752,56 @@ class TestConfig(unittest.TestCase):
|
|||||||
frigate_config = FrigateConfig(**config)
|
frigate_config = FrigateConfig(**config)
|
||||||
self.assertRaises(ValueError, lambda: frigate_config.runtime_config)
|
self.assertRaises(ValueError, lambda: frigate_config.runtime_config)
|
||||||
|
|
||||||
|
def test_works_on_missing_role_multiple_cams(self):
|
||||||
|
|
||||||
|
config = {
|
||||||
|
"mqtt": {"host": "mqtt"},
|
||||||
|
"rtmp": {"enabled": False},
|
||||||
|
"cameras": {
|
||||||
|
"back": {
|
||||||
|
"ffmpeg": {
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"path": "rtsp://10.0.0.1:554/video",
|
||||||
|
"roles": ["detect"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "rtsp://10.0.0.1:554/video2",
|
||||||
|
"roles": ["record"],
|
||||||
|
},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"detect": {
|
||||||
|
"height": 1080,
|
||||||
|
"width": 1920,
|
||||||
|
"fps": 5,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"cam2": {
|
||||||
|
"ffmpeg": {
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"path": "rtsp://10.0.0.1:554/video",
|
||||||
|
"roles": ["detect"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "rtsp://10.0.0.1:554/video2",
|
||||||
|
"roles": ["record"],
|
||||||
|
},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"detect": {
|
||||||
|
"height": 1080,
|
||||||
|
"width": 1920,
|
||||||
|
"fps": 5,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
frigate_config = FrigateConfig(**config)
|
||||||
|
runtime_config = frigate_config.runtime_config
|
||||||
|
|
||||||
def test_global_detect(self):
|
def test_global_detect(self):
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
|
Loading…
Reference in New Issue
Block a user