mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-07-02 01:51:14 +03:00
filter motion review by allowed cameras
This commit is contained in:
parent
d556ff8df2
commit
8368f22784
@ -66,6 +66,7 @@ import SummaryTimeline from "@/components/timeline/SummaryTimeline";
|
|||||||
import { RecordingStartingPoint } from "@/types/record";
|
import { RecordingStartingPoint } from "@/types/record";
|
||||||
import VideoControls from "@/components/player/VideoControls";
|
import VideoControls from "@/components/player/VideoControls";
|
||||||
import { TimeRange } from "@/types/timeline";
|
import { TimeRange } from "@/types/timeline";
|
||||||
|
import { useAllowedCameras } from "@/hooks/use-allowed-cameras";
|
||||||
import {
|
import {
|
||||||
useCameraMotionNextTimestamp,
|
useCameraMotionNextTimestamp,
|
||||||
useCameraMotionOnlyRanges,
|
useCameraMotionOnlyRanges,
|
||||||
@ -1008,27 +1009,29 @@ function MotionReview({
|
|||||||
const { t } = useTranslation(["views/events", "common"]);
|
const { t } = useTranslation(["views/events", "common"]);
|
||||||
const segmentDuration = 30;
|
const segmentDuration = 30;
|
||||||
const { data: config } = useSWR<FrigateConfig>("config");
|
const { data: config } = useSWR<FrigateConfig>("config");
|
||||||
|
const allowedCameras = useAllowedCameras();
|
||||||
|
|
||||||
const reviewCameras = useMemo(() => {
|
const reviewCameras = useMemo(() => {
|
||||||
if (!config) {
|
if (!config) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
let cameras;
|
const selectedCams = filter?.cameras;
|
||||||
if (!filter || !filter.cameras) {
|
const cameras = Object.values(config.cameras).filter((cam) => {
|
||||||
cameras = Object.values(config.cameras).filter(
|
if (isReplayCamera(cam.name)) {
|
||||||
(cam) => !isReplayCamera(cam.name),
|
return false;
|
||||||
);
|
}
|
||||||
} else {
|
if (!allowedCameras.includes(cam.name)) {
|
||||||
const filteredCams = filter.cameras;
|
return false;
|
||||||
|
}
|
||||||
cameras = Object.values(config.cameras).filter(
|
if (selectedCams && !selectedCams.includes(cam.name)) {
|
||||||
(cam) => filteredCams.includes(cam.name) && !isReplayCamera(cam.name),
|
return false;
|
||||||
);
|
}
|
||||||
}
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
return cameras.sort((a, b) => a.ui.order - b.ui.order);
|
return cameras.sort((a, b) => a.ui.order - b.ui.order);
|
||||||
}, [config, filter]);
|
}, [config, filter, allowedCameras]);
|
||||||
|
|
||||||
const videoPlayersRef = useRef<{ [camera: string]: PreviewController }>({});
|
const videoPlayersRef = useRef<{ [camera: string]: PreviewController }>({});
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user