mirror of
https://github.com/onyx-and-iris/obsws-python.git
synced 2026-04-18 05:53:32 +00:00
update examples to work with modified req client
examples now expect env variables
This commit is contained in:
@@ -1,16 +1,21 @@
|
||||
import os
|
||||
import time
|
||||
|
||||
import obsws_python as obs
|
||||
|
||||
|
||||
def main():
|
||||
with obs.ReqClient() as client:
|
||||
host = os.getenv("OBSWS_HOST", "localhost")
|
||||
port = int(os.getenv("OBSWS_PORT", 4455))
|
||||
password = os.getenv("OBSWS_PASSWORD", "")
|
||||
|
||||
with obs.ReqClient(host=host, port=port, password=password) as client:
|
||||
resp = client.get_scene_list()
|
||||
scenes = [di.get("sceneName") for di in reversed(resp.scenes)]
|
||||
|
||||
for scene in scenes:
|
||||
print(f"Switching to scene {scene}")
|
||||
client.set_current_program_scene(scene)
|
||||
client.set_current_program_scene(scene_name=scene)
|
||||
time.sleep(0.5)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user