aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEddy Pedroni <eddy@0xf7.com>2022-01-07 18:27:05 +0100
committerEddy Pedroni <eddy@0xf7.com>2022-01-07 18:27:05 +0100
commitfe49a419d836f514c756be5211558de9b8859511 (patch)
tree724ac18d609d4ccbc89b6215d776d53ef9f9e4b0
parent192100c0590dfbe2db498b356fbd1e1e19eace2c (diff)
Added main function to CLI, fixed CLI test mocks
-rw-r--r--solo_tool_cli.py16
-rw-r--r--solo_tool_cli_integrationtest.py4
2 files changed, 17 insertions, 3 deletions
diff --git a/solo_tool_cli.py b/solo_tool_cli.py
index b6e7817..8d53a33 100644
--- a/solo_tool_cli.py
+++ b/solo_tool_cli.py
@@ -1,3 +1,5 @@
+import sys
+
from solo_tool import SoloTool
from midi_controller_launchpad_mini import MidiController
@@ -5,7 +7,7 @@ class SoloToolCLI:
def __init__(self, sessionJson, soloToolOverride=None, midiOverride=None):
self._soloTool = SoloTool() if soloToolOverride is None else soloToolOverride
self._soloTool.loadSession(sessionJson)
- self._midiController = MidiController() if midiOverride is None else midiOverride
+ self._midiController = MidiController(self._soloTool) if midiOverride is None else midiOverride
self._commands = {
"song" : self._song,
"midi" : self._midi
@@ -32,3 +34,15 @@ class SoloToolCLI:
else:
print("Supported device: Novation Launchpad Mini MkII")
+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:])
diff --git a/solo_tool_cli_integrationtest.py b/solo_tool_cli_integrationtest.py
index ae007a3..9134dcf 100644
--- a/solo_tool_cli_integrationtest.py
+++ b/solo_tool_cli_integrationtest.py
@@ -7,7 +7,7 @@ from solo_tool import SoloTool
from player_mock import Player
class MockMidiController:
- def __init__(self):
+ def __init__(self, soloTool):
self.connected = False
def connect(self):
@@ -23,7 +23,7 @@ def soloTool(mockPlayer):
@pytest.fixture
def mockMidi(soloTool):
- return MockMidiController()
+ return MockMidiController(soloTool)
@pytest.fixture
def uut(soloTool, mockMidi):