mirror of
https://gitlab.com/openlp/openlp_api_tester.git
synced 2024-12-22 04:22:48 +00:00
Cleanup and add defaults
This commit is contained in:
parent
87a05a947c
commit
2a897edb10
@ -1,3 +1,6 @@
|
||||
python3-colorama==0.4.3
|
||||
websocket-client==0.57.0
|
||||
|
||||
websocket-client~=1.2.3
|
||||
zeroconf~=0.36.9
|
||||
colorama~=0.4.4
|
||||
PyYAML~=3.13
|
||||
requests~=2.27.0
|
@ -69,7 +69,7 @@ class RunTestsController(object):
|
||||
if not conn_timeout:
|
||||
print_error("Could not connect to WS! Exiting.")
|
||||
|
||||
def on_message(self, message: str) -> None:
|
||||
def on_message(self, ws_obj: object, message: str) -> None:
|
||||
if self.debug:
|
||||
print_debug(f"Message returned: {message}")
|
||||
if not self.received:
|
||||
@ -78,15 +78,15 @@ class RunTestsController(object):
|
||||
self.ws_data.append(message)
|
||||
|
||||
@staticmethod
|
||||
def on_open() -> None:
|
||||
print_info("Socket Listener Opened")
|
||||
def on_open(ws_obj: object) -> None:
|
||||
print_info(f"Socket Listener Opened")
|
||||
|
||||
@staticmethod
|
||||
def on_close() -> None:
|
||||
print_info("Socket Listener Closed")
|
||||
|
||||
@staticmethod
|
||||
def on_error(error: str) -> None:
|
||||
def on_error(ws_obj: object, error: str) -> None:
|
||||
print_error(f'WebSocket Error: {error}')
|
||||
|
||||
def load_and_check_sockets(self, first_run: bool = False) -> bool:
|
||||
@ -117,8 +117,9 @@ class RunTestsController(object):
|
||||
parser.add_argument('rargs', nargs='*', default=[])
|
||||
a = parser.parse_args()
|
||||
f_open = f'{a.rargs[0]}'
|
||||
print(f_open)
|
||||
with open(f_open, 'r') as file:
|
||||
commands = yaml.load(file, Loader=yaml.FullLoader)
|
||||
commands = yaml.load(file, Loader=yaml.SafeLoader)
|
||||
for step in commands:
|
||||
if step == 'process_name':
|
||||
print_info(f'Processing file {commands[step]}')
|
||||
|
@ -36,7 +36,7 @@ def check_for_openlp(type: str) -> str:
|
||||
|
||||
def add_service(self, zeroconf: Zeroconf, type: str, name: str):
|
||||
info = zeroconf.get_service_info(type, name)
|
||||
# print_info(f'Service {name} added, service info: {info}')
|
||||
print_info(f'Service {name} added, service info: {info}')
|
||||
if info.name.startswith("OpenLP"):
|
||||
print_info(f'Service {name} found')
|
||||
self.port = str(info.port)
|
||||
|
@ -31,11 +31,14 @@ def start() -> None:
|
||||
print_text('Check OpenLP is running')
|
||||
op_address, op_http_port = check_for_openlp('http')
|
||||
if not op_http_port:
|
||||
print_error('OpenLP is not running - aborting')
|
||||
return
|
||||
print_error('OpenLP is not found - defaulting to 4316')
|
||||
op_http_port = 4316
|
||||
else:
|
||||
print_ok(f'OpenLP is running on port (http) {op_http_port}')
|
||||
_, op_ws_port = check_for_openlp('ws')
|
||||
if not op_ws_port:
|
||||
print_error('OpenLP is not found - defaulting to 4317')
|
||||
op_ws_port = 4317
|
||||
print_ok(f'OpenLP is running network Address {op_address}')
|
||||
print_ok(f'OpenLP is running on port (ws) {op_ws_port}')
|
||||
rtc = RunTestsController(op_address, op_http_port, op_ws_port)
|
||||
|
Loading…
Reference in New Issue
Block a user