mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-08-02 09:02:15 +03:00
Dynamically update masks and zones for cameras (#18359)
* Include config publisher in api * Call update topic for passed topics * Update zones dynamically * Update zones internally * Support zone and mask reset * Handle updating objects config * Don't put status for needing to restart Frigate * Cleanup http tests * Fix tests
This commit is contained in:
committed by
Blake Blackshear
parent
dc187eee1c
commit
4dc526761c
@@ -1,5 +1,29 @@
|
||||
from typing import Any
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
|
||||
class FrigateBaseModel(BaseModel):
|
||||
model_config = ConfigDict(extra="forbid", protected_namespaces=())
|
||||
|
||||
def get_nested_object(self, path: str) -> Any:
|
||||
parts = path.split("/")
|
||||
obj = self
|
||||
for part in parts:
|
||||
if part == "config":
|
||||
continue
|
||||
|
||||
if isinstance(obj, BaseModel):
|
||||
try:
|
||||
obj = getattr(obj, part)
|
||||
except AttributeError:
|
||||
return None
|
||||
elif isinstance(obj, dict):
|
||||
try:
|
||||
obj = obj[part]
|
||||
except KeyError:
|
||||
return None
|
||||
else:
|
||||
return None
|
||||
|
||||
return obj
|
||||
|
||||
Reference in New Issue
Block a user