diff --git a/frigate/http.py b/frigate/http.py index bbbf3c7a6..679a76763 100644 --- a/frigate/http.py +++ b/frigate/http.py @@ -524,12 +524,17 @@ def recordings(camera_name): FROM C2 WHERE cnt = 0 ) + SELECT id, label, camera, top_score, start_time, end_time + FROM event + WHERE camera = ? AND end_time IS NULL + UNION ALL SELECT MIN(id) as id, label, camera, MAX(top_score) as top_score, MIN(ts) AS start_time, max(ts) AS end_time FROM C3 GROUP BY label, grpnum ORDER BY start_time;""", camera_name, camera_name, + camera_name, ) event: Event diff --git a/web/src/components/RecordingPlaylist.jsx b/web/src/components/RecordingPlaylist.jsx index da04e1770..29f1cac22 100644 --- a/web/src/components/RecordingPlaylist.jsx +++ b/web/src/components/RecordingPlaylist.jsx @@ -21,25 +21,31 @@ export default function RecordingPlaylist({ camera, recordings, selectedDate, se events={recording.events} selected={recording.date === selectedDate} > - {recording.recordings.slice().reverse().map((item, i) => ( -
-
-
- - {item.hour}:00 - + {recording.recordings + .slice() + .reverse() + .map((item, i) => ( +
+
+
+ + {item.hour}:00 + +
+
{item.events.length} Events
-
{item.events.length} Events
+ {item.events + .slice() + .reverse() + .map((event) => ( + + ))}
- {item.events.slice().reverse().map((event) => ( - - ))} -
- ))} + ))} ); } @@ -83,8 +89,10 @@ export function ExpandableList({ title, events = 0, children, selected = false } export function EventCard({ camera, event, delay }) { const apiHost = useApiHost(); const start = fromUnixTime(event.start_time); - const end = fromUnixTime(event.end_time); - const duration = addSeconds(new Date(0), differenceInSeconds(end, start)); + let duration = 0; + if (event.end_time) { + duration = addSeconds(new Date(0), differenceInSeconds(fromUnixTime(event.end_time), start)); + } const position = differenceInSeconds(start, startOfHour(start)); const offset = Object.entries(delay) .map(([p, d]) => (position > p ? d : 0)) @@ -102,7 +110,9 @@ export function EventCard({ camera, event, delay }) {
{event.label}
Start: {format(start, 'HH:mm:ss')}
-
Duration: {format(duration, 'mm:ss')}
+
+ Duration: {duration ? format(duration, 'mm:ss') : 'In Progress'} +
{(event.top_score * 100).toFixed(1)}%