Merge branch 'release-0.10.0' of github.com:blakeblackshear/frigate into retain-select-events

This commit is contained in:
Nick Mowen 2022-02-09 07:52:41 -07:00
commit 9b975af176
6 changed files with 14824 additions and 39 deletions

View File

@ -558,12 +558,17 @@ def recordings(camera_name):
FROM C2 FROM C2
WHERE cnt = 0 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 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 FROM C3
GROUP BY label, grpnum GROUP BY label, grpnum
ORDER BY start_time;""", ORDER BY start_time;""",
camera_name, camera_name,
camera_name, camera_name,
camera_name,
) )
event: Event event: Event

View File

@ -165,6 +165,10 @@ class TrackedObject:
): ):
significant_change = True significant_change = True
# update at least once per minute
if self.obj_data["frame_time"] - self.previous["frame_time"] > 60:
significant_change = True
self.obj_data.update(obj_data) self.obj_data.update(obj_data)
self.current_zones = current_zones self.current_zones = current_zones
return (thumb_update, significant_change) return (thumb_update, significant_change)

View File

@ -51,7 +51,6 @@ class RecordingMaintainer(threading.Thread):
self.config = config self.config = config
self.recordings_info_queue = recordings_info_queue self.recordings_info_queue = recordings_info_queue
self.stop_event = stop_event self.stop_event = stop_event
self.first_pass = True
self.recordings_info = defaultdict(list) self.recordings_info = defaultdict(list)
self.end_time_cache = {} self.end_time_cache = {}
@ -334,12 +333,6 @@ class RecordingMaintainer(threading.Thread):
logger.error(e) logger.error(e)
duration = datetime.datetime.now().timestamp() - run_start duration = datetime.datetime.now().timestamp() - run_start
wait_time = max(0, 5 - duration) wait_time = max(0, 5 - duration)
if wait_time == 0 and not self.first_pass:
logger.warning(
"Cache is taking longer than 5 seconds to clear. Your recordings disk may be too slow."
)
if self.first_pass:
self.first_pass = False
logger.info(f"Exiting recording maintenance...") logger.info(f"Exiting recording maintenance...")

14794
web/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -21,7 +21,10 @@ export default function RecordingPlaylist({ camera, recordings, selectedDate, se
events={recording.events} events={recording.events}
selected={recording.date === selectedDate} selected={recording.date === selectedDate}
> >
{recording.recordings.slice().reverse().map((item, i) => ( {recording.recordings
.slice()
.reverse()
.map((item, i) => (
<div className="mb-2 w-full"> <div className="mb-2 w-full">
<div <div
className={`flex w-full text-md text-white px-8 py-2 mb-2 ${ className={`flex w-full text-md text-white px-8 py-2 mb-2 ${
@ -35,7 +38,10 @@ export default function RecordingPlaylist({ camera, recordings, selectedDate, se
</div> </div>
<div className="flex-1 text-right">{item.events.length} Events</div> <div className="flex-1 text-right">{item.events.length} Events</div>
</div> </div>
{item.events.slice().reverse().map((event) => ( {item.events
.slice()
.reverse()
.map((event) => (
<EventCard camera={camera} event={event} delay={item.delay} /> <EventCard camera={camera} event={event} delay={item.delay} />
))} ))}
</div> </div>
@ -83,8 +89,10 @@ export function ExpandableList({ title, events = 0, children, selected = false }
export function EventCard({ camera, event, delay }) { export function EventCard({ camera, event, delay }) {
const apiHost = useApiHost(); const apiHost = useApiHost();
const start = fromUnixTime(event.start_time); const start = fromUnixTime(event.start_time);
const end = fromUnixTime(event.end_time); let duration = 0;
const duration = addSeconds(new Date(0), differenceInSeconds(end, start)); if (event.end_time) {
duration = addSeconds(new Date(0), differenceInSeconds(fromUnixTime(event.end_time), start));
}
const position = differenceInSeconds(start, startOfHour(start)); const position = differenceInSeconds(start, startOfHour(start));
const offset = Object.entries(delay) const offset = Object.entries(delay)
.map(([p, d]) => (position > p ? d : 0)) .map(([p, d]) => (position > p ? d : 0))
@ -102,7 +110,9 @@ export function EventCard({ camera, event, delay }) {
<div className="flex-1"> <div className="flex-1">
<div className="text-2xl text-white leading-tight capitalize">{event.label}</div> <div className="text-2xl text-white leading-tight capitalize">{event.label}</div>
<div className="text-xs md:text-normal text-gray-300">Start: {format(start, 'HH:mm:ss')}</div> <div className="text-xs md:text-normal text-gray-300">Start: {format(start, 'HH:mm:ss')}</div>
<div className="text-xs md:text-normal text-gray-300">Duration: {format(duration, 'mm:ss')}</div> <div className="text-xs md:text-normal text-gray-300">
Duration: {duration ? format(duration, 'mm:ss') : 'In Progress'}
</div>
</div> </div>
<div className="text-lg text-white text-right leading-tight">{(event.top_score * 100).toFixed(1)}%</div> <div className="text-lg text-white text-right leading-tight">{(event.top_score * 100).toFixed(1)}%</div>
</div> </div>

View File

@ -64,6 +64,9 @@ export default function Recording({ camera, date, hour, seconds }) {
this.player.playlist.currentItem(selectedHour); this.player.playlist.currentItem(selectedHour);
if (seconds !== undefined) { if (seconds !== undefined) {
this.player.currentTime(seconds); this.player.currentTime(seconds);
// Force playback rate to be correct
const playbackRate = this.player.playbackRate();
this.player.defaultPlaybackRate(playbackRate);
} }
} }
} }