mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-01-29 15:34:57 +03:00
ruff fix
This commit is contained in:
parent
3e102b1bdf
commit
a66159a44f
@ -62,6 +62,7 @@ class BirdseyeConfig(FrigateBaseModel):
|
|||||||
title="Idle heartbeat FPS (0 disables, max 10)",
|
title="Idle heartbeat FPS (0 disables, max 10)",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# uses BaseModel because some global attributes are not available at the camera level
|
# uses BaseModel because some global attributes are not available at the camera level
|
||||||
class BirdseyeCameraConfig(BaseModel):
|
class BirdseyeCameraConfig(BaseModel):
|
||||||
enabled: bool = Field(default=True, title="Enable birdseye view for camera.")
|
enabled: bool = Field(default=True, title="Enable birdseye view for camera.")
|
||||||
|
|||||||
@ -9,9 +9,9 @@ import os
|
|||||||
import queue
|
import queue
|
||||||
import subprocess as sp
|
import subprocess as sp
|
||||||
import threading
|
import threading
|
||||||
|
import time
|
||||||
import traceback
|
import traceback
|
||||||
from typing import Any, Optional
|
from typing import Any, Optional
|
||||||
import time
|
|
||||||
|
|
||||||
import cv2
|
import cv2
|
||||||
import numpy as np
|
import numpy as np
|
||||||
@ -793,7 +793,9 @@ class Birdseye:
|
|||||||
self.stop_event = stop_event
|
self.stop_event = stop_event
|
||||||
self.requestor = InterProcessRequestor()
|
self.requestor = InterProcessRequestor()
|
||||||
self.idle_fps: float = self.config.birdseye.idle_heartbeat_fps
|
self.idle_fps: float = self.config.birdseye.idle_heartbeat_fps
|
||||||
self._idle_interval: Optional[float] = (1.0 / self.idle_fps) if self.idle_fps > 0 else None
|
self._idle_interval: Optional[float] = (
|
||||||
|
(1.0 / self.idle_fps) if self.idle_fps > 0 else None
|
||||||
|
)
|
||||||
|
|
||||||
if config.birdseye.restream:
|
if config.birdseye.restream:
|
||||||
self.birdseye_buffer = self.frame_manager.create(
|
self.birdseye_buffer = self.frame_manager.create(
|
||||||
@ -853,10 +855,14 @@ class Birdseye:
|
|||||||
self.requestor.send_data(UPDATE_BIRDSEYE_LAYOUT, coordinates)
|
self.requestor.send_data(UPDATE_BIRDSEYE_LAYOUT, coordinates)
|
||||||
if self._idle_interval:
|
if self._idle_interval:
|
||||||
now = time.monotonic()
|
now = time.monotonic()
|
||||||
is_idle = (len(self.birdseye_manager.camera_layout) == 0)
|
is_idle = len(self.birdseye_manager.camera_layout) == 0
|
||||||
if is_idle and (now - self.birdseye_manager.last_output_time) >= self._idle_interval:
|
if (
|
||||||
|
is_idle
|
||||||
|
and (now - self.birdseye_manager.last_output_time)
|
||||||
|
>= self._idle_interval
|
||||||
|
):
|
||||||
self.__send_new_frame()
|
self.__send_new_frame()
|
||||||
|
|
||||||
def stop(self) -> None:
|
def stop(self) -> None:
|
||||||
self.converter.join()
|
self.converter.join()
|
||||||
self.broadcaster.join()
|
self.broadcaster.join()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user