From d64633889bf363b2c383c069a9b3576e9cd030d3 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Mon, 27 May 2024 20:27:01 -0600 Subject: [PATCH] Fixes (#11575) * Fix settings icon * Handle out of resources --- frigate/output/preview.py | 25 +- web/src/components/menu/GeneralSettings.tsx | 449 ++++++++++---------- 2 files changed, 244 insertions(+), 230 deletions(-) diff --git a/frigate/output/preview.py b/frigate/output/preview.py index 1669012d6..c64591b6e 100644 --- a/frigate/output/preview.py +++ b/frigate/output/preview.py @@ -5,6 +5,7 @@ import logging import os import subprocess as sp import threading +import time from pathlib import Path import cv2 @@ -101,12 +102,24 @@ class FFMpegConverter(threading.Thread): f"duration {self.frame_times[t_idx + 1] - self.frame_times[t_idx]}" ) - p = sp.run( - self.ffmpeg_cmd.split(" "), - input="\n".join(playlist), - encoding="ascii", - capture_output=True, - ) + try: + p = sp.run( + self.ffmpeg_cmd.split(" "), + input="\n".join(playlist), + encoding="ascii", + capture_output=True, + ) + except BlockingIOError: + logger.warning( + f"Failed to create preview for {self.config.name}, retrying..." + ) + time.sleep(2) + p = sp.run( + self.ffmpeg_cmd.split(" "), + input="\n".join(playlist), + encoding="ascii", + capture_output=True, + ) start = self.frame_times[0] end = self.frame_times[-1] diff --git a/web/src/components/menu/GeneralSettings.tsx b/web/src/components/menu/GeneralSettings.tsx index 56c0dd47c..cd0ce1749 100644 --- a/web/src/components/menu/GeneralSettings.tsx +++ b/web/src/components/menu/GeneralSettings.tsx @@ -66,6 +66,7 @@ import { DialogTrigger, } from "../ui/dialog"; import { TooltipPortal } from "@radix-ui/react-tooltip"; +import { cn } from "@/lib/utils"; type GeneralSettingsProps = { className?: string; @@ -113,249 +114,249 @@ export default function GeneralSettings({ className }: GeneralSettingsProps) { return ( <> -
- - - - -
- -
-
- - -

Settings

-
-
-
-
- -
- System - - - - - - System metrics - - - - - - System logs - - - - - Configuration - - - - - - - Settings - - - - - - Configuration editor - - - - Appearance - - - - - - Dark Mode - - - - - setTheme("light")} - > - {theme === "light" ? ( - <> - - Light - - ) : ( - Light - )} - - setTheme("dark")} - > - {theme === "dark" ? ( - <> - - Dark - - ) : ( - Dark - )} - - setTheme("system")} - > - {theme === "system" ? ( - <> - - System - - ) : ( - System - )} - - - - - - - - Theme - - - - - {colorSchemes.map((scheme) => ( - setColorScheme(scheme)} - > - {scheme === colorScheme ? ( - <> - - {friendlyColorSchemeName(scheme)} - - ) : ( - - {friendlyColorSchemeName(scheme)} - - )} - - ))} - - - - - - Help - - - + + + + +
+ +
+
+ + +

Settings

+
+
+
+
+ +
+ System + + + + + System metrics + + + + + + System logs + + + + + Configuration + + + + + + + Settings + + + + + + Configuration editor + + + + Appearance + + + + - - Documentation - - - - + Dark Mode + + + + + setTheme("light")} + > + {theme === "light" ? ( + <> + + Light + + ) : ( + Light + )} + + setTheme("dark")} + > + {theme === "dark" ? ( + <> + + Dark + + ) : ( + Dark + )} + + setTheme("system")} + > + {theme === "system" ? ( + <> + + System + + ) : ( + System + )} + + + + + + - - GitHub - - - + + Theme + + + + + {colorSchemes.map((scheme) => ( + setColorScheme(scheme)} + > + {scheme === colorScheme ? ( + <> + + {friendlyColorSchemeName(scheme)} + + ) : ( + + {friendlyColorSchemeName(scheme)} + + )} + + ))} + + + + + + Help + + + setRestartDialogOpen(true)} > - - Restart Frigate + + Documentation -
- - -
+ + + + + GitHub + + + + setRestartDialogOpen(true)} + > + + Restart Frigate + +
+ + {restartDialogOpen && (