remove nested enabled config setting on events

This commit is contained in:
Blake Blackshear 2021-09-08 08:02:26 -05:00
parent e8eb3125a5
commit 288b1a0562
3 changed files with 12 additions and 16 deletions

View File

@ -72,29 +72,27 @@ class RetainConfig(FrigateBaseModel):
) )
# DEPRECATED: Will eventually be removed class EventsConfig(FrigateBaseModel):
class ClipsConfig(FrigateBaseModel): max_seconds: int = Field(default=300, title="Maximum event duration.")
enabled: bool = Field(default=False, title="Save clips.") pre_capture: int = Field(default=5, title="Seconds to retain before event starts.")
max_seconds: int = Field(default=300, title="Maximum clip duration.") post_capture: int = Field(default=5, title="Seconds to retain after event ends.")
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.")
required_zones: List[str] = Field( required_zones: List[str] = Field(
default_factory=list, 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( 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( retain: RetainConfig = Field(
default_factory=RetainConfig, title="Clip retention settings." default_factory=RetainConfig, title="Event retention settings."
) )
class RecordConfig(FrigateBaseModel): class RecordConfig(FrigateBaseModel):
enabled: bool = Field(default=False, title="Enable record on all cameras.") enabled: bool = Field(default=False, title="Enable record on all cameras.")
retain_days: int = Field(default=0, title="Recording retention period in days.") retain_days: int = Field(default=0, title="Recording retention period in days.")
events: ClipsConfig = Field( events: EventsConfig = Field(
default_factory=ClipsConfig, title="Event specific settings." default_factory=EventsConfig, title="Event specific settings."
) )

View File

@ -35,10 +35,8 @@ class EventProcessor(threading.Thread):
record_config: RecordConfig = self.config.cameras[camera].record record_config: RecordConfig = self.config.cameras[camera].record
# Recording clips is disabled # Recording is disabled
if not record_config.enabled or ( if not record_config.enabled:
record_config.retain_days == 0 and not record_config.events.enabled
):
return False return False
# If there are required zones and there is no overlap # If there are required zones and there is no overlap

View File

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