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 @@ - 