mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-07-15 00:11:15 +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,
|
||||
)
|
||||
from frigate.const import (
|
||||
CLIPS_DIR,
|
||||
RECORD_DIR,
|
||||
REPLAY_CAMERA_PREFIX,
|
||||
REPLAY_DIR,
|
||||
THUMB_DIR,
|
||||
@ -331,12 +329,14 @@ def cleanup_replay_cameras() -> None:
|
||||
"""
|
||||
stale_cameras: set[str] = set()
|
||||
|
||||
# Scan filesystem for leftover replay artifacts to derive camera names
|
||||
for dir_path in [RECORD_DIR, CLIPS_DIR, THUMB_DIR]:
|
||||
if os.path.isdir(dir_path):
|
||||
for entry in os.listdir(dir_path):
|
||||
if entry.startswith(REPLAY_CAMERA_PREFIX):
|
||||
stale_cameras.add(entry)
|
||||
# Derive stale camera names from THUMB_DIR (per-camera dirs) and
|
||||
# REPLAY_DIR (the session's source clip); both listings are bounded by
|
||||
# camera count. cleanup_camera_files below removes any remaining
|
||||
# per-camera artifacts (snapshots, thumbnails, LPR images, etc.) by name.
|
||||
if os.path.isdir(THUMB_DIR):
|
||||
for entry in os.listdir(THUMB_DIR):
|
||||
if entry.startswith(REPLAY_CAMERA_PREFIX):
|
||||
stale_cameras.add(entry)
|
||||
|
||||
if os.path.isdir(REPLAY_DIR):
|
||||
for entry in os.listdir(REPLAY_DIR):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user