- changed filter logic

This commit is contained in:
bklronin 2024-06-26 21:55:14 +02:00
parent d8e837963b
commit e4b52c1066

View File

@ -10,8 +10,13 @@ import mido
def match_device_name(input_name, output_list):
# Function to match device names flexibly
for device in output_list:
if any(substring in device for substring in input_name.split()):
if input_name == device:
return device
#If name differs
elif any(substring in device for substring in input_name.split()):
return device
return None
@ -45,6 +50,7 @@ def determine_host(devices_in: list) -> str:
finally:
# Ensure all ports are closed, important to not get a stuck script without errors
for port in inports:
print("Inport closing", port)
port.close()
print("Closed all input ports.")
if master:
@ -133,8 +139,6 @@ def main_run():
if matching_output_device:
devices_out.remove(matching_output_device)
print(devices_out)
#time.sleep(3)
if midi_host_in:
relay_midi_host_to_out(midi_host_in, devices_out)