Skip to content

Commit 057d5c0

Browse files
authored
Fix import problem (#34)
Fix import problem. Thanks Luck finding out the problem,
1 parent b0050a0 commit 057d5c0

File tree

9 files changed

+94
-27
lines changed

9 files changed

+94
-27
lines changed

README.md

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,23 +39,6 @@ if __name__ == "__main__":
3939
asyncio.run(main())
4040
```
4141

42-
Example of a call animation by emulating pressing HotKeys
43-
```
44-
async def main():
45-
vts = pyvts.vts(plugin_info=plugin_info)
46-
await vts.connect()
47-
await vts.request_authenticate_token() # get token
48-
await vts.request_authenticate() # use token
49-
b = await vts.request(vts.vts_request.requestHotKeyList())
50-
hotKeyList = [hotKey['name'] for hotKey in b['data']['availableHotkeys']]
51-
print(hotKeyList) # ['My Animation 1', 'My Animation 2', 'My Animation 3']
52-
await vts.request(vts.vts_request.requestTriggerHotKey(hotKeyList[0])) # send request to play 'My Animation 1'
53-
54-
if __name__ == "__main__":
55-
asyncio.run(main())
56-
```
57-
58-
5942
### Demo
6043

6144
Demo [examples/start.py](./examples/start.py) is a good startpoint to make plugin for VTubeStudio.

docs/toctree2_tutorial.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
11
# Tutorial
22

33
```{include} tutorial1_basicusage.md
4-
```
4+
:heading-offset: 1
5+
```
6+
7+
```{include} tutorial2_triggerhotkey.md
8+
:heading-offset: 1
9+
```
10+
11+
<!-- ```{toctree}
12+
:hidden: true
13+
:maxdepth: 2
14+
15+
tutorial1_basicusage.md
16+
tutorial2_triggerhotkey.md
17+
``` -->

docs/tutorial1_basicusage.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Basic Usage
1+
# Basic Usage
22

33
First import packages
44

docs/tutorial2_triggerhotkey.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Trigger Hotkey
2+
3+
First import packages
4+
5+
```
6+
import asyncio, pyvts
7+
```
8+
9+
Then specify the plugin information and creat `vts` instance in `main`.
10+
11+
```
12+
plugin_info = {
13+
"plugin_name": "trigger hotkey",
14+
"developer": "OverHome",
15+
"authentication_token_path": "./pyvts_token.txt"
16+
}
17+
18+
async def main():
19+
myvts = pyvts.vts(plugin_info=plugin_info)
20+
await myvts.connect()
21+
await myvts.request_authenticate_token() # get token
22+
await myvts.request_authenticate() # use token
23+
```
24+
25+
Contd. with ``main()``, request list of hotkey from VtubeStudio
26+
27+
```
28+
response_data = await myvts.request(myvts.vts_request.requestHotKeyList())
29+
hotkey_list = []
30+
for hotkey in response_data['data']['availableHotkeys']:
31+
hotkey_list.append(hotkey['name'])
32+
print(hotkey_list) # ['My Animation 1', 'My Animation 2', ...]
33+
```
34+
35+
Contd. with ``main``, send request to triiger hotkey
36+
37+
```
38+
send_hotkey_request = myvts.vts_request.requestTriggerHotKey(hotkey_list[0])
39+
await myvts.request(send_hotkey_request) # send request to play 'My Animation 1'
40+
await myvts.close()
41+
42+
if __name__ == "__main__":
43+
asyncio.run(main())
44+
```

examples/trigger_hotkey.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import asyncio, pyvts
2+
3+
plugin_info = {
4+
"plugin_name": "trigger hotkey",
5+
"developer": "OverHome",
6+
"authentication_token_path": "./pyvts_token.txt",
7+
}
8+
9+
10+
async def main():
11+
myvts = pyvts.vts(plugin_info=plugin_info)
12+
await myvts.connect()
13+
await myvts.request_authenticate_token() # get token
14+
await myvts.request_authenticate() # use token
15+
16+
response_data = await myvts.request(myvts.vts_request.requestHotKeyList())
17+
hotkey_list = []
18+
for hotkey in response_data["data"]["availableHotkeys"]:
19+
hotkey_list.append(hotkey["name"])
20+
print(hotkey_list) # ['My Animation 1', 'My Animation 2', ...]
21+
22+
send_hotkey_request = myvts.vts_request.requestTriggerHotKey(hotkey_list[0])
23+
await myvts.request(send_hotkey_request) # send request to play 'My Animation 1'
24+
await myvts.close()
25+
26+
27+
if __name__ == "__main__":
28+
asyncio.run(main())

pyvts/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
"""
66

7-
__version__ = "0.2.3"
7+
__version__ = "0.3.0"
88
__all__ = ["vts", "vts_request", "config", "error"]
99

1010
from .vts import vts

pyvts/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
"plugin_name": "pyvts",
66
"developer": "genteki",
77
"icon": None,
8-
"authentication_token_path": "./token.txt",
8+
"authentication_token_path": "./pyvts_token.txt",
99
}

pyvts/vts_request.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,7 @@ def requestTriggerHotKey(self, hotkeyID, itemInstanceID=None) -> dict:
164164
Organized message sending to ``Vtubestudio API``
165165
"""
166166
msg_type = "HotkeyTriggerRequest"
167-
data = {
168-
"hotkeyID": hotkeyID
169-
}
167+
data = {"hotkeyID": hotkeyID}
170168
return self.BaseRequest(msg_type, data)
171169

172170
def requestTrackingParameterList(self) -> dict:

setup.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from setuptools import setup, find_packages
44

55
DESCRIPTION = "A python library for interacting with the VTube Studio API"
6-
VERSION = "v0.2.3"
6+
VERSION = "v0.3.0"
77

88
setup(
99
name="pyvts",
@@ -23,11 +23,12 @@
2323
"Programming Language :: Python :: 3.8",
2424
"Programming Language :: Python :: 3.9",
2525
"Programming Language :: Python :: 3.10",
26+
"Programming Language :: Python :: 3.11"
2627
],
2728
author="Genteki Zhang",
2829
author_email="zhangkaiyuan.null@gmail.com",
2930
url="https://github.com/Genteki/pyvts",
3031
license="MIT",
31-
packages=find_packages(where="pyvts", exclude=["tests.*", "tests"]),
32-
install_requires=["websockets", "aiofile"],
32+
packages=find_packages(exclude=["tests.*", "tests"]),
33+
install_requires=["websockets", "aiofiles"],
3334
)

0 commit comments

Comments
 (0)