mirror of
https://github.com/onyx-and-iris/voicemeeter-api-python.git
synced 2024-11-15 16:40:46 +00:00
obs example updated for websocket v5
setup.py added to obs example readme for obs example updated
This commit is contained in:
parent
9d446ea17d
commit
bc370b4b32
7
.gitignore
vendored
7
.gitignore
vendored
@ -1,6 +1,3 @@
|
|||||||
# quick test
|
|
||||||
quick.py
|
|
||||||
|
|
||||||
# Byte-compiled / optimized / DLL files
|
# Byte-compiled / optimized / DLL files
|
||||||
__pycache__/
|
__pycache__/
|
||||||
*.py[cod]
|
*.py[cod]
|
||||||
@ -130,3 +127,7 @@ dmypy.json
|
|||||||
|
|
||||||
# Pyre type checker
|
# Pyre type checker
|
||||||
.pyre/
|
.pyre/
|
||||||
|
|
||||||
|
# test/config
|
||||||
|
quick.py
|
||||||
|
config.toml
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
- [OBS Studio](https://obsproject.com/)
|
- [OBS Studio](https://obsproject.com/)
|
||||||
- [OBS Websocket Plugin](https://obsproject.com/forum/resources/obs-websocket-remote-control-obs-studio-from-websockets.466/)
|
- [OBS Websocket v5 Plugin](https://github.com/obsproject/obs-websocket/releases/tag/5.0.0)
|
||||||
- [OBS Websocket Py](https://github.com/onyx-and-iris/obs-websocket-py)
|
- [OBS Python SDK for Websocket v5](https://github.com/onyx-and-iris/obs-websocket-py)
|
||||||
|
|
||||||
## About
|
## About
|
||||||
|
|
||||||
A simple demonstration showing how to sync OBS scene switches to Voicemeeter states. The script assumes you have connection info saved in
|
A simple demonstration showing how to sync OBS scene switches to Voicemeeter states. The script assumes you have connection info saved in
|
||||||
a config file named `config.ini` placed next to `__main__.py`. It also assumes you have scenes named `START` `BRB` `END` and `LIVE`.
|
a config file named `config.toml` placed next to `__main__.py`. It also assumes you have scenes named `START` `BRB` `END` and `LIVE`.
|
||||||
|
|
||||||
A valid `config.ini` file might look like this:
|
A valid `config.toml` file might look like this:
|
||||||
|
|
||||||
```ini
|
```toml
|
||||||
[connection]
|
[connection]
|
||||||
ip=localhost
|
host = "localhost"
|
||||||
port=4444
|
port = 4455
|
||||||
password=mystrongpassword
|
password = "mystrongpass"
|
||||||
```
|
```
|
||||||
|
@ -1,13 +1,6 @@
|
|||||||
import logging
|
import obsstudio_sdk as obs
|
||||||
import sys
|
|
||||||
|
|
||||||
import voicemeeterlib
|
import voicemeeterlib
|
||||||
|
|
||||||
logging.basicConfig(level=logging.INFO)
|
|
||||||
|
|
||||||
sys.path.append("../")
|
|
||||||
from obswebsocket import events, obsws
|
|
||||||
|
|
||||||
|
|
||||||
def on_start():
|
def on_start():
|
||||||
vm.strip[0].mute = True
|
vm.strip[0].mute = True
|
||||||
@ -38,8 +31,8 @@ def on_live():
|
|||||||
vm.vban.instream[0].on = True
|
vm.vban.instream[0].on = True
|
||||||
|
|
||||||
|
|
||||||
def on_switch(message):
|
def on_current_program_scene_changed(data):
|
||||||
scene = message.getSceneName()
|
scene = data.scene_name
|
||||||
print(f"Switched to scene {scene}")
|
print(f"Switched to scene {scene}")
|
||||||
|
|
||||||
match scene:
|
match scene:
|
||||||
@ -55,10 +48,11 @@ def on_switch(message):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
with voicemeeterlib.api("potato") as vm:
|
if __name__ == "__main__":
|
||||||
with obsws() as ws:
|
with voicemeeterlib.api("potato") as vm:
|
||||||
ws.register(on_switch, events.SwitchScenes)
|
cl = obs.EventClient()
|
||||||
|
cl.callback.register(on_current_program_scene_changed)
|
||||||
|
|
||||||
while cmd := input("Press <Enter> to exit\n"):
|
while cmd := input("<Enter> to exit\n"):
|
||||||
if not cmd:
|
if not cmd:
|
||||||
break
|
break
|
||||||
|
7
examples/obs/setup.py
Normal file
7
examples/obs/setup.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
from setuptools import setup
|
||||||
|
|
||||||
|
setup(
|
||||||
|
name="obs",
|
||||||
|
description="OBS Example",
|
||||||
|
install_requires=["voicemeeter-api", "obsstudio-sdk"],
|
||||||
|
)
|
Loading…
Reference in New Issue
Block a user