mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-12 22:25:24 +03:00
Update birdseye.py
This commit is contained in:
parent
6978140492
commit
ae532a465b
@ -282,9 +282,11 @@ class BirdsEyeFrameManager:
|
|||||||
self.canvas = Canvas(width, height, config.birdseye.layout.scaling_factor)
|
self.canvas = Canvas(width, height, config.birdseye.layout.scaling_factor)
|
||||||
self.stop_event = stop_event
|
self.stop_event = stop_event
|
||||||
self.inactivity_threshold = config.birdseye.inactivity_threshold
|
self.inactivity_threshold = config.birdseye.inactivity_threshold
|
||||||
|
self.min_display_duration = config.birdseye.min_display_duration # New parameter
|
||||||
|
|
||||||
if config.birdseye.layout.max_cameras:
|
if config.birdseye.layout.max_cameras:
|
||||||
self.last_refresh_time = 0
|
self.last_refresh_time = 0
|
||||||
|
self.last_camera_switch_time = 0 # Track the last switch time
|
||||||
|
|
||||||
# initialize the frame as black and with the Frigate logo
|
# initialize the frame as black and with the Frigate logo
|
||||||
self.blank_frame = np.zeros(self.yuv_shape, np.uint8)
|
self.blank_frame = np.zeros(self.yuv_shape, np.uint8)
|
||||||
@ -403,9 +405,9 @@ class BirdsEyeFrameManager:
|
|||||||
|
|
||||||
max_cameras = self.config.birdseye.layout.max_cameras
|
max_cameras = self.config.birdseye.layout.max_cameras
|
||||||
max_camera_refresh = False
|
max_camera_refresh = False
|
||||||
if max_cameras:
|
now = datetime.datetime.now().timestamp()
|
||||||
now = datetime.datetime.now().timestamp()
|
|
||||||
|
|
||||||
|
if max_cameras:
|
||||||
if len(active_cameras) == max_cameras and now - self.last_refresh_time < 10:
|
if len(active_cameras) == max_cameras and now - self.last_refresh_time < 10:
|
||||||
# don't refresh cameras too often
|
# don't refresh cameras too often
|
||||||
active_cameras = self.active_cameras
|
active_cameras = self.active_cameras
|
||||||
@ -446,11 +448,16 @@ class BirdsEyeFrameManager:
|
|||||||
else:
|
else:
|
||||||
reset_layout = True
|
reset_layout = True
|
||||||
|
|
||||||
|
# Ensure the current camera has been displayed for at least min_display_duration seconds
|
||||||
|
if len(self.active_cameras) == 1 and now - self.last_camera_switch_time < self.min_display_duration:
|
||||||
|
reset_layout = False
|
||||||
|
|
||||||
# reset the layout if it needs to be different
|
# reset the layout if it needs to be different
|
||||||
if reset_layout:
|
if reset_layout:
|
||||||
logger.debug("Added new cameras, resetting layout...")
|
logger.debug("Added new cameras, resetting layout...")
|
||||||
self.clear_frame()
|
self.clear_frame()
|
||||||
self.active_cameras = active_cameras
|
self.active_cameras = active_cameras
|
||||||
|
self.last_camera_switch_time = now # Update the last switch time
|
||||||
|
|
||||||
# this also converts added_cameras from a set to a list since we need
|
# this also converts added_cameras from a set to a list since we need
|
||||||
# to pop elements in order
|
# to pop elements in order
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user