mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-08 04:05:26 +03:00
Update sub labels for previous timeline items
This commit is contained in:
parent
58d66c5353
commit
fc259133ac
@ -85,12 +85,13 @@ class TimelineProcessor(threading.Thread):
|
|||||||
"""Handle object detection."""
|
"""Handle object detection."""
|
||||||
save = False
|
save = False
|
||||||
camera_config = self.config.cameras[camera]
|
camera_config = self.config.cameras[camera]
|
||||||
|
event_id = event_data["id"]
|
||||||
|
|
||||||
timeline_entry = {
|
timeline_entry = {
|
||||||
Timeline.timestamp: event_data["frame_time"],
|
Timeline.timestamp: event_data["frame_time"],
|
||||||
Timeline.camera: camera,
|
Timeline.camera: camera,
|
||||||
Timeline.source: "tracked_object",
|
Timeline.source: "tracked_object",
|
||||||
Timeline.source_id: event_data["id"],
|
Timeline.source_id: event_id,
|
||||||
Timeline.data: {
|
Timeline.data: {
|
||||||
"box": to_relative_box(
|
"box": to_relative_box(
|
||||||
camera_config.detect.width,
|
camera_config.detect.width,
|
||||||
@ -107,6 +108,23 @@ class TimelineProcessor(threading.Thread):
|
|||||||
"attribute": "",
|
"attribute": "",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# make sure all timeline items have a sub label
|
||||||
|
if prev_event_data != None and prev_event_data.get(
|
||||||
|
"sub_label"
|
||||||
|
) != event_data.get("sub_label"):
|
||||||
|
# update existing timeline items to have sub label
|
||||||
|
sub_label = event_data["sub_label"]
|
||||||
|
|
||||||
|
if sub_label[0] not in ALL_ATTRIBUTE_LABELS:
|
||||||
|
if event_id in self.pre_event_cache.keys():
|
||||||
|
for e in self.pre_event_cache[event_id]:
|
||||||
|
e[Timeline.data]["sub_label"] = sub_label
|
||||||
|
else:
|
||||||
|
Timeline.update(
|
||||||
|
data=Timeline.data.update({"sub_label": sub_label})
|
||||||
|
).where(Timeline.source_id == event_id).execute()
|
||||||
|
|
||||||
if event_type == "start":
|
if event_type == "start":
|
||||||
timeline_entry[Timeline.class_type] = "visible"
|
timeline_entry[Timeline.class_type] = "visible"
|
||||||
save = True
|
save = True
|
||||||
@ -129,13 +147,6 @@ class TimelineProcessor(threading.Thread):
|
|||||||
event_data["attributes"].keys()
|
event_data["attributes"].keys()
|
||||||
)[0]
|
)[0]
|
||||||
save = True
|
save = True
|
||||||
elif not prev_event_data.get("sub_label") and event_data.get("sub_label"):
|
|
||||||
sub_label = event_data["sub_label"][0]
|
|
||||||
|
|
||||||
if sub_label not in ALL_ATTRIBUTE_LABELS:
|
|
||||||
timeline_entry[Timeline.class_type] = "sub_label"
|
|
||||||
timeline_entry[Timeline.data]["sub_label"] = sub_label
|
|
||||||
save = True
|
|
||||||
elif event_type == "end":
|
elif event_type == "end":
|
||||||
timeline_entry[Timeline.class_type] = "gone"
|
timeline_entry[Timeline.class_type] = "gone"
|
||||||
save = True
|
save = True
|
||||||
|
|||||||
@ -52,7 +52,10 @@ export default function PreviewThumbnailPlayer({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!playerRef.current) {
|
if (!playerRef.current) {
|
||||||
|
if (isHovered) {
|
||||||
setIsInitiallyVisible(true);
|
setIsInitiallyVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,7 +106,7 @@ export default function PreviewThumbnailPlayer({
|
|||||||
{
|
{
|
||||||
threshold: 1.0,
|
threshold: 1.0,
|
||||||
root: document.getElementById("pageRoot"),
|
root: document.getElementById("pageRoot"),
|
||||||
rootMargin: "-15% 0px -15% 0px",
|
rootMargin: "-10% 0px -25% 0px",
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
if (node) autoPlayObserver.current.observe(node);
|
if (node) autoPlayObserver.current.observe(node);
|
||||||
|
|||||||
@ -36,7 +36,6 @@ type Timeline = {
|
|||||||
class_type:
|
class_type:
|
||||||
| "visible"
|
| "visible"
|
||||||
| "gone"
|
| "gone"
|
||||||
| "sub_label"
|
|
||||||
| "entered_zone"
|
| "entered_zone"
|
||||||
| "attribute"
|
| "attribute"
|
||||||
| "active"
|
| "active"
|
||||||
|
|||||||
@ -42,15 +42,6 @@ export function getTimelineIcon(timelineItem: Timeline) {
|
|||||||
default:
|
default:
|
||||||
return <LuTruck className="w-4 mr-1" />;
|
return <LuTruck className="w-4 mr-1" />;
|
||||||
}
|
}
|
||||||
case "sub_label":
|
|
||||||
switch (timelineItem.data.label) {
|
|
||||||
case "person":
|
|
||||||
return <MdFaceUnlock className="w-4 mr-1" />;
|
|
||||||
case "car":
|
|
||||||
return <MdOutlinePictureInPictureAlt className="w-4 mr-1" />;
|
|
||||||
default:
|
|
||||||
return <LuCircleDot className="w-4 mr-1" />;
|
|
||||||
}
|
|
||||||
case "heard":
|
case "heard":
|
||||||
return <LuEar className="w-4 mr-1" />;
|
return <LuEar className="w-4 mr-1" />;
|
||||||
case "external":
|
case "external":
|
||||||
@ -119,8 +110,6 @@ export function getTimelineItemDescription(timelineItem: Timeline) {
|
|||||||
}
|
}
|
||||||
return title;
|
return title;
|
||||||
}
|
}
|
||||||
case "sub_label":
|
|
||||||
return `${timelineItem.data.label} recognized as ${timelineItem.data.sub_label}`;
|
|
||||||
case "gone":
|
case "gone":
|
||||||
return `${label} left`;
|
return `${label} left`;
|
||||||
case "heard":
|
case "heard":
|
||||||
|
|||||||
@ -123,7 +123,7 @@ export default function DesktopTimelineView({
|
|||||||
|
|
||||||
const timelineTime = useMemo(() => {
|
const timelineTime = useMemo(() => {
|
||||||
if (scrubbing) {
|
if (scrubbing) {
|
||||||
return playerTime;
|
return selectedPlayback.range.start + playerTime;
|
||||||
} else {
|
} else {
|
||||||
// take a player time in seconds and convert to timestamp in timeline
|
// take a player time in seconds and convert to timestamp in timeline
|
||||||
let timestamp = 0;
|
let timestamp = 0;
|
||||||
@ -395,11 +395,10 @@ export default function DesktopTimelineView({
|
|||||||
setTimeToSeek(Math.round(seekTime));
|
setTimeToSeek(Math.round(seekTime));
|
||||||
}}
|
}}
|
||||||
timechangedHandler={(data) => {
|
timechangedHandler={(data) => {
|
||||||
const playbackTime = data.time.getTime() / 1000;
|
|
||||||
playerRef.current?.currentTime(
|
|
||||||
playbackTime - timeline.range.start
|
|
||||||
);
|
|
||||||
setScrubbing(false);
|
setScrubbing(false);
|
||||||
|
const playbackTime =
|
||||||
|
data.time.getTime() / 1000 - timeline.range.start;
|
||||||
|
playerRef.current?.currentTime(playbackTime);
|
||||||
playerRef.current?.play();
|
playerRef.current?.play();
|
||||||
}}
|
}}
|
||||||
selectHandler={(data) => {
|
selectHandler={(data) => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user