mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-04-01 01:17:00 +02:00
Remove live mode from config (#11618)
* Use preferred mode as default * Remove live mode from config * Add deer icon * remove from config schema
This commit is contained in:
parent
9245c5cb56
commit
9e8202874e
@ -645,8 +645,6 @@ cameras:
|
||||
|
||||
# Optional
|
||||
ui:
|
||||
# Optional: Set the default live mode for cameras in the UI (default: shown below)
|
||||
live_mode: mse
|
||||
# Optional: Set a timezone to use in the UI (default: use browser local time)
|
||||
# timezone: America/Denver
|
||||
# Optional: Set the time format used.
|
||||
|
@ -100,9 +100,6 @@ class DateTimeStyleEnum(str, Enum):
|
||||
|
||||
|
||||
class UIConfig(FrigateBaseModel):
|
||||
live_mode: LiveModeEnum = Field(
|
||||
default=LiveModeEnum.mse, title="Default Live Mode."
|
||||
)
|
||||
timezone: Optional[str] = Field(default=None, title="Override UI timezone.")
|
||||
time_format: TimeFormatEnum = Field(
|
||||
default=TimeFormatEnum.browser, title="Override UI time format."
|
||||
|
@ -87,8 +87,12 @@ def migrate_014(config: dict[str, dict[str, any]]) -> dict[str, dict[str, any]]:
|
||||
if not new_config["record"]:
|
||||
del new_config["record"]
|
||||
|
||||
if new_config.get("ui", {}).get("use_experimental"):
|
||||
del new_config["ui"]["experimental"]
|
||||
if new_config.get("ui"):
|
||||
if new_config["ui"].get("use_experimental"):
|
||||
del new_config["ui"]["experimental"]
|
||||
|
||||
if new_config["ui"].get("live_mode"):
|
||||
del new_config["ui"]["live_mode"]
|
||||
|
||||
if not new_config["ui"]:
|
||||
del new_config["ui"]
|
||||
|
@ -6,7 +6,7 @@ import { LivePlayerMode } from "@/types/live";
|
||||
|
||||
export default function useCameraLiveMode(
|
||||
cameraConfig: CameraConfig,
|
||||
preferredMode?: string,
|
||||
preferredMode?: LivePlayerMode,
|
||||
): LivePlayerMode | undefined {
|
||||
const { data: config } = useSWR<FrigateConfig>("config");
|
||||
|
||||
@ -23,18 +23,16 @@ export default function useCameraLiveMode(
|
||||
);
|
||||
}, [config, cameraConfig]);
|
||||
const defaultLiveMode = useMemo<LivePlayerMode | undefined>(() => {
|
||||
if (config && cameraConfig) {
|
||||
if (config) {
|
||||
if (restreamEnabled) {
|
||||
return cameraConfig.ui.live_mode || config.ui.live_mode;
|
||||
return preferredMode || "mse";
|
||||
}
|
||||
|
||||
return "jsmpeg";
|
||||
}
|
||||
|
||||
return undefined;
|
||||
// config will be updated if camera config is updated
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [cameraConfig, restreamEnabled]);
|
||||
}, [config, preferredMode, restreamEnabled]);
|
||||
const [viewSource] = usePersistence<LivePlayerMode>(
|
||||
`${cameraConfig.name}-source`,
|
||||
defaultLiveMode,
|
||||
|
@ -1,5 +1,4 @@
|
||||
import { IconName } from "@/components/icons/IconPicker";
|
||||
import { LivePlayerMode } from "./live";
|
||||
|
||||
export interface UiConfig {
|
||||
timezone?: string;
|
||||
@ -7,8 +6,6 @@ export interface UiConfig {
|
||||
date_style?: "full" | "long" | "medium" | "short";
|
||||
time_style?: "full" | "long" | "medium" | "short";
|
||||
strftime_fmt?: string;
|
||||
live_mode?: LivePlayerMode;
|
||||
use_experimental?: boolean;
|
||||
dashboard: boolean;
|
||||
order: number;
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ import {
|
||||
FaFire,
|
||||
FaUps,
|
||||
} from "react-icons/fa";
|
||||
import { GiHummingbird } from "react-icons/gi";
|
||||
import { GiDeer, GiHummingbird } from "react-icons/gi";
|
||||
import { LuBox, LuLassoSelect } from "react-icons/lu";
|
||||
import * as LuIcons from "react-icons/lu";
|
||||
import { MdRecordVoiceOver } from "react-icons/md";
|
||||
@ -38,6 +38,8 @@ export function getIconForLabel(label: string, className?: string) {
|
||||
return <FaCarSide key={label} className={className} />;
|
||||
case "cat":
|
||||
return <FaCat key={label} className={className} />;
|
||||
case "deer":
|
||||
return <GiDeer key={label} className={className} />;
|
||||
case "animal":
|
||||
case "bark":
|
||||
case "dog":
|
||||
|
Loading…
Reference in New Issue
Block a user