mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-07-16 00:41:14 +03:00
derive stale replay cameras from bounded directory listings to avoid scanning all clips at startup
This commit is contained in:
parent
91b3ed1202
commit
bcb706f510
@ -21,8 +21,6 @@ from frigate.config.camera.updater import (
|
|||||||
CameraConfigUpdateTopic,
|
CameraConfigUpdateTopic,
|
||||||
)
|
)
|
||||||
from frigate.const import (
|
from frigate.const import (
|
||||||
CLIPS_DIR,
|
|
||||||
RECORD_DIR,
|
|
||||||
REPLAY_CAMERA_PREFIX,
|
REPLAY_CAMERA_PREFIX,
|
||||||
REPLAY_DIR,
|
REPLAY_DIR,
|
||||||
THUMB_DIR,
|
THUMB_DIR,
|
||||||
@ -331,12 +329,14 @@ def cleanup_replay_cameras() -> None:
|
|||||||
"""
|
"""
|
||||||
stale_cameras: set[str] = set()
|
stale_cameras: set[str] = set()
|
||||||
|
|
||||||
# Scan filesystem for leftover replay artifacts to derive camera names
|
# Derive stale camera names from THUMB_DIR (per-camera dirs) and
|
||||||
for dir_path in [RECORD_DIR, CLIPS_DIR, THUMB_DIR]:
|
# REPLAY_DIR (the session's source clip); both listings are bounded by
|
||||||
if os.path.isdir(dir_path):
|
# camera count. cleanup_camera_files below removes any remaining
|
||||||
for entry in os.listdir(dir_path):
|
# per-camera artifacts (snapshots, thumbnails, LPR images, etc.) by name.
|
||||||
if entry.startswith(REPLAY_CAMERA_PREFIX):
|
if os.path.isdir(THUMB_DIR):
|
||||||
stale_cameras.add(entry)
|
for entry in os.listdir(THUMB_DIR):
|
||||||
|
if entry.startswith(REPLAY_CAMERA_PREFIX):
|
||||||
|
stale_cameras.add(entry)
|
||||||
|
|
||||||
if os.path.isdir(REPLAY_DIR):
|
if os.path.isdir(REPLAY_DIR):
|
||||||
for entry in os.listdir(REPLAY_DIR):
|
for entry in os.listdir(REPLAY_DIR):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user