mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-05-03 06:50:58 +00:00
Compare commits
3 Commits
6159604b35
...
c4a53ae9ae
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c4a53ae9ae | ||
|
|
8c2fe78783 | ||
|
|
48963618be |
@ -291,11 +291,9 @@ class CameraState:
|
|||||||
new_obj.thumbnail_data = thumbnail_data
|
new_obj.thumbnail_data = thumbnail_data
|
||||||
tracked_objects[id].thumbnail_data = thumbnail_data
|
tracked_objects[id].thumbnail_data = thumbnail_data
|
||||||
object_type = new_obj.obj_data["label"]
|
object_type = new_obj.obj_data["label"]
|
||||||
self.best_objects[object_type] = new_obj
|
|
||||||
|
|
||||||
# call event handlers
|
# call event handlers
|
||||||
for c in self.callbacks["snapshot"]:
|
self.send_mqtt_snapshot(new_obj, object_type)
|
||||||
c(self.name, self.best_objects[object_type], frame_name)
|
|
||||||
|
|
||||||
for c in self.callbacks["start"]:
|
for c in self.callbacks["start"]:
|
||||||
c(self.name, new_obj, frame_name)
|
c(self.name, new_obj, frame_name)
|
||||||
@ -417,13 +415,9 @@ class CameraState:
|
|||||||
or (now - current_best.thumbnail_data["frame_time"])
|
or (now - current_best.thumbnail_data["frame_time"])
|
||||||
> self.camera_config.best_image_timeout
|
> self.camera_config.best_image_timeout
|
||||||
):
|
):
|
||||||
self.best_objects[object_type] = obj
|
self.send_mqtt_snapshot(obj, object_type)
|
||||||
for c in self.callbacks["snapshot"]:
|
|
||||||
c(self.name, self.best_objects[object_type], frame_name)
|
|
||||||
else:
|
else:
|
||||||
self.best_objects[object_type] = obj
|
self.send_mqtt_snapshot(obj, object_type)
|
||||||
for c in self.callbacks["snapshot"]:
|
|
||||||
c(self.name, self.best_objects[object_type], frame_name)
|
|
||||||
|
|
||||||
for c in self.callbacks["camera_activity"]:
|
for c in self.callbacks["camera_activity"]:
|
||||||
c(self.name, camera_activity)
|
c(self.name, camera_activity)
|
||||||
@ -472,6 +466,20 @@ class CameraState:
|
|||||||
|
|
||||||
self.previous_frame_id = frame_name
|
self.previous_frame_id = frame_name
|
||||||
|
|
||||||
|
def send_mqtt_snapshot(self, new_obj: TrackedObject, object_type: str) -> None:
|
||||||
|
for c in self.callbacks["snapshot"]:
|
||||||
|
updated = c(self.name, new_obj)
|
||||||
|
|
||||||
|
# if the snapshot was not updated, then this object is not a best object
|
||||||
|
# but all new objects should be considered the next best object
|
||||||
|
# so we remove the label from the best objects
|
||||||
|
if updated:
|
||||||
|
self.best_objects[object_type] = new_obj
|
||||||
|
else:
|
||||||
|
if object_type in self.best_objects:
|
||||||
|
self.best_objects.pop(object_type)
|
||||||
|
break
|
||||||
|
|
||||||
def save_manual_event_image(
|
def save_manual_event_image(
|
||||||
self,
|
self,
|
||||||
frame: np.ndarray | None,
|
frame: np.ndarray | None,
|
||||||
|
|||||||
@ -792,6 +792,10 @@ class OnvifController:
|
|||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
logger.debug(
|
||||||
|
f"{camera_name}: Pan/tilt status: {pan_tilt_status}, Zoom status: {zoom_status}"
|
||||||
|
)
|
||||||
|
|
||||||
if pan_tilt_status == "IDLE" and (zoom_status is None or zoom_status == "IDLE"):
|
if pan_tilt_status == "IDLE" and (zoom_status is None or zoom_status == "IDLE"):
|
||||||
self.cams[camera_name]["active"] = False
|
self.cams[camera_name]["active"] = False
|
||||||
if not self.ptz_metrics[camera_name].motor_stopped.is_set():
|
if not self.ptz_metrics[camera_name].motor_stopped.is_set():
|
||||||
|
|||||||
@ -156,7 +156,7 @@ class TrackedObjectProcessor(threading.Thread):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
def snapshot(camera, obj: TrackedObject, frame_name: str):
|
def snapshot(camera: str, obj: TrackedObject) -> bool:
|
||||||
mqtt_config: CameraMqttConfig = self.config.cameras[camera].mqtt
|
mqtt_config: CameraMqttConfig = self.config.cameras[camera].mqtt
|
||||||
if mqtt_config.enabled and self.should_mqtt_snapshot(camera, obj):
|
if mqtt_config.enabled and self.should_mqtt_snapshot(camera, obj):
|
||||||
jpg_bytes = obj.get_img_bytes(
|
jpg_bytes = obj.get_img_bytes(
|
||||||
@ -189,6 +189,10 @@ class TrackedObjectProcessor(threading.Thread):
|
|||||||
retain=True,
|
retain=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
def camera_activity(camera, activity):
|
def camera_activity(camera, activity):
|
||||||
last_activity = self.camera_activity.get(camera)
|
last_activity = self.camera_activity.get(camera)
|
||||||
|
|
||||||
|
|||||||
@ -1242,13 +1242,13 @@ export function VideoTab({ search }: VideoTabProps) {
|
|||||||
<>
|
<>
|
||||||
<span tabIndex={0} className="sr-only" />
|
<span tabIndex={0} className="sr-only" />
|
||||||
<GenericVideoPlayer source={source}>
|
<GenericVideoPlayer source={source}>
|
||||||
{reviewItem && (
|
<div
|
||||||
<div
|
className={cn(
|
||||||
className={cn(
|
"absolute top-2 z-10 flex items-center gap-2",
|
||||||
"absolute top-2 z-10 flex items-center gap-2",
|
isIOS ? "right-8" : "right-2",
|
||||||
isIOS ? "right-8" : "right-2",
|
)}
|
||||||
)}
|
>
|
||||||
>
|
{reviewItem && (
|
||||||
<Tooltip>
|
<Tooltip>
|
||||||
<TooltipTrigger>
|
<TooltipTrigger>
|
||||||
<Chip
|
<Chip
|
||||||
@ -1271,25 +1271,25 @@ export function VideoTab({ search }: VideoTabProps) {
|
|||||||
</TooltipContent>
|
</TooltipContent>
|
||||||
</TooltipPortal>
|
</TooltipPortal>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<Tooltip>
|
)}
|
||||||
<TooltipTrigger asChild>
|
<Tooltip>
|
||||||
<a
|
<TooltipTrigger asChild>
|
||||||
download
|
<a
|
||||||
href={`${baseUrl}api/${search.camera}/${clipTimeRange}/clip.mp4`}
|
download
|
||||||
>
|
href={`${baseUrl}api/${search.camera}/${clipTimeRange}/clip.mp4`}
|
||||||
<Chip className="cursor-pointer rounded-md bg-gray-500 bg-gradient-to-br from-gray-400 to-gray-500">
|
>
|
||||||
<FaDownload className="size-4 text-white" />
|
<Chip className="cursor-pointer rounded-md bg-gray-500 bg-gradient-to-br from-gray-400 to-gray-500">
|
||||||
</Chip>
|
<FaDownload className="size-4 text-white" />
|
||||||
</a>
|
</Chip>
|
||||||
</TooltipTrigger>
|
</a>
|
||||||
<TooltipPortal>
|
</TooltipTrigger>
|
||||||
<TooltipContent>
|
<TooltipPortal>
|
||||||
{t("button.download", { ns: "common" })}
|
<TooltipContent>
|
||||||
</TooltipContent>
|
{t("button.download", { ns: "common" })}
|
||||||
</TooltipPortal>
|
</TooltipContent>
|
||||||
</Tooltip>
|
</TooltipPortal>
|
||||||
</div>
|
</Tooltip>
|
||||||
)}
|
</div>
|
||||||
</GenericVideoPlayer>
|
</GenericVideoPlayer>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user