mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-01-02 00:07:11 +01:00
fix birdseye config
This commit is contained in:
parent
b86b2d6602
commit
a1afade9ba
@ -326,7 +326,8 @@ class BirdseyeConfig(FrigateBaseModel):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class BirdseyeCameraConfig(FrigateBaseModel):
|
# uses BaseModel because some global attributes are not available at the camera level
|
||||||
|
class BirdseyeCameraConfig(BaseModel):
|
||||||
enabled: bool = Field(default=True, title="Enable birdseye view for camera.")
|
enabled: bool = Field(default=True, title="Enable birdseye view for camera.")
|
||||||
mode: BirdseyeModeEnum = Field(
|
mode: BirdseyeModeEnum = Field(
|
||||||
default=BirdseyeModeEnum.objects, title="Tracking mode for camera."
|
default=BirdseyeModeEnum.objects, title="Tracking mode for camera."
|
||||||
|
@ -84,7 +84,7 @@ class TestConfig(unittest.TestCase):
|
|||||||
def test_override_birdseye(self):
|
def test_override_birdseye(self):
|
||||||
config = {
|
config = {
|
||||||
"mqtt": {"host": "mqtt"},
|
"mqtt": {"host": "mqtt"},
|
||||||
"birdseye": { "enabled": True, "mode": "continuous" },
|
"birdseye": {"enabled": True, "mode": "continuous"},
|
||||||
"cameras": {
|
"cameras": {
|
||||||
"back": {
|
"back": {
|
||||||
"ffmpeg": {
|
"ffmpeg": {
|
||||||
@ -97,10 +97,7 @@ class TestConfig(unittest.TestCase):
|
|||||||
"width": 1920,
|
"width": 1920,
|
||||||
"fps": 5,
|
"fps": 5,
|
||||||
},
|
},
|
||||||
"birdseye": {
|
"birdseye": {"enabled": False, "mode": "motion"},
|
||||||
"enabled": False,
|
|
||||||
"mode": "motion"
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -111,10 +108,10 @@ class TestConfig(unittest.TestCase):
|
|||||||
assert not runtime_config.cameras["back"].birdseye.enabled
|
assert not runtime_config.cameras["back"].birdseye.enabled
|
||||||
assert runtime_config.cameras["back"].birdseye.mode is BirdseyeModeEnum.motion
|
assert runtime_config.cameras["back"].birdseye.mode is BirdseyeModeEnum.motion
|
||||||
|
|
||||||
def test_inherit_birdseye(self):
|
def test_override_birdseye_non_inheritable(self):
|
||||||
config = {
|
config = {
|
||||||
"mqtt": {"host": "mqtt"},
|
"mqtt": {"host": "mqtt"},
|
||||||
"birdseye": { "enabled": True, "mode": "continuous" },
|
"birdseye": {"enabled": True, "mode": "continuous", "height": 1920},
|
||||||
"cameras": {
|
"cameras": {
|
||||||
"back": {
|
"back": {
|
||||||
"ffmpeg": {
|
"ffmpeg": {
|
||||||
@ -135,7 +132,34 @@ class TestConfig(unittest.TestCase):
|
|||||||
|
|
||||||
runtime_config = frigate_config.runtime_config
|
runtime_config = frigate_config.runtime_config
|
||||||
assert runtime_config.cameras["back"].birdseye.enabled
|
assert runtime_config.cameras["back"].birdseye.enabled
|
||||||
assert runtime_config.cameras["back"].birdseye.mode is BirdseyeModeEnum.continuous
|
|
||||||
|
def test_inherit_birdseye(self):
|
||||||
|
config = {
|
||||||
|
"mqtt": {"host": "mqtt"},
|
||||||
|
"birdseye": {"enabled": True, "mode": "continuous"},
|
||||||
|
"cameras": {
|
||||||
|
"back": {
|
||||||
|
"ffmpeg": {
|
||||||
|
"inputs": [
|
||||||
|
{"path": "rtsp://10.0.0.1:554/video", "roles": ["detect"]}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"detect": {
|
||||||
|
"height": 1080,
|
||||||
|
"width": 1920,
|
||||||
|
"fps": 5,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
frigate_config = FrigateConfig(**config)
|
||||||
|
assert config == frigate_config.dict(exclude_unset=True)
|
||||||
|
|
||||||
|
runtime_config = frigate_config.runtime_config
|
||||||
|
assert runtime_config.cameras["back"].birdseye.enabled
|
||||||
|
assert (
|
||||||
|
runtime_config.cameras["back"].birdseye.mode is BirdseyeModeEnum.continuous
|
||||||
|
)
|
||||||
|
|
||||||
def test_override_tracked_objects(self):
|
def test_override_tracked_objects(self):
|
||||||
config = {
|
config = {
|
||||||
|
Loading…
Reference in New Issue
Block a user