NVR with realtime local object detection for IP cameras
TypeScript aicameragoogle-coralhome-assistanthome-automationhomeautomationmqttnvrobject-detectionrealtimertsptensorflow
Reuse CACHE_DIR constant (#7306)
Martin Weineltd0b38f0a473b
diff --git a/frigate/http.py b/frigate/http.pyindex 6cf552c9fe..1cce6968e3 100644--- a/frigate/http.py+++ b/frigate/http.py@@ -30,7 +30,13 @@ from playhouse.sqliteq import SqliteQueueDatabasefrom tzlocal import get_localzone_namefrom frigate.config import FrigateConfig-from frigate.const import CLIPS_DIR, CONFIG_DIR, MAX_SEGMENT_DURATION, RECORD_DIR+from frigate.const import (+ CACHE_DIR,+ CLIPS_DIR,+ CONFIG_DIR,+ MAX_SEGMENT_DURATION,+ RECORD_DIR,+)from frigate.events.external import ExternalEventProcessorfrom frigate.models import Event, Recordings, Timelinefrom frigate.object_processing import TrackedObject@@ -1441,7 +1447,7 @@ def recording_clip(camera_name, start_ts, end_ts):playlist_lines.append(f"outpoint {int(end_ts - clip.start_time)}")file_name = f"clip_{camera_name}_{start_ts}-{end_ts}.mp4"- path = f"/tmp/cache/{file_name}"+ path = os.path.join(CACHE_DIR, file_name)if not os.path.exists(path):ffmpeg_cmd = [diff --git a/frigate/record/cleanup.py b/frigate/record/cleanup.pyindex 33fcbe3986..cb312b6fd5 100644--- a/frigate/record/cleanup.py+++ b/frigate/record/cleanup.py@@ -11,7 +11,7 @@ from pathlib import Pathfrom peewee import DatabaseError, chunkedfrom frigate.config import FrigateConfig, RetainModeEnum-from frigate.const import RECORD_DIR+from frigate.const import CACHE_DIR, RECORD_DIRfrom frigate.models import Event, Recordings, RecordingsToDeletefrom frigate.record.util import remove_empty_directories@@ -29,7 +29,7 @@ class RecordingCleanup(threading.Thread):def clean_tmp_clips(self) -> None:"""delete any clips in the cache that are more than 5 minutes old."""- for p in Path("/tmp/cache").rglob("clip_*.mp4"):+ for p in Path(CACHE_DIR).rglob("clip_*.mp4"):logger.debug(f"Checking tmp clip {p}.")if p.stat().st_mtime < (datetime.datetime.now().timestamp() - 60 * 1):logger.debug("Deleting tmp clip.")