Browse Source

remove nested enabled config setting on events

Blake Blackshear 3 years ago
parent
commit
288b1a0562
3 changed files with 12 additions and 16 deletions
  1. 9 11
      frigate/config.py
  2. 2 4
      frigate/events.py
  3. 1 1
      frigate/test/test_config.py

+ 9 - 11
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."
     )
 
 

+ 2 - 4
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

+ 1 - 1
frigate/test/test_config.py

@@ -473,7 +473,7 @@ class TestConfig(unittest.TestCase):
                         "width": 1920,
                         "fps": 5,
                     },
-                    "record": {"events": {"enabled": True}},
+                    "record": {"events": {}},
                 }
             },
         }