mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-12-07 05:54:10 +03:00
* fix recordings check * Only calculate inpoint offset for beginning of hour segment * Cleanup * Fix seeking * add Czech * explore i18n fix --------- Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>
27 lines
777 B
TypeScript
27 lines
777 B
TypeScript
import { Recording } from "@/types/record";
|
|
|
|
/** the HLS endpoint returns the vod segments with the first
|
|
* segment of the hour trimmed, meaning it will start at
|
|
* the beginning of the hour, cutting off any difference
|
|
* that the segment has.
|
|
*/
|
|
export function calculateInpointOffset(
|
|
timeRangeStart: number | undefined,
|
|
firstRecordingSegment: Recording | undefined,
|
|
): number {
|
|
if (!timeRangeStart || !firstRecordingSegment) {
|
|
return 0;
|
|
}
|
|
|
|
// if the first recording segment does not cross over
|
|
// the beginning of the time range then there is no offset
|
|
if (
|
|
firstRecordingSegment.start_time < timeRangeStart &&
|
|
firstRecordingSegment.end_time > timeRangeStart
|
|
) {
|
|
return timeRangeStart - firstRecordingSegment.start_time;
|
|
}
|
|
|
|
return 0;
|
|
}
|