From 66a06617c61035b92720ea4dd4ea3e5a61b4e5b8 Mon Sep 17 00:00:00 2001 From: onyx-and-iris <75868496+onyx-and-iris@users.noreply.github.com> Date: Wed, 31 Aug 2022 20:13:44 +0100 Subject: [PATCH] add readmes to examples. --- examples/events/README.md | 16 ++++++++++++++++ examples/hotkeys/README.md | 20 ++++++++++++++++++++ examples/scene_rotate/README.md | 14 ++++++++++++++ examples/scene_rotate/__main__.py | 6 +++--- 4 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 examples/events/README.md create mode 100644 examples/hotkeys/README.md create mode 100644 examples/scene_rotate/README.md diff --git a/examples/events/README.md b/examples/events/README.md new file mode 100644 index 0000000..ce1b83a --- /dev/null +++ b/examples/events/README.md @@ -0,0 +1,16 @@ +## About + +Registers a list of callback functions to hook into OBS events. + +## Use + +Simply run the code and trigger the events, press `` to exit. + +This example assumes the existence of a `config.toml`, placed next to `__main__.py`: + +```toml +[connection] +host = "localhost" +port = 4455 +password = "mystrongpass" +``` diff --git a/examples/hotkeys/README.md b/examples/hotkeys/README.md new file mode 100644 index 0000000..f800d8b --- /dev/null +++ b/examples/hotkeys/README.md @@ -0,0 +1,20 @@ +## About + +Sets up some hotkeys to trigger certain actions. Registers a callback function to notify of scene switch event. + +Requires [Python Keyboard library](https://github.com/boppreh/keyboard). + +## Use + +Simply run the code and press the assigned hotkeys. Press `ctrl+enter` to exit. + +This example assumes the existence of a `config.toml`, placed next to `__main__.py`: + +```toml +[connection] +host = "localhost" +port = 4455 +password = "mystrongpass" +``` + +It also assumes the existence of scenes named `START`, `BRB` and `END`. diff --git a/examples/scene_rotate/README.md b/examples/scene_rotate/README.md new file mode 100644 index 0000000..07ff2d6 --- /dev/null +++ b/examples/scene_rotate/README.md @@ -0,0 +1,14 @@ +## About + +Collects the names of all available scenes, rotates through them and prints their name. + +## Use + +This example assumes the existence of a `config.toml`, placed next to `__main__.py`: + +```toml +[connection] +host = "localhost" +port = 4455 +password = "mystrongpass" +``` diff --git a/examples/scene_rotate/__main__.py b/examples/scene_rotate/__main__.py index 2454690..d66087e 100644 --- a/examples/scene_rotate/__main__.py +++ b/examples/scene_rotate/__main__.py @@ -7,9 +7,9 @@ def main(): resp = cl.get_scene_list() scenes = reversed(tuple(di.get("sceneName") for di in resp.scenes)) - for sc in scenes: - print(f"Switching to scene {sc}") - cl.set_current_program_scene(sc) + for scene in scenes: + print(f"Switching to scene {scene}") + cl.set_current_program_scene(scene) time.sleep(0.5)