From 288b1a05629879887ea63ea623aa3d9fb23b5523 Mon Sep 17 00:00:00 2001 From: Blake Blackshear Date: Wed, 8 Sep 2021 08:02:26 -0500 Subject: [PATCH] remove nested enabled config setting on events --- frigate/config.py | 20 +++++++++----------- frigate/events.py | 6 ++---- frigate/test/test_config.py | 2 +- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/frigate/config.py b/frigate/config.py index 8d54a441d..bfd54b1ba 100644 --- a/frigate/config.py +++ b/frigate/config.py @@ -72,29 +72,27 @@ class RetainConfig(FrigateBaseModel): ) -# DEPRECATED: Will eventually be removed -class ClipsConfig(FrigateBaseModel): - enabled: bool = Field(default=False, title="Save clips.") - max_seconds: int = Field(default=300, title="Maximum clip duration.") - pre_capture: int = Field(default=5, title="Seconds to capture before event starts.") - post_capture: int = Field(default=5, title="Seconds to capture after event ends.") +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( default_factory=list, - title="List of required zones to be entered in order to save the clip.", + title="List of required zones to be entered in order to save the event.", ) objects: Optional[List[str]] = Field( - title="List of objects to be detected in order to save the clip.", + title="List of objects to be detected in order to save the event.", ) retain: RetainConfig = Field( - default_factory=RetainConfig, title="Clip retention settings." + default_factory=RetainConfig, title="Event retention settings." ) class RecordConfig(FrigateBaseModel): enabled: bool = Field(default=False, title="Enable record on all cameras.") retain_days: int = Field(default=0, title="Recording retention period in days.") - events: ClipsConfig = Field( - default_factory=ClipsConfig, title="Event specific settings." + events: EventsConfig = Field( + default_factory=EventsConfig, title="Event specific settings." ) diff --git a/frigate/events.py b/frigate/events.py index 3293d19bb..a67200e4b 100644 --- a/frigate/events.py +++ b/frigate/events.py @@ -35,10 +35,8 @@ class EventProcessor(threading.Thread): record_config: RecordConfig = self.config.cameras[camera].record - # Recording clips is disabled - if not record_config.enabled or ( - record_config.retain_days == 0 and not record_config.events.enabled - ): + # Recording is disabled + if not record_config.enabled: return False # If there are required zones and there is no overlap diff --git a/frigate/test/test_config.py b/frigate/test/test_config.py index 8bf96736a..49fcf6d03 100644 --- a/frigate/test/test_config.py +++ b/frigate/test/test_config.py @@ -473,7 +473,7 @@ class TestConfig(unittest.TestCase): "width": 1920, "fps": 5, }, - "record": {"events": {"enabled": True}}, + "record": {"events": {}}, } }, }