improve device name filtering

This commit is contained in:
pstruebi
2025-07-29 13:40:08 +02:00
parent cff06439d1
commit 7f09c9d334

View File

@@ -57,9 +57,6 @@ def save_stream_settings(settings: dict):
log.error('Unable to persist stream settings: %s', e)
# TODO: select this dynamically from pw-cli ls Node determine id
os.environ["PIPEWIRE_NODE"] = "88"
app = FastAPI()
# Allow CORS for frontend on localhost
@@ -247,7 +244,7 @@ async def scan_audio_devices():
devs = sd.query_devices()
inputs = [
{"id": idx, "name": d["name"]}
dict(d, id=idx)
for idx, d in enumerate(devs)
if d.get("max_input_channels", 0) > 0
]
@@ -268,7 +265,7 @@ async def startup_event():
async def list_audio_inputs():
"""Return available hardware audio input devices from cache (by name, for selection)."""
# Only expose name and id for frontend
return {"inputs": [{"name": d["name"], "id": d["id"]} for d in AUDIO_INPUT_DEVICES_CACHE]}
return {"inputs": AUDIO_INPUT_DEVICES_CACHE}
@app.post("/refresh_audio_inputs")