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