remove deprecated max_seconds config option

This commit is contained in:
Blake Blackshear 2022-06-01 06:18:26 -05:00
parent 5f9d477863
commit bc078fcc88
3 changed files with 2 additions and 12 deletions

View File

@ -278,10 +278,6 @@ record:
mode: all mode: all
# Optional: Event recording settings # Optional: Event recording settings
events: 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) # Optional: Number of seconds before the event to include (default: shown below)
pre_capture: 5 pre_capture: 5
# Optional: Number of seconds after the event to include (default: shown below) # Optional: Number of seconds after the event to include (default: shown below)

View File

@ -83,7 +83,6 @@ class RetainConfig(FrigateBaseModel):
class EventsConfig(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.") 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.") post_capture: int = Field(default=5, title="Seconds to retain after event ends.")
required_zones: List[str] = Field( required_zones: List[str] = Field(

View File

@ -377,16 +377,11 @@ class RecordingCleanup(threading.Thread):
logger.debug("Start all cameras.") logger.debug("Start all cameras.")
for camera, config in self.config.cameras.items(): for camera, config in self.config.cameras.items():
logger.debug(f"Start camera: {camera}.") logger.debug(f"Start camera: {camera}.")
# When deleting recordings without events, we have to keep at LEAST the configured max clip duration # Get the timestamp for cutoff of retained days
min_end = (
datetime.datetime.now()
- datetime.timedelta(seconds=config.record.events.max_seconds)
).timestamp()
expire_days = config.record.retain.days expire_days = config.record.retain.days
expire_before = ( expire_date = (
datetime.datetime.now() - datetime.timedelta(days=expire_days) datetime.datetime.now() - datetime.timedelta(days=expire_days)
).timestamp() ).timestamp()
expire_date = min(min_end, expire_before)
# Get recordings to check for expiration # Get recordings to check for expiration
recordings: Recordings = ( recordings: Recordings = (