diff options
author | Eddy Pedroni <epedroni@pm.me> | 2024-11-09 20:35:56 +0100 |
---|---|---|
committer | Eddy Pedroni <epedroni@pm.me> | 2024-11-09 20:35:56 +0100 |
commit | cda8197669409689be291660f93cb288ab2d31b3 (patch) | |
tree | 81db9b0c7c0491e0737cbffb39af6b935c0dfeb8 /solo_tool_cli.py | |
parent | a2257a900d4fffd6f94b73f1c48c62370ed1d684 (diff) |
Migrate to project-based structure
Diffstat (limited to 'solo_tool_cli.py')
-rw-r--r-- | solo_tool_cli.py | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/solo_tool_cli.py b/solo_tool_cli.py deleted file mode 100644 index 43e3a9d..0000000 --- a/solo_tool_cli.py +++ /dev/null @@ -1,56 +0,0 @@ -import sys -import time -import threading - -from solo_tool import SoloTool -from midi_controller_launchpad_mini import MidiController - -class SoloToolCLI: - def __init__(self, sessionJson, soloToolOverride=None, midiOverride=None, tickEnable=True): - self._soloTool = SoloTool() if soloToolOverride is None else soloToolOverride - self._soloTool.loadSession(sessionJson) - self._midiController = MidiController(self._soloTool) if midiOverride is None else midiOverride - self._commands = { - "song" : self._song, - "midi" : self._midi - } - if tickEnable: - self._tick() - - def input(self, commandString): - split = commandString.strip().split(" ") - if split[0] in self._commands: - self._commands[split[0]](split[1:]) - - def _song(self, args): - if len(args) > 0: - self._soloTool.setSong(int(args[0])) - else: - songs = self._soloTool.getSongs() - print("Songs:") - for i, s in enumerate(songs): - print(f" {i} {s}") - - def _midi(self, args): - if len(args) > 0 and args[0] == "connect": - print("Connecting to MIDI device...") - self._midiController.connect() - else: - print("Supported device: Novation Launchpad Mini MkII") - - def _tick(self): - self._soloTool.tick() - threading.Timer(0.1, self._tick).start() - -def main(args): - if len(args) == 0: - print("Please provide path to session file") - sys.exit(1) - - soloToolCli = SoloToolCLI(args[0]) - while(True): - commandString = input("> ") - soloToolCli.input(commandString) - -if __name__ == '__main__': - main(sys.argv[1:]) |