mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-05-01 19:17:41 +03:00
Fix manual event getting caught by global motion config (#22887)
This commit is contained in:
parent
82e14d71fb
commit
2ffe47511a
@ -372,6 +372,7 @@ class RecordingMaintainer(threading.Thread):
|
|||||||
)
|
)
|
||||||
|
|
||||||
record_config = self.config.cameras[camera].record
|
record_config = self.config.cameras[camera].record
|
||||||
|
segment_info: SegmentInfo | None = None
|
||||||
highest = None
|
highest = None
|
||||||
|
|
||||||
if record_config.continuous.days > 0:
|
if record_config.continuous.days > 0:
|
||||||
@ -401,9 +402,19 @@ class RecordingMaintainer(threading.Thread):
|
|||||||
if highest == "continuous"
|
if highest == "continuous"
|
||||||
else RetainModeEnum.motion
|
else RetainModeEnum.motion
|
||||||
)
|
)
|
||||||
return await self.move_segment(
|
segment_info = self.segment_stats(camera, start_time, end_time)
|
||||||
camera, start_time, end_time, duration, cache_path, record_mode
|
|
||||||
)
|
# Here we only check if we should move the segment based on non-object recording retention
|
||||||
|
# we will always want to check for overlapping review items below before dropping the segment
|
||||||
|
if not segment_info.should_discard_segment(record_mode):
|
||||||
|
return await self.move_segment(
|
||||||
|
camera,
|
||||||
|
start_time,
|
||||||
|
end_time,
|
||||||
|
duration,
|
||||||
|
cache_path,
|
||||||
|
segment_info,
|
||||||
|
)
|
||||||
|
|
||||||
# we fell through the continuous / motion check, so we need to check the review items
|
# we fell through the continuous / motion check, so we need to check the review items
|
||||||
# if the cached segment overlaps with the review items:
|
# if the cached segment overlaps with the review items:
|
||||||
@ -435,15 +446,24 @@ class RecordingMaintainer(threading.Thread):
|
|||||||
if review.severity == "alert"
|
if review.severity == "alert"
|
||||||
else record_config.detections.retain.mode
|
else record_config.detections.retain.mode
|
||||||
)
|
)
|
||||||
# move from cache to recordings immediately
|
|
||||||
return await self.move_segment(
|
if segment_info is None:
|
||||||
camera,
|
segment_info = self.segment_stats(camera, start_time, end_time)
|
||||||
start_time,
|
|
||||||
end_time,
|
if not segment_info.should_discard_segment(record_mode):
|
||||||
duration,
|
# move from cache to recordings immediately
|
||||||
cache_path,
|
return await self.move_segment(
|
||||||
record_mode,
|
camera,
|
||||||
)
|
start_time,
|
||||||
|
end_time,
|
||||||
|
duration,
|
||||||
|
cache_path,
|
||||||
|
segment_info,
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
self.drop_segment(cache_path)
|
||||||
|
return None
|
||||||
|
|
||||||
# if it doesn't overlap with an review item, go ahead and drop the segment
|
# if it doesn't overlap with an review item, go ahead and drop the segment
|
||||||
# if it ends more than the configured pre_capture for the camera
|
# if it ends more than the configured pre_capture for the camera
|
||||||
# BUT only if continuous/motion is NOT enabled (otherwise wait for processing)
|
# BUT only if continuous/motion is NOT enabled (otherwise wait for processing)
|
||||||
@ -455,6 +475,7 @@ class RecordingMaintainer(threading.Thread):
|
|||||||
retain_cutoff = datetime.datetime.fromtimestamp(
|
retain_cutoff = datetime.datetime.fromtimestamp(
|
||||||
most_recently_processed_frame_time - record_config.event_pre_capture
|
most_recently_processed_frame_time - record_config.event_pre_capture
|
||||||
).astimezone(datetime.timezone.utc)
|
).astimezone(datetime.timezone.utc)
|
||||||
|
|
||||||
if end_time < retain_cutoff:
|
if end_time < retain_cutoff:
|
||||||
self.drop_segment(cache_path)
|
self.drop_segment(cache_path)
|
||||||
|
|
||||||
@ -578,15 +599,8 @@ class RecordingMaintainer(threading.Thread):
|
|||||||
end_time: datetime.datetime,
|
end_time: datetime.datetime,
|
||||||
duration: float,
|
duration: float,
|
||||||
cache_path: str,
|
cache_path: str,
|
||||||
store_mode: RetainModeEnum,
|
segment_info: SegmentInfo,
|
||||||
) -> Optional[dict[str, Any]]:
|
) -> Optional[dict[str, Any]]:
|
||||||
segment_info = self.segment_stats(camera, start_time, end_time)
|
|
||||||
|
|
||||||
# check if the segment shouldn't be stored
|
|
||||||
if segment_info.should_discard_segment(store_mode):
|
|
||||||
self.drop_segment(cache_path)
|
|
||||||
return None
|
|
||||||
|
|
||||||
# directory will be in utc due to start_time being in utc
|
# directory will be in utc due to start_time being in utc
|
||||||
directory = os.path.join(
|
directory = os.path.join(
|
||||||
RECORD_DIR,
|
RECORD_DIR,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user