Clean up checks

This commit is contained in:
Nicolas Mowen 2025-04-05 06:06:47 -06:00
parent 20fed3e0c6
commit 3018f54d1e

View File

@ -482,6 +482,10 @@ class ReviewSegmentMaintainer(threading.Thread):
camera_name = updated_record_topic.rpartition("/")[-1] camera_name = updated_record_topic.rpartition("/")[-1]
self.config.cameras[camera_name].record = updated_record_config self.config.cameras[camera_name].record = updated_record_config
# immediately end segment
if not updated_record_config.enabled:
self.end_segment(camera_name)
if updated_review_topic: if updated_review_topic:
camera_name = updated_review_topic.rpartition("/")[-1] camera_name = updated_review_topic.rpartition("/")[-1]
self.config.cameras[camera_name].review = updated_review_config self.config.cameras[camera_name].review = updated_review_config
@ -527,16 +531,14 @@ class ReviewSegmentMaintainer(threading.Thread):
if camera not in self.indefinite_events: if camera not in self.indefinite_events:
self.indefinite_events[camera] = {} self.indefinite_events[camera] = {}
current_segment = self.active_review_segments.get(camera)
if ( if (
not self.config.cameras[camera].enabled not self.config.cameras[camera].enabled
or not self.config.cameras[camera].record.enabled or not self.config.cameras[camera].record.enabled
): ):
if current_segment:
self.end_segment(camera)
continue continue
current_segment = self.active_review_segments.get(camera)
# Check if the current segment should be processed based on enabled settings # Check if the current segment should be processed based on enabled settings
if current_segment: if current_segment:
if ( if (