mirror of
https://github.com/alexhopeoconnor/frigate.git
synced 2026-10-19 09:51:31 +10:00
Miscellaneous fixes (#23082)
* openvino log message and preview directory checks * restrict config vars for viewer users * recording timestamp fix when startTime is exactly on an hour boundary, findIndex returns the first matching chunk, which is the previous hour's chunk (where before == startTime), instead of the correct chunk (where after == startTime) the bug shows up when using the share timestamp feature and sharing a specific timestamp on the exact hour mark. when accessing the shared link, the timeline would jump to the incorrect hour * use helper for chunked time range * Adjustments to contributing docs * tweak * Improve wording * tweak --------- Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>
This commit is contained in:
co-authored by
Nicolas Mowen
parent
ba4a6a53d7
commit
45213d0420
@@ -38,6 +38,22 @@ export function getChunkedTimeDay(timeRange: TimeRange): TimeRange[] {
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the chunk index that contains the given timestamp.
|
||||
* Uses half-open intervals [after, before) for all chunks except the last,
|
||||
* which uses a closed interval [after, before] so the terminal boundary
|
||||
* is always reachable.
|
||||
*/
|
||||
export function findChunkIndex(chunks: TimeRange[], timestamp: number): number {
|
||||
return chunks.findIndex((chunk, i) => {
|
||||
const isLast = i === chunks.length - 1;
|
||||
return (
|
||||
chunk.after <= timestamp &&
|
||||
(isLast ? chunk.before >= timestamp : chunk.before > timestamp)
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
export function getChunkedTimeRange(
|
||||
startTimestamp: number,
|
||||
endTimestamp: number,
|
||||
|
||||
Reference in New Issue
Block a user