Fix camera name prefix matching (#24992)

* only remove the deleted camera's media files

Camera deletion globbed snapshot, clean copy, and review thumbnail files by "{camera}-*", and camera names can contain "-", so deleting "front" also removed every one of those files for "front-door". Files are now matched on the full name, the camera followed by an event or review id.

* only use the camera's own preview frames for review descriptions

get_cache_frames matched cached preview frames by "preview_{camera}-", so when "front" had no frame after the review ended, the first "front-door" frame became the trailing frame and went into front's GenAI prompt. It now uses is_camera_preview_frame like the preview recorder and exports.

* keep cleaning up when a media directory can't be listed
This commit is contained in:
Josh Hawkins
2026-11-16 12:04:55 -06:00
committed by GitHub
parent 128729f5ac
commit f22278bcfa
3 changed files with 66 additions and 26 deletions
@@ -35,6 +35,7 @@ from frigate.data_processing.types import PostProcessDataEnum
from frigate.genai import GenAIClient
from frigate.genai.manager import GenAIClientManager
from frigate.models import Event, Recordings, ReviewSegment
from frigate.output.preview import is_camera_preview_frame
from frigate.util.builtin import EventsPerSecond, InferenceSpeed
from frigate.util.image import get_image_from_recording
from frigate.util.recording_coverage import recording_overlap
@@ -528,7 +529,7 @@ class ReviewDescriptionProcessor(PostProcessorApi):
camera_files = [
entry.name
for entry in os.scandir(preview_dir)
if entry.name.startswith(file_start)
if is_camera_preview_frame(entry.name, camera)
]
camera_files.sort()