From e94b99da6549dfaec0e60018bbf09cb6227e2f2f Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Sun, 20 Feb 2022 04:16:34 +0100 Subject: [PATCH] SNIClient: make address optional for multi-snes --- SNIClient.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/SNIClient.py b/SNIClient.py index 24438138..2fd9bd03 100644 --- a/SNIClient.py +++ b/SNIClient.py @@ -56,7 +56,8 @@ class LttPCommandProcessor(ClientCommandProcessor): @mark_raw def _cmd_snes(self, snes_options: str = "") -> bool: """Connect to a snes. Optionally include network address of a snes to connect to, - otherwise show available devices; and a SNES device number if more than one SNES is detected""" + otherwise show available devices; and a SNES device number if more than one SNES is detected. + Examples: "/snes", "/snes 1", "/snes localhost:8080 1" """ snes_address = self.ctx.snes_address snes_device_number = -1 @@ -65,13 +66,12 @@ class LttPCommandProcessor(ClientCommandProcessor): num_options = len(options) if num_options > 0: - snes_address = options[0] + snes_device_number = int(options[0]) if num_options > 1: - try: - snes_device_number = int(options[1]) - except: - pass + snes_address = options[0] + snes_device_number = int(options[1]) + self.ctx.snes_reconnect_address = None asyncio.create_task(snes_connect(self.ctx, snes_address, snes_device_number), name="SNES Connect")