diff --git a/frigate/http.py b/frigate/http.py index 14da181a5..c8141bd2e 100644 --- a/frigate/http.py +++ b/frigate/http.py @@ -283,7 +283,10 @@ def event_clip(id): clip_path = os.path.join(CLIPS_DIR, file_name) if not os.path.isfile(clip_path): - return recording_clip(event.camera, event.start_time, event.end_time) + end_ts = ( + datetime.now().timestamp() if event.end_time is None else event.end_time + ) + return recording_clip(event.camera, event.start_time, end_ts) response = make_response() response.headers["Content-Description"] = "File Transfer" diff --git a/frigate/object_processing.py b/frigate/object_processing.py index 1ad6433a3..ec507ac7c 100644 --- a/frigate/object_processing.py +++ b/frigate/object_processing.py @@ -158,10 +158,10 @@ class TrackedObject: if self.obj_data["position_changes"] != obj_data["position_changes"]: significant_change = True - # if the motionless_count crosses the stationary threshold + # if the motionless_count reaches the stationary threshold if ( self.obj_data["motionless_count"] - > self.camera_config.detect.stationary_threshold + == self.camera_config.detect.stationary_threshold ): significant_change = True diff --git a/web/src/components/RecordingPlaylist.jsx b/web/src/components/RecordingPlaylist.jsx index 29f1cac22..3b3ff1568 100644 --- a/web/src/components/RecordingPlaylist.jsx +++ b/web/src/components/RecordingPlaylist.jsx @@ -1,6 +1,14 @@ import { h } from 'preact'; import { useState } from 'preact/hooks'; -import { addSeconds, differenceInSeconds, fromUnixTime, format, parseISO, startOfHour } from 'date-fns'; +import { + differenceInSeconds, + fromUnixTime, + format, + parseISO, + startOfHour, + differenceInMinutes, + differenceInHours, +} from 'date-fns'; import ArrowDropdown from '../icons/ArrowDropdown'; import ArrowDropup from '../icons/ArrowDropup'; import Link from '../components/Link'; @@ -89,9 +97,16 @@ export function ExpandableList({ title, events = 0, children, selected = false } export function EventCard({ camera, event, delay }) { const apiHost = useApiHost(); const start = fromUnixTime(event.start_time); - let duration = 0; + let duration = 'In Progress'; if (event.end_time) { - duration = addSeconds(new Date(0), differenceInSeconds(fromUnixTime(event.end_time), start)); + const end = fromUnixTime(event.end_time); + const hours = differenceInHours(end, start); + const minutes = differenceInMinutes(end, start) - hours * 60; + const seconds = differenceInSeconds(end, start) - hours * 60 - minutes * 60; + duration = ''; + if (hours) duration += `${hours}h `; + if (minutes) duration += `${minutes}m `; + duration += `${seconds}s`; } const position = differenceInSeconds(start, startOfHour(start)); const offset = Object.entries(delay) @@ -110,9 +125,7 @@ export function EventCard({ camera, event, delay }) {