Skip to content

Commit 7e90215

Browse files
authored
add remote host connect support (#46)
1 parent 73202a8 commit 7e90215

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

pyvts/config.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
""" default configuration of pyvts """
2-
vts_api = {"version": "1.0", "name": "VTubeStudioPublicAPI", "port": 8001}
2+
vts_api = {
3+
"version": "1.0",
4+
"name": "VTubeStudioPublicAPI",
5+
"host": "localhost",
6+
"port": 8001,
7+
}
38

49
plugin_default = {
510
"developer": "genteki",

pyvts/vts.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ def __init__(
4545
vts_api_info: dict = config.vts_api,
4646
**kwargs
4747
) -> None:
48+
if "host" in vts_api_info:
49+
self.host = vts_api_info["host"]
50+
else:
51+
self.host = "localhost"
4852
self.port = vts_api_info["port"]
4953
self.websocket = None
5054
self.authentic_token = None
@@ -76,7 +80,7 @@ async def connect(self) -> None:
7680
"""Connect to VtubeStudio API server"""
7781
try:
7882
self.websocket = await websockets.connect(
79-
"ws://localhost:" + str(self.port)
83+
"ws://" + self.host + ":" + str(self.port)
8084
)
8185
self.__connection_status = 1
8286
except error.ConnectionError as e:

0 commit comments

Comments
 (0)