Add/update one to many links for link-virtual-mic
This commit is contained in:
parent
5f468b232b
commit
09edab32fa
@ -4,13 +4,14 @@ import subprocess
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
mappingMic = {
|
mappingMic = {
|
||||||
"output\\.rnnoise_source:capture_1": "mixed-mic:input_FL",
|
# "output\\.rnnoise_source:capture_1": ["mixed-mic:input_FL"],
|
||||||
"output\\.rnnoise_source:capture_2": "mixed-mic:input_FR"
|
# "output\\.rnnoise_source:capture_2": ["mixed-mic:input_FR"]
|
||||||
|
"rnnoise_source:capture_1": ["mixed-mic:input_FL", "mixed-mic:input_FR"],
|
||||||
}
|
}
|
||||||
|
|
||||||
mappingLoopback = {
|
mappingLoopback = {
|
||||||
"loopback:monitor_FL": "mixed-mic:input_FL",
|
"loopback:monitor_FL": ["mixed-mic:input_FL"],
|
||||||
"loopback:monitor_FR": "mixed-mic:input_FR"
|
"loopback:monitor_FR": ["mixed-mic:input_FR"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -49,18 +50,21 @@ def main():
|
|||||||
|
|
||||||
|
|
||||||
def manageLinks(mapping, disconnect=False):
|
def manageLinks(mapping, disconnect=False):
|
||||||
for key, value in mapping.items():
|
for iter_out, iter_inputs in mapping.items():
|
||||||
cmdOpts = {"shell": True, "capture_output": True, "text": True}
|
cmdOpts = {"shell": True, "capture_output": True, "text": True}
|
||||||
|
|
||||||
cmd = "pw-link -o | grep -e '{}'".format(key)
|
cmd = "pw-link -o | grep -e '{}'".format(iter_out)
|
||||||
completedProcess = subprocess.run(cmd, **cmdOpts)
|
completedProcess = subprocess.run(cmd, **cmdOpts)
|
||||||
if completedProcess.returncode == 1:
|
if completedProcess.returncode == 1:
|
||||||
|
print(f"Output `{iter_out}` not found")
|
||||||
return False
|
return False
|
||||||
output = completedProcess.stdout.split('\n')[0]
|
output = completedProcess.stdout.split('\n')[0]
|
||||||
|
|
||||||
cmd = "pw-link -i | grep -e '{}'".format(value)
|
for iter_input in iter_inputs:
|
||||||
|
cmd = "pw-link -i | grep -e '{}'".format(iter_input)
|
||||||
completedProcess = subprocess.run(cmd, **cmdOpts)
|
completedProcess = subprocess.run(cmd, **cmdOpts)
|
||||||
if completedProcess.returncode == 1:
|
if completedProcess.returncode == 1:
|
||||||
|
print(f"Output `{iter_input}` not found")
|
||||||
return False
|
return False
|
||||||
input = completedProcess.stdout.split('\n')[0]
|
input = completedProcess.stdout.split('\n')[0]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user