forked from Github/frigate
handle and warn if roles dont match enabled features
This commit is contained in:
@@ -67,6 +67,24 @@ class FrigateApp():
|
||||
'ffmpeg_pid': mp.Value('i', 0),
|
||||
'frame_queue': mp.Queue(maxsize=2)
|
||||
}
|
||||
|
||||
def check_config(self):
|
||||
for name, camera in self.config.cameras.items():
|
||||
assigned_roles = list(set([r for i in camera.ffmpeg.inputs for r in i.roles]))
|
||||
if not camera.save_clips.enabled and 'clips' in assigned_roles:
|
||||
logger.warning(f"Camera {name} has clips assigned to an input, but save_clips is not enabled.")
|
||||
elif camera.save_clips.enabled and not 'clips' in assigned_roles:
|
||||
logger.warning(f"Camera {name} has save_clips enabled, but clips is not assigned to an input.")
|
||||
|
||||
if not camera.record.enabled and 'record' in assigned_roles:
|
||||
logger.warning(f"Camera {name} has record assigned to an input, but record is not enabled.")
|
||||
elif camera.record.enabled and not 'record' in assigned_roles:
|
||||
logger.warning(f"Camera {name} has record enabled, but record is not assigned to an input.")
|
||||
|
||||
if not camera.rtmp.enabled and 'rtmp' in assigned_roles:
|
||||
logger.warning(f"Camera {name} has rtmp assigned to an input, but rtmp is not enabled.")
|
||||
elif camera.rtmp.enabled and not 'rtmp' in assigned_roles:
|
||||
logger.warning(f"Camera {name} has rtmp enabled, but rtmp is not assigned to an input.")
|
||||
|
||||
def set_log_levels(self):
|
||||
logging.getLogger().setLevel(self.config.logger.default)
|
||||
@@ -160,6 +178,7 @@ class FrigateApp():
|
||||
logger.error(f"Error parsing config: {e}")
|
||||
self.log_process.terminate()
|
||||
sys.exit(1)
|
||||
self.check_config()
|
||||
self.set_log_levels()
|
||||
self.init_queues()
|
||||
self.init_database()
|
||||
|
||||
Reference in New Issue
Block a user