From 987e0264346fa2bf7ec04d52bdf9a070cb926de9 Mon Sep 17 00:00:00 2001 From: Benjamin Evans <51272212+dfgHiatus@users.noreply.github.com> Date: Sat, 28 Sep 2024 16:26:35 -0500 Subject: [PATCH] (tweak) Update README, fix misc_utils.py --- BabbleApp/utils/misc_utils.py | 20 ++++++++------------ README.md | 12 +++++++++--- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/BabbleApp/utils/misc_utils.py b/BabbleApp/utils/misc_utils.py index a69823b..214754d 100644 --- a/BabbleApp/utils/misc_utils.py +++ b/BabbleApp/utils/misc_utils.py @@ -6,12 +6,16 @@ import os import platform import cv2 import subprocess -from pygrabber.dshow_graph import FilterGraph - -is_nt = True if sys.platform.startswith('win') else False -graph = FilterGraph() +# Detect the operating system +is_nt = os.name == "nt" +os_type = platform.system() +if is_nt: + from pygrabber.dshow_graph import FilterGraph + graph = FilterGraph() + + def list_camera_names(): cam_list = graph.get_input_devices() cam_names = [] @@ -20,14 +24,6 @@ def list_camera_names(): cam_names = cam_names + list_serial_ports() return cam_names -# Detect the operating system -is_nt = True if os.name == "nt" else False -os_type = platform.system() - -if is_nt: - from pygrabber.dshow_graph import FilterGraph - graph = FilterGraph() - def list_cameras_opencv(): """ Use OpenCV to check available cameras by index (fallback for Linux/macOS) """ diff --git a/README.md b/README.md index cf46e79..072aedb 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,3 @@ - 