mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-07 03:35:26 +03:00
Add attribute item to timeline
This commit is contained in:
parent
9a4f970337
commit
3f801b821a
@ -74,6 +74,7 @@ class TimelineProcessor(threading.Thread):
|
|||||||
camera_config.detect.height,
|
camera_config.detect.height,
|
||||||
event_data["region"],
|
event_data["region"],
|
||||||
),
|
),
|
||||||
|
"attribute": "",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
if event_type == "start":
|
if event_type == "start":
|
||||||
@ -93,6 +94,14 @@ class TimelineProcessor(threading.Thread):
|
|||||||
"stationary" if event_data["stationary"] else "active"
|
"stationary" if event_data["stationary"] else "active"
|
||||||
)
|
)
|
||||||
Timeline.insert(timeline_entry).execute()
|
Timeline.insert(timeline_entry).execute()
|
||||||
|
elif prev_event_data["attributes"] == {} and event_data["attributes"] != {}:
|
||||||
|
logger.error(f"Saving info {event_data['attributes']}")
|
||||||
|
timeline_entry[Timeline.class_type] = "attribute"
|
||||||
|
timeline_entry[Timeline.data]["attribute"] = list(
|
||||||
|
event_data["attributes"].keys()
|
||||||
|
)[0]
|
||||||
|
logger.error(f"The data is {timeline_entry}")
|
||||||
|
Timeline.insert(timeline_entry).execute()
|
||||||
elif event_type == "end":
|
elif event_type == "end":
|
||||||
timeline_entry[Timeline.class_type] = "gone"
|
timeline_entry[Timeline.class_type] = "gone"
|
||||||
Timeline.insert(timeline_entry).execute()
|
Timeline.insert(timeline_entry).execute()
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import ActiveObjectIcon from '../icons/ActiveObject';
|
|||||||
import PlayIcon from '../icons/Play';
|
import PlayIcon from '../icons/Play';
|
||||||
import ExitIcon from '../icons/Exit';
|
import ExitIcon from '../icons/Exit';
|
||||||
import StationaryObjectIcon from '../icons/StationaryObject';
|
import StationaryObjectIcon from '../icons/StationaryObject';
|
||||||
|
import FaceIcon from '../icons/Face';
|
||||||
import { Zone } from '../icons/Zone';
|
import { Zone } from '../icons/Zone';
|
||||||
import { useMemo, useState } from 'preact/hooks';
|
import { useMemo, useState } from 'preact/hooks';
|
||||||
import Button from './Button';
|
import Button from './Button';
|
||||||
@ -88,7 +89,7 @@ export default function TimelineSummary({ event, onFrameSelected }) {
|
|||||||
aria-label={window.innerWidth > 640 ? getTimelineItemDescription(config, item, event) : ''}
|
aria-label={window.innerWidth > 640 ? getTimelineItemDescription(config, item, event) : ''}
|
||||||
onClick={() => onSelectMoment(index)}
|
onClick={() => onSelectMoment(index)}
|
||||||
>
|
>
|
||||||
{getTimelineIcon(item.class_type)}
|
{getTimelineIcon(item)}
|
||||||
</Button>
|
</Button>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
@ -113,8 +114,8 @@ export default function TimelineSummary({ event, onFrameSelected }) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTimelineIcon(classType) {
|
function getTimelineIcon(timelineItem) {
|
||||||
switch (classType) {
|
switch (timelineItem.class_type) {
|
||||||
case 'visible':
|
case 'visible':
|
||||||
return <PlayIcon className="w-8" />;
|
return <PlayIcon className="w-8" />;
|
||||||
case 'gone':
|
case 'gone':
|
||||||
@ -125,6 +126,11 @@ function getTimelineIcon(classType) {
|
|||||||
return <StationaryObjectIcon className="w-8" />;
|
return <StationaryObjectIcon className="w-8" />;
|
||||||
case 'entered_zone':
|
case 'entered_zone':
|
||||||
return <Zone className="w-8" />;
|
return <Zone className="w-8" />;
|
||||||
|
case 'attribute':
|
||||||
|
switch (timelineItem.data.attribute) {
|
||||||
|
case 'face':
|
||||||
|
return <FaceIcon className="w-8" />;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,6 +162,15 @@ function getTimelineItemDescription(config, timelineItem, event) {
|
|||||||
time_style: 'medium',
|
time_style: 'medium',
|
||||||
time_format: config.ui.time_format,
|
time_format: config.ui.time_format,
|
||||||
})}`;
|
})}`;
|
||||||
|
case 'attribute':
|
||||||
|
return `${timelineItem.data.attribute} detected for ${event.label} at ${formatUnixTimestampToDateTime(
|
||||||
|
timelineItem.timestamp,
|
||||||
|
{
|
||||||
|
date_style: 'short',
|
||||||
|
time_style: 'medium',
|
||||||
|
time_format: config.ui.time_format,
|
||||||
|
},
|
||||||
|
)}`;
|
||||||
case 'gone':
|
case 'gone':
|
||||||
return `${event.label} left at ${formatUnixTimestampToDateTime(timelineItem.timestamp, {
|
return `${event.label} left at ${formatUnixTimestampToDateTime(timelineItem.timestamp, {
|
||||||
date_style: 'short',
|
date_style: 'short',
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user