From bc078fcc8883a350bc6dda6ad50dbe9871f10534 Mon Sep 17 00:00:00 2001 From: Blake Blackshear Date: Wed, 1 Jun 2022 06:18:26 -0500 Subject: [PATCH] remove deprecated max_seconds config option --- docs/docs/configuration/index.md | 4 ---- frigate/config.py | 1 - frigate/record.py | 9 ++------- 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/docs/docs/configuration/index.md b/docs/docs/configuration/index.md index 5fc9c57b8..37e4fbf0e 100644 --- a/docs/docs/configuration/index.md +++ b/docs/docs/configuration/index.md @@ -278,10 +278,6 @@ record: mode: all # Optional: Event recording settings events: - # Optional: Maximum length of time to retain video during long events. (default: shown below) - # NOTE: If an object is being tracked for longer than this amount of time, the retained recordings - # will be the last x seconds of the event unless retain->days under record is > 0. - max_seconds: 300 # Optional: Number of seconds before the event to include (default: shown below) pre_capture: 5 # Optional: Number of seconds after the event to include (default: shown below) diff --git a/frigate/config.py b/frigate/config.py index 863538504..7b3eed245 100644 --- a/frigate/config.py +++ b/frigate/config.py @@ -83,7 +83,6 @@ class RetainConfig(FrigateBaseModel): class EventsConfig(FrigateBaseModel): - max_seconds: int = Field(default=300, title="Maximum event duration.") pre_capture: int = Field(default=5, title="Seconds to retain before event starts.") post_capture: int = Field(default=5, title="Seconds to retain after event ends.") required_zones: List[str] = Field( diff --git a/frigate/record.py b/frigate/record.py index 9bb6463b8..bdc3d5671 100644 --- a/frigate/record.py +++ b/frigate/record.py @@ -377,16 +377,11 @@ class RecordingCleanup(threading.Thread): logger.debug("Start all cameras.") for camera, config in self.config.cameras.items(): logger.debug(f"Start camera: {camera}.") - # When deleting recordings without events, we have to keep at LEAST the configured max clip duration - min_end = ( - datetime.datetime.now() - - datetime.timedelta(seconds=config.record.events.max_seconds) - ).timestamp() + # Get the timestamp for cutoff of retained days expire_days = config.record.retain.days - expire_before = ( + expire_date = ( datetime.datetime.now() - datetime.timedelta(days=expire_days) ).timestamp() - expire_date = min(min_end, expire_before) # Get recordings to check for expiration recordings: Recordings = (