From 494324fd8f82ecc1e53fce69ef7fbf4af8aeea5e Mon Sep 17 00:00:00 2001 From: misyaguziya Date: Sat, 30 Sep 2023 22:41:52 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B[bugfix]=20Model:=20Mic=E3=82=82?= =?UTF-8?q?=E3=81=97=E3=81=8F=E3=81=AFSpeaker=E3=81=8C=E4=B8=80=E3=81=A4?= =?UTF-8?q?=E3=82=82=E6=8E=A5=E7=B6=9A=E3=81=95=E3=82=8C=E3=81=A6=E3=81=84?= =?UTF-8?q?=E3=81=AA=E3=81=84=E7=8A=B6=E6=85=8B=E3=81=A7=E3=83=87=E3=83=90?= =?UTF-8?q?=E3=82=A4=E3=82=B9=E6=83=85=E5=A0=B1=E3=82=92=E5=8F=96=E5=BE=97?= =?UTF-8?q?=E3=81=97=E3=81=9F=E5=A0=B4=E5=90=88=E3=81=ABNone=E3=81=AB?= =?UTF-8?q?=E3=81=AA=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/transcription/transcription_utils.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/models/transcription/transcription_utils.py b/models/transcription/transcription_utils.py index 4c72a8fa..522cb7a2 100644 --- a/models/transcription/transcription_utils.py +++ b/models/transcription/transcription_utils.py @@ -12,6 +12,8 @@ def getInputDevices(): devices[host["name"]].append(device) else: devices[host["name"]] = [device] + if len(devices) == 0: + devices = {"None": [{"name": "None"}]} return devices def getOutputDevices(): @@ -21,6 +23,8 @@ def getOutputDevices(): for device in p.get_loopback_device_info_generator(): if device["hostApi"] == wasapi_info["index"] and device["isLoopbackDevice"] is True: devices.append(device) + if len(devices) == 0: + devices = [{'name':"None"}] return devices def getDefaultInputDevice(): @@ -33,7 +37,8 @@ def getDefaultInputDevice(): for device_index in range(0, p. get_host_api_info_by_index(host_index)['deviceCount']): device = p.get_device_info_by_host_api_device_index(host_index, device_index) if device["index"] == defaultInputDevice: - return {"host":host, "device": device} + return {"host": host, "device": device} + return {"host": {"name": "None"}, "device": {"name": "None"}} def getDefaultOutputDevice(): with PyAudio() as p: @@ -49,4 +54,5 @@ def getDefaultOutputDevice(): for loopback in p.get_loopback_device_info_generator(): if default_speakers["name"] in loopback["name"]: default_device = loopback - return default_device \ No newline at end of file + return default_device + return {"name":"None"} \ No newline at end of file