mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-05 02:35:22 +03:00
python dev deps
This commit is contained in:
parent
ed95aa9672
commit
b48eaa6fba
@ -329,7 +329,6 @@ class BirdsEyeFrameManager:
|
|||||||
|
|
||||||
# update each position in the layout
|
# update each position in the layout
|
||||||
for position, camera in enumerate(self.camera_layout, start=0):
|
for position, camera in enumerate(self.camera_layout, start=0):
|
||||||
|
|
||||||
# if this camera was removed, replace it or clear it
|
# if this camera was removed, replace it or clear it
|
||||||
if camera in removed_cameras:
|
if camera in removed_cameras:
|
||||||
# if replacing this camera with a newly added one
|
# if replacing this camera with a newly added one
|
||||||
|
|||||||
@ -111,7 +111,6 @@ class RecordingMaintainer(threading.Thread):
|
|||||||
grouped_recordings[camera] = grouped_recordings[camera][-keep_count:]
|
grouped_recordings[camera] = grouped_recordings[camera][-keep_count:]
|
||||||
|
|
||||||
for camera, recordings in grouped_recordings.items():
|
for camera, recordings in grouped_recordings.items():
|
||||||
|
|
||||||
# clear out all the recording info for old frames
|
# clear out all the recording info for old frames
|
||||||
while (
|
while (
|
||||||
len(self.recordings_info[camera]) > 0
|
len(self.recordings_info[camera]) > 0
|
||||||
|
|||||||
@ -23,7 +23,6 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
def get_latest_version(config: FrigateConfig) -> str:
|
def get_latest_version(config: FrigateConfig) -> str:
|
||||||
|
|
||||||
if not config.telemetry.version_check:
|
if not config.telemetry.version_check:
|
||||||
return "disabled"
|
return "disabled"
|
||||||
|
|
||||||
|
|||||||
@ -179,7 +179,6 @@ class StorageMaintainer(threading.Thread):
|
|||||||
def run(self):
|
def run(self):
|
||||||
"""Check every 5 minutes if storage needs to be cleaned up."""
|
"""Check every 5 minutes if storage needs to be cleaned up."""
|
||||||
while not self.stop_event.wait(300):
|
while not self.stop_event.wait(300):
|
||||||
|
|
||||||
if not self.camera_storage_stats or True in [
|
if not self.camera_storage_stats or True in [
|
||||||
r["needs_refresh"] for r in self.camera_storage_stats.values()
|
r["needs_refresh"] for r in self.camera_storage_stats.values()
|
||||||
]:
|
]:
|
||||||
|
|||||||
@ -673,7 +673,6 @@ class TestConfig(unittest.TestCase):
|
|||||||
assert runtime_config.cameras["back"].detect.max_disappeared == 5 * 5
|
assert runtime_config.cameras["back"].detect.max_disappeared == 5 * 5
|
||||||
|
|
||||||
def test_motion_frame_height_wont_go_below_120(self):
|
def test_motion_frame_height_wont_go_below_120(self):
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
"mqtt": {"host": "mqtt"},
|
"mqtt": {"host": "mqtt"},
|
||||||
"cameras": {
|
"cameras": {
|
||||||
@ -702,7 +701,6 @@ class TestConfig(unittest.TestCase):
|
|||||||
assert runtime_config.cameras["back"].motion.frame_height == 50
|
assert runtime_config.cameras["back"].motion.frame_height == 50
|
||||||
|
|
||||||
def test_motion_contour_area_dynamic(self):
|
def test_motion_contour_area_dynamic(self):
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
"mqtt": {"host": "mqtt"},
|
"mqtt": {"host": "mqtt"},
|
||||||
"cameras": {
|
"cameras": {
|
||||||
@ -731,7 +729,6 @@ class TestConfig(unittest.TestCase):
|
|||||||
assert round(runtime_config.cameras["back"].motion.contour_area) == 30
|
assert round(runtime_config.cameras["back"].motion.contour_area) == 30
|
||||||
|
|
||||||
def test_merge_labelmap(self):
|
def test_merge_labelmap(self):
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
"mqtt": {"host": "mqtt"},
|
"mqtt": {"host": "mqtt"},
|
||||||
"model": {"labelmap": {7: "truck"}},
|
"model": {"labelmap": {7: "truck"}},
|
||||||
@ -761,7 +758,6 @@ class TestConfig(unittest.TestCase):
|
|||||||
assert runtime_config.model.merged_labelmap[7] == "truck"
|
assert runtime_config.model.merged_labelmap[7] == "truck"
|
||||||
|
|
||||||
def test_default_labelmap_empty(self):
|
def test_default_labelmap_empty(self):
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
"mqtt": {"host": "mqtt"},
|
"mqtt": {"host": "mqtt"},
|
||||||
"cameras": {
|
"cameras": {
|
||||||
@ -790,7 +786,6 @@ class TestConfig(unittest.TestCase):
|
|||||||
assert runtime_config.model.merged_labelmap[0] == "person"
|
assert runtime_config.model.merged_labelmap[0] == "person"
|
||||||
|
|
||||||
def test_default_labelmap(self):
|
def test_default_labelmap(self):
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
"mqtt": {"host": "mqtt"},
|
"mqtt": {"host": "mqtt"},
|
||||||
"model": {"width": 320, "height": 320},
|
"model": {"width": 320, "height": 320},
|
||||||
@ -820,7 +815,6 @@ class TestConfig(unittest.TestCase):
|
|||||||
assert runtime_config.model.merged_labelmap[0] == "person"
|
assert runtime_config.model.merged_labelmap[0] == "person"
|
||||||
|
|
||||||
def test_fails_on_invalid_role(self):
|
def test_fails_on_invalid_role(self):
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
"mqtt": {"host": "mqtt"},
|
"mqtt": {"host": "mqtt"},
|
||||||
"cameras": {
|
"cameras": {
|
||||||
@ -849,7 +843,6 @@ class TestConfig(unittest.TestCase):
|
|||||||
self.assertRaises(ValidationError, lambda: FrigateConfig(**config))
|
self.assertRaises(ValidationError, lambda: FrigateConfig(**config))
|
||||||
|
|
||||||
def test_fails_on_missing_role(self):
|
def test_fails_on_missing_role(self):
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
"mqtt": {"host": "mqtt"},
|
"mqtt": {"host": "mqtt"},
|
||||||
"cameras": {
|
"cameras": {
|
||||||
@ -880,7 +873,6 @@ class TestConfig(unittest.TestCase):
|
|||||||
self.assertRaises(ValueError, lambda: frigate_config.runtime_config)
|
self.assertRaises(ValueError, lambda: frigate_config.runtime_config)
|
||||||
|
|
||||||
def test_works_on_missing_role_multiple_cams(self):
|
def test_works_on_missing_role_multiple_cams(self):
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
"mqtt": {"host": "mqtt"},
|
"mqtt": {"host": "mqtt"},
|
||||||
"cameras": {
|
"cameras": {
|
||||||
@ -929,7 +921,6 @@ class TestConfig(unittest.TestCase):
|
|||||||
runtime_config = frigate_config.runtime_config
|
runtime_config = frigate_config.runtime_config
|
||||||
|
|
||||||
def test_global_detect(self):
|
def test_global_detect(self):
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
"mqtt": {"host": "mqtt"},
|
"mqtt": {"host": "mqtt"},
|
||||||
"detect": {"max_disappeared": 1},
|
"detect": {"max_disappeared": 1},
|
||||||
@ -959,7 +950,6 @@ class TestConfig(unittest.TestCase):
|
|||||||
assert runtime_config.cameras["back"].detect.height == 1080
|
assert runtime_config.cameras["back"].detect.height == 1080
|
||||||
|
|
||||||
def test_default_detect(self):
|
def test_default_detect(self):
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
"mqtt": {"host": "mqtt"},
|
"mqtt": {"host": "mqtt"},
|
||||||
"cameras": {
|
"cameras": {
|
||||||
@ -983,7 +973,6 @@ class TestConfig(unittest.TestCase):
|
|||||||
assert runtime_config.cameras["back"].detect.height == 720
|
assert runtime_config.cameras["back"].detect.height == 720
|
||||||
|
|
||||||
def test_global_detect_merge(self):
|
def test_global_detect_merge(self):
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
"mqtt": {"host": "mqtt"},
|
"mqtt": {"host": "mqtt"},
|
||||||
"detect": {"max_disappeared": 1, "height": 720},
|
"detect": {"max_disappeared": 1, "height": 720},
|
||||||
@ -1014,7 +1003,6 @@ class TestConfig(unittest.TestCase):
|
|||||||
assert runtime_config.cameras["back"].detect.width == 1920
|
assert runtime_config.cameras["back"].detect.width == 1920
|
||||||
|
|
||||||
def test_global_snapshots(self):
|
def test_global_snapshots(self):
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
"mqtt": {"host": "mqtt"},
|
"mqtt": {"host": "mqtt"},
|
||||||
"snapshots": {"enabled": True},
|
"snapshots": {"enabled": True},
|
||||||
@ -1042,7 +1030,6 @@ class TestConfig(unittest.TestCase):
|
|||||||
assert runtime_config.cameras["back"].snapshots.height == 100
|
assert runtime_config.cameras["back"].snapshots.height == 100
|
||||||
|
|
||||||
def test_default_snapshots(self):
|
def test_default_snapshots(self):
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
"mqtt": {"host": "mqtt"},
|
"mqtt": {"host": "mqtt"},
|
||||||
"cameras": {
|
"cameras": {
|
||||||
@ -1066,7 +1053,6 @@ class TestConfig(unittest.TestCase):
|
|||||||
assert runtime_config.cameras["back"].snapshots.quality == 70
|
assert runtime_config.cameras["back"].snapshots.quality == 70
|
||||||
|
|
||||||
def test_global_snapshots_merge(self):
|
def test_global_snapshots_merge(self):
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
"mqtt": {"host": "mqtt"},
|
"mqtt": {"host": "mqtt"},
|
||||||
"snapshots": {"bounding_box": False, "height": 300},
|
"snapshots": {"bounding_box": False, "height": 300},
|
||||||
@ -1096,7 +1082,6 @@ class TestConfig(unittest.TestCase):
|
|||||||
assert runtime_config.cameras["back"].snapshots.enabled
|
assert runtime_config.cameras["back"].snapshots.enabled
|
||||||
|
|
||||||
def test_global_rtmp_disabled(self):
|
def test_global_rtmp_disabled(self):
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
"mqtt": {"host": "mqtt"},
|
"mqtt": {"host": "mqtt"},
|
||||||
"cameras": {
|
"cameras": {
|
||||||
@ -1119,7 +1104,6 @@ class TestConfig(unittest.TestCase):
|
|||||||
assert not runtime_config.cameras["back"].rtmp.enabled
|
assert not runtime_config.cameras["back"].rtmp.enabled
|
||||||
|
|
||||||
def test_default_not_rtmp(self):
|
def test_default_not_rtmp(self):
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
"mqtt": {"host": "mqtt"},
|
"mqtt": {"host": "mqtt"},
|
||||||
"cameras": {
|
"cameras": {
|
||||||
@ -1142,7 +1126,6 @@ class TestConfig(unittest.TestCase):
|
|||||||
assert not runtime_config.cameras["back"].rtmp.enabled
|
assert not runtime_config.cameras["back"].rtmp.enabled
|
||||||
|
|
||||||
def test_global_rtmp_merge(self):
|
def test_global_rtmp_merge(self):
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
"mqtt": {"host": "mqtt"},
|
"mqtt": {"host": "mqtt"},
|
||||||
"rtmp": {"enabled": False},
|
"rtmp": {"enabled": False},
|
||||||
@ -1169,7 +1152,6 @@ class TestConfig(unittest.TestCase):
|
|||||||
assert runtime_config.cameras["back"].rtmp.enabled
|
assert runtime_config.cameras["back"].rtmp.enabled
|
||||||
|
|
||||||
def test_global_rtmp_default(self):
|
def test_global_rtmp_default(self):
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
"mqtt": {"host": "mqtt"},
|
"mqtt": {"host": "mqtt"},
|
||||||
"cameras": {
|
"cameras": {
|
||||||
@ -1196,7 +1178,6 @@ class TestConfig(unittest.TestCase):
|
|||||||
assert not runtime_config.cameras["back"].rtmp.enabled
|
assert not runtime_config.cameras["back"].rtmp.enabled
|
||||||
|
|
||||||
def test_global_jsmpeg(self):
|
def test_global_jsmpeg(self):
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
"mqtt": {"host": "mqtt"},
|
"mqtt": {"host": "mqtt"},
|
||||||
"live": {"quality": 4},
|
"live": {"quality": 4},
|
||||||
@ -1220,7 +1201,6 @@ class TestConfig(unittest.TestCase):
|
|||||||
assert runtime_config.cameras["back"].live.quality == 4
|
assert runtime_config.cameras["back"].live.quality == 4
|
||||||
|
|
||||||
def test_default_live(self):
|
def test_default_live(self):
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
"mqtt": {"host": "mqtt"},
|
"mqtt": {"host": "mqtt"},
|
||||||
"cameras": {
|
"cameras": {
|
||||||
@ -1243,7 +1223,6 @@ class TestConfig(unittest.TestCase):
|
|||||||
assert runtime_config.cameras["back"].live.quality == 8
|
assert runtime_config.cameras["back"].live.quality == 8
|
||||||
|
|
||||||
def test_global_live_merge(self):
|
def test_global_live_merge(self):
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
"mqtt": {"host": "mqtt"},
|
"mqtt": {"host": "mqtt"},
|
||||||
"live": {"quality": 4, "height": 480},
|
"live": {"quality": 4, "height": 480},
|
||||||
@ -1271,7 +1250,6 @@ class TestConfig(unittest.TestCase):
|
|||||||
assert runtime_config.cameras["back"].live.height == 480
|
assert runtime_config.cameras["back"].live.height == 480
|
||||||
|
|
||||||
def test_global_timestamp_style(self):
|
def test_global_timestamp_style(self):
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
"mqtt": {"host": "mqtt"},
|
"mqtt": {"host": "mqtt"},
|
||||||
"timestamp_style": {"position": "bl"},
|
"timestamp_style": {"position": "bl"},
|
||||||
@ -1295,7 +1273,6 @@ class TestConfig(unittest.TestCase):
|
|||||||
assert runtime_config.cameras["back"].timestamp_style.position == "bl"
|
assert runtime_config.cameras["back"].timestamp_style.position == "bl"
|
||||||
|
|
||||||
def test_default_timestamp_style(self):
|
def test_default_timestamp_style(self):
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
"mqtt": {"host": "mqtt"},
|
"mqtt": {"host": "mqtt"},
|
||||||
"cameras": {
|
"cameras": {
|
||||||
@ -1318,7 +1295,6 @@ class TestConfig(unittest.TestCase):
|
|||||||
assert runtime_config.cameras["back"].timestamp_style.position == "tl"
|
assert runtime_config.cameras["back"].timestamp_style.position == "tl"
|
||||||
|
|
||||||
def test_global_timestamp_style_merge(self):
|
def test_global_timestamp_style_merge(self):
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
"mqtt": {"host": "mqtt"},
|
"mqtt": {"host": "mqtt"},
|
||||||
"rtmp": {"enabled": False},
|
"rtmp": {"enabled": False},
|
||||||
@ -1345,7 +1321,6 @@ class TestConfig(unittest.TestCase):
|
|||||||
assert runtime_config.cameras["back"].timestamp_style.thickness == 4
|
assert runtime_config.cameras["back"].timestamp_style.thickness == 4
|
||||||
|
|
||||||
def test_allow_retain_to_be_a_decimal(self):
|
def test_allow_retain_to_be_a_decimal(self):
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
"mqtt": {"host": "mqtt"},
|
"mqtt": {"host": "mqtt"},
|
||||||
"snapshots": {"retain": {"default": 1.5}},
|
"snapshots": {"retain": {"default": 1.5}},
|
||||||
|
|||||||
@ -772,7 +772,6 @@ def get_docker_memlimit_bytes() -> int:
|
|||||||
|
|
||||||
# check running a supported cgroups version
|
# check running a supported cgroups version
|
||||||
if get_cgroups_version() == "cgroup2":
|
if get_cgroups_version() == "cgroup2":
|
||||||
|
|
||||||
memlimit_command = ["cat", "/sys/fs/cgroup/memory.max"]
|
memlimit_command = ["cat", "/sys/fs/cgroup/memory.max"]
|
||||||
|
|
||||||
p = sp.run(
|
p = sp.run(
|
||||||
@ -817,7 +816,6 @@ def get_cpu_stats() -> dict[str, dict]:
|
|||||||
for line in lines:
|
for line in lines:
|
||||||
stats = list(filter(lambda a: a != "", line.strip().split(" ")))
|
stats = list(filter(lambda a: a != "", line.strip().split(" ")))
|
||||||
try:
|
try:
|
||||||
|
|
||||||
if docker_memlimit > 0:
|
if docker_memlimit > 0:
|
||||||
mem_res = int(stats[5])
|
mem_res = int(stats[5])
|
||||||
mem_pct = str(
|
mem_pct = str(
|
||||||
|
|||||||
@ -162,7 +162,6 @@ def capture_frames(
|
|||||||
current_frame: mp.Value,
|
current_frame: mp.Value,
|
||||||
stop_event: mp.Event,
|
stop_event: mp.Event,
|
||||||
):
|
):
|
||||||
|
|
||||||
frame_size = frame_shape[0] * frame_shape[1]
|
frame_size = frame_shape[0] * frame_shape[1]
|
||||||
frame_rate = EventsPerSecond()
|
frame_rate = EventsPerSecond()
|
||||||
frame_rate.start()
|
frame_rate.start()
|
||||||
@ -594,7 +593,6 @@ def process_frames(
|
|||||||
stop_event,
|
stop_event,
|
||||||
exit_on_empty: bool = False,
|
exit_on_empty: bool = False,
|
||||||
):
|
):
|
||||||
|
|
||||||
fps = process_info["process_fps"]
|
fps = process_info["process_fps"]
|
||||||
detection_fps = process_info["detection_fps"]
|
detection_fps = process_info["detection_fps"]
|
||||||
current_frame_time = process_info["detection_frame"]
|
current_frame_time = process_info["detection_frame"]
|
||||||
@ -748,7 +746,6 @@ def process_frames(
|
|||||||
|
|
||||||
selected_objects = []
|
selected_objects = []
|
||||||
for group in detected_object_groups.values():
|
for group in detected_object_groups.values():
|
||||||
|
|
||||||
# apply non-maxima suppression to suppress weak, overlapping bounding boxes
|
# apply non-maxima suppression to suppress weak, overlapping bounding boxes
|
||||||
# o[2] is the box of the object: xmin, ymin, xmax, ymax
|
# o[2] is the box of the object: xmin, ymin, xmax, ymax
|
||||||
# apply max/min to ensure values do not exceed the known frame size
|
# apply max/min to ensure values do not exceed the known frame size
|
||||||
|
|||||||
@ -13,6 +13,7 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
ZEROCONF_TYPE = "_frigate._tcp.local."
|
ZEROCONF_TYPE = "_frigate._tcp.local."
|
||||||
|
|
||||||
|
|
||||||
# Taken from: http://stackoverflow.com/a/11735897
|
# Taken from: http://stackoverflow.com/a/11735897
|
||||||
def get_local_ip() -> bytes:
|
def get_local_ip() -> bytes:
|
||||||
"""Try to determine the local IP address of the machine."""
|
"""Try to determine the local IP address of the machine."""
|
||||||
|
|||||||
@ -1,2 +1,2 @@
|
|||||||
pylint == 2.15.*
|
pylint == 2.17.*
|
||||||
black == 22.12.*
|
black == 23.3.*
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user