From 6d26f377cc26281b4e72d3bd72e403a3f92d897c Mon Sep 17 00:00:00 2001 From: Isaak <43730681+I5UCC@users.noreply.github.com> Date: Thu, 17 Aug 2023 18:52:35 +0200 Subject: [PATCH] don't use OSCQuery if you use port 9001 --- src/osc.py | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/osc.py b/src/osc.py index 960f5a3..ea8ad5d 100644 --- a/src/osc.py +++ b/src/osc.py @@ -375,10 +375,11 @@ def osc_start_server(self): try: self.osc_server_test_step = 1 - if self.osc_server_port == 9001 or self.osc_server_port <= 0 or not check_if_udp_port_open(self.osc_server_port): - self.osc_server_port = get_open_udp_port() - if self.http_port <= 0 or not check_if_tcp_port_open(self.http_port): - self.http_port = self.osc_server_port if check_if_tcp_port_open(self.osc_server_port) else get_open_tcp_port() + if self.osc_server_port != 9001: + if self.osc_server_port <= 0 or not check_if_udp_port_open(self.osc_server_port): + self.osc_server_port = get_open_udp_port() + if self.http_port <= 0 or not check_if_tcp_port_open(self.http_port): + self.http_port = self.osc_server_port if check_if_tcp_port_open(self.osc_server_port) else get_open_tcp_port() self.osc_dispatcher = dispatcher.Dispatcher() self.osc_dispatcher.map(self.osc_parameter_prefix + self.param_sync + "*", self.osc_server_handler_char) @@ -391,14 +392,15 @@ def osc_start_server(self): self.osc_server = osc_server.ThreadingOSCUDPServer((self.osc_server_ip, self.osc_server_port), self.osc_dispatcher, asyncio.get_event_loop()) threading.Thread(target = self.osc_server_serve, daemon = True).start() - self.oscqs = OSCQueryService("TextboxSTT", self.http_port, self.osc_server_port) - for i in range(self.sync_params_max): - self.oscqs.advertise_endpoint(self.osc_parameter_prefix + self.param_sync + str(i), access="readwrite") - self.oscqs.advertise_endpoint(self.osc_avatar_change_path, access="readwrite") - self.oscqs.advertise_endpoint(self.osc_use_kat_path, access="readwrite") - self.oscqs.advertise_endpoint(self.osc_use_textbox_path, access="readwrite") - self.oscqs.advertise_endpoint(self.osc_use_both_path, access="readwrite") - self.oscqs.advertise_endpoint(self.osc_stt_mode_path, access="readwrite") + if self.osc_server_port != 9001: + self.oscqs = OSCQueryService("TextboxSTT", self.http_port, self.osc_server_port) + for i in range(self.sync_params_max): + self.oscqs.advertise_endpoint(self.osc_parameter_prefix + self.param_sync + str(i), access="readwrite") + self.oscqs.advertise_endpoint(self.osc_avatar_change_path, access="readwrite") + self.oscqs.advertise_endpoint(self.osc_use_kat_path, access="readwrite") + self.oscqs.advertise_endpoint(self.osc_use_textbox_path, access="readwrite") + self.oscqs.advertise_endpoint(self.osc_use_both_path, access="readwrite") + self.oscqs.advertise_endpoint(self.osc_stt_mode_path, access="readwrite") except: self.osc_enable_server = False self.osc_server_test_step = 0