obs-test
This commit is contained in:
parent
a08ebd6002
commit
cbc87ca3c8
@ -50,20 +50,22 @@ async def handle_follow_list(follow_list_event, your_pubkey, obs):
|
|||||||
scene_name = "Escape From Tarkov" # Replace with the name of your scene
|
scene_name = "Escape From Tarkov" # Replace with the name of your scene
|
||||||
await toggle_source_group(obs, scene_name, source_group_name)
|
await toggle_source_group(obs, scene_name, source_group_name)
|
||||||
|
|
||||||
# Modify the toggle_source_group function to accept the scene name
|
|
||||||
async def toggle_source_group(obs, scene_name, source_group_name):
|
async def toggle_source_group(obs, scene_name, source_group_name):
|
||||||
# Enable the source group in the specified scene
|
# Get the list of scene items in the specified scene
|
||||||
obs_response_enable = obs.call(requests.SetSceneItemProperties(item=source_group_name, scene=scene_name, visible=True))
|
scene_items = obs.call(requests.GetSceneItemList(sceneName=scene_name))
|
||||||
print(f"Enable Response: {obs_response_enable}")
|
|
||||||
|
|
||||||
# Wait for a certain interval (e.g., 5 seconds)
|
# Find the source group item in the list
|
||||||
await asyncio.sleep(5)
|
source_group_item = next((item for item in scene_items.getSceneItems() if item["name"] == source_group_name), None)
|
||||||
|
|
||||||
# Disable the source group in the specified scene
|
|
||||||
obs_response_disable = obs.call(requests.SetSceneItemProperties(item=source_group_name, scene=scene_name, visible=False))
|
|
||||||
print(f"Disable Response: {obs_response_disable}")
|
|
||||||
|
|
||||||
|
if source_group_item:
|
||||||
|
# Enable or disable the visibility of the source group item
|
||||||
|
obs_response = obs.call(
|
||||||
|
requests.SetSceneItemProperties(item=source_group_item["name"], scene=scene_name, visible=not source_group_item["visible"])
|
||||||
|
)
|
||||||
|
print(f"Toggle Response: {obs_response}")
|
||||||
print(f"Toggled source group '{source_group_name}' in scene '{scene_name}'.")
|
print(f"Toggled source group '{source_group_name}' in scene '{scene_name}'.")
|
||||||
|
else:
|
||||||
|
print(f"Source group '{source_group_name}' not found in scene '{scene_name}'.")
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
config_path = 'config.json'
|
config_path = 'config.json'
|
||||||
|
Loading…
Reference in New Issue
Block a user