|
@@ -166,6 +166,12 @@ class DetectorConfig():
|
|
@property
|
|
@property
|
|
def device(self):
|
|
def device(self):
|
|
return self._device
|
|
return self._device
|
|
|
|
+
|
|
|
|
+ def to_dict(self):
|
|
|
|
+ return {
|
|
|
|
+ 'type': self.type,
|
|
|
|
+ 'device': self.device
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
class MqttConfig():
|
|
class MqttConfig():
|
|
@@ -201,6 +207,15 @@ class MqttConfig():
|
|
def password(self):
|
|
def password(self):
|
|
return self._password
|
|
return self._password
|
|
|
|
|
|
|
|
+ def to_dict(self):
|
|
|
|
+ return {
|
|
|
|
+ 'host': self.host,
|
|
|
|
+ 'port': self.port,
|
|
|
|
+ 'topic_prefix': self.topic_prefix,
|
|
|
|
+ 'client_id': self.client_id,
|
|
|
|
+ 'user': self.user
|
|
|
|
+ }
|
|
|
|
+
|
|
class SaveClipsConfig():
|
|
class SaveClipsConfig():
|
|
def __init__(self, config):
|
|
def __init__(self, config):
|
|
self._max_seconds = config['max_seconds']
|
|
self._max_seconds = config['max_seconds']
|
|
@@ -218,6 +233,13 @@ class SaveClipsConfig():
|
|
@property
|
|
@property
|
|
def cache_dir(self):
|
|
def cache_dir(self):
|
|
return self._cache_dir
|
|
return self._cache_dir
|
|
|
|
+
|
|
|
|
+ def to_dict(self):
|
|
|
|
+ return {
|
|
|
|
+ 'max_seconds': self.max_seconds,
|
|
|
|
+ 'clips_dir': self.clips_dir,
|
|
|
|
+ 'cache_dir': self.cache_dir
|
|
|
|
+ }
|
|
|
|
|
|
class FfmpegConfig():
|
|
class FfmpegConfig():
|
|
def __init__(self, global_config, config):
|
|
def __init__(self, global_config, config):
|
|
@@ -269,6 +291,14 @@ class FilterConfig():
|
|
@property
|
|
@property
|
|
def min_score(self):
|
|
def min_score(self):
|
|
return self._min_score
|
|
return self._min_score
|
|
|
|
+
|
|
|
|
+ def to_dict(self):
|
|
|
|
+ return {
|
|
|
|
+ 'min_area': self.min_area,
|
|
|
|
+ 'max_area': self.max_area,
|
|
|
|
+ 'threshold': self.threshold,
|
|
|
|
+ 'min_score': self.min_score
|
|
|
|
+ }
|
|
|
|
|
|
class ObjectConfig():
|
|
class ObjectConfig():
|
|
def __init__(self, global_config, config):
|
|
def __init__(self, global_config, config):
|
|
@@ -286,6 +316,12 @@ class ObjectConfig():
|
|
def filters(self) -> Dict[str, FilterConfig]:
|
|
def filters(self) -> Dict[str, FilterConfig]:
|
|
return self._filters
|
|
return self._filters
|
|
|
|
|
|
|
|
+ def to_dict(self):
|
|
|
|
+ return {
|
|
|
|
+ 'track': self.track,
|
|
|
|
+ 'filters': { k: f.to_dict() for k, f in self.filters.items() }
|
|
|
|
+ }
|
|
|
|
+
|
|
class CameraSnapshotsConfig():
|
|
class CameraSnapshotsConfig():
|
|
def __init__(self, config):
|
|
def __init__(self, config):
|
|
self._show_timestamp = config['show_timestamp']
|
|
self._show_timestamp = config['show_timestamp']
|
|
@@ -313,6 +349,15 @@ class CameraSnapshotsConfig():
|
|
@property
|
|
@property
|
|
def height(self):
|
|
def height(self):
|
|
return self._height
|
|
return self._height
|
|
|
|
+
|
|
|
|
+ def to_dict(self):
|
|
|
|
+ return {
|
|
|
|
+ 'show_timestamp': self.show_timestamp,
|
|
|
|
+ 'draw_zones': self.draw_zones,
|
|
|
|
+ 'draw_bounding_boxes': self.draw_bounding_boxes,
|
|
|
|
+ 'crop_to_region': self.crop_to_region,
|
|
|
|
+ 'height': self.height
|
|
|
|
+ }
|
|
|
|
|
|
class CameraSaveClipsConfig():
|
|
class CameraSaveClipsConfig():
|
|
def __init__(self, config):
|
|
def __init__(self, config):
|
|
@@ -331,6 +376,13 @@ class CameraSaveClipsConfig():
|
|
@property
|
|
@property
|
|
def objects(self):
|
|
def objects(self):
|
|
return self._objects
|
|
return self._objects
|
|
|
|
+
|
|
|
|
+ def to_dict(self):
|
|
|
|
+ return {
|
|
|
|
+ 'enabled': self.enabled,
|
|
|
|
+ 'pre_capture': self.pre_capture,
|
|
|
|
+ 'objects': self.objects
|
|
|
|
+ }
|
|
|
|
|
|
class ZoneConfig():
|
|
class ZoneConfig():
|
|
def __init__(self, name, config):
|
|
def __init__(self, name, config):
|
|
@@ -371,6 +423,11 @@ class ZoneConfig():
|
|
@property
|
|
@property
|
|
def filters(self):
|
|
def filters(self):
|
|
return self._filters
|
|
return self._filters
|
|
|
|
+
|
|
|
|
+ def to_dict(self):
|
|
|
|
+ return {
|
|
|
|
+ 'filters': {k: f.to_dict() for k, f in self.filters.items()}
|
|
|
|
+ }
|
|
|
|
|
|
class CameraConfig():
|
|
class CameraConfig():
|
|
def __init__(self, name, config, cache_dir, global_ffmpeg, global_objects):
|
|
def __init__(self, name, config, cache_dir, global_ffmpeg, global_objects):
|
|
@@ -483,10 +540,6 @@ class CameraConfig():
|
|
def best_image_timeout(self):
|
|
def best_image_timeout(self):
|
|
return self._best_image_timeout
|
|
return self._best_image_timeout
|
|
|
|
|
|
- @property
|
|
|
|
- def mqtt(self):
|
|
|
|
- return self._mqtt
|
|
|
|
-
|
|
|
|
@property
|
|
@property
|
|
def zones(self)-> Dict[str, ZoneConfig]:
|
|
def zones(self)-> Dict[str, ZoneConfig]:
|
|
return self._zones
|
|
return self._zones
|
|
@@ -515,6 +568,22 @@ class CameraConfig():
|
|
def ffmpeg_cmd(self):
|
|
def ffmpeg_cmd(self):
|
|
return self._ffmpeg_cmd
|
|
return self._ffmpeg_cmd
|
|
|
|
|
|
|
|
+ def to_dict(self):
|
|
|
|
+ return {
|
|
|
|
+ 'name': self.name,
|
|
|
|
+ 'height': self.height,
|
|
|
|
+ 'width': self.width,
|
|
|
|
+ 'fps': self.fps,
|
|
|
|
+ 'best_image_timeout': self.best_image_timeout,
|
|
|
|
+ 'zones': {k: z.to_dict() for k, z in self.zones.items()},
|
|
|
|
+ 'save_clips': self.save_clips.to_dict(),
|
|
|
|
+ 'snapshots': self.snapshots.to_dict(),
|
|
|
|
+ 'objects': self.objects.to_dict(),
|
|
|
|
+ 'frame_shape': self.frame_shape,
|
|
|
|
+ 'ffmpeg_cmd': " ".join(self.ffmpeg_cmd),
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
class FrigateConfig():
|
|
class FrigateConfig():
|
|
def __init__(self, config_file=None, config=None):
|
|
def __init__(self, config_file=None, config=None):
|
|
if config is None and config_file is None:
|
|
if config is None and config_file is None:
|
|
@@ -564,6 +633,14 @@ class FrigateConfig():
|
|
|
|
|
|
return config
|
|
return config
|
|
|
|
|
|
|
|
+ def to_dict(self):
|
|
|
|
+ return {
|
|
|
|
+ 'detectors': {k: d.to_dict() for k, d in self.detectors.items()},
|
|
|
|
+ 'mqtt': self.mqtt.to_dict(),
|
|
|
|
+ 'save_clips': self.save_clips.to_dict(),
|
|
|
|
+ 'cameras': {k: c.to_dict() for k, c in self.cameras.items()}
|
|
|
|
+ }
|
|
|
|
+
|
|
@property
|
|
@property
|
|
def detectors(self) -> Dict[str, DetectorConfig]:
|
|
def detectors(self) -> Dict[str, DetectorConfig]:
|
|
return self._detectors
|
|
return self._detectors
|