From de58bdcc9fc654e145f92f57bbf869f3c47b764d Mon Sep 17 00:00:00 2001 From: Blake Blackshear Date: Sun, 6 Feb 2022 10:12:49 -0600 Subject: [PATCH] improve warning for retain modes --- frigate/config.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/frigate/config.py b/frigate/config.py index 048d48ce7..50da2c561 100644 --- a/frigate/config.py +++ b/frigate/config.py @@ -836,14 +836,18 @@ class FrigateConfig(FrigateBaseModel): camera_config.record.retain.days = camera_config.record.retain_days # warning if the higher level record mode is potentially more restrictive than the events + rank_map = { + RetainModeEnum.all: 0, + RetainModeEnum.motion: 1, + RetainModeEnum.active_objects: 2, + } if ( camera_config.record.retain.days != 0 - and camera_config.record.retain.mode != RetainModeEnum.all - and camera_config.record.events.retain.mode - != camera_config.record.retain.mode + and rank_map[camera_config.record.retain.mode] + > rank_map[camera_config.record.events.retain.mode] ): logger.warning( - f"Recording retention is configured for {camera_config.record.retain.mode} and event retention is configured for {camera_config.record.events.retain.mode}. The more restrictive retention policy will be applied." + f"{name}: Recording retention is configured for {camera_config.record.retain.mode} and event retention is configured for {camera_config.record.events.retain.mode}. The more restrictive retention policy will be applied." ) # generage the ffmpeg commands camera_config.create_ffmpeg_cmds()