Files
fluidcontrol/fluidcontrol/controller.py
T

25 lines
612 B
Python
Raw Normal View History

2019-12-24 15:02:08 -05:00
from telnetlib import Telnet
class Controller(object):
timeout = 30
def connect(self, host: str = "0.0.0.0", port: int = 5800):
self.connection = Telnet(host=host, port=port, timeout=Controller.timeout)
def execute(self, command: str):
self.connection.write(command.encode("ascii") + b"\r\n")
output = self.connection.read_until(b"END OF IT", timeout=2)
return output.decode("ascii")
def get_soundfonts(self):
self.execute("fonts")
return {}
def get_instruments(self, font: int):
self.execute(f"inst {font}")
return {}