add ruff config

run files through formatter

add dosctrings to satisfy the linter
This commit is contained in:
2025-06-12 20:34:14 +01:00
parent fecd13d345
commit 582587bed5
21 changed files with 356 additions and 211 deletions

View File

@@ -1,3 +1,10 @@
"""Remove test scenes in Streamlabs, disable streaming, recording, and replay buffer.
Usage:
Run this script as a standalone program to tear down the test environment.
Requires 'SLOBS_DOMAIN' and 'SLOBS_TOKEN' environment variables to be set.
"""
import os
import anyio
@@ -6,30 +13,32 @@ from pyslobs import ConnectionConfig, ScenesService, SlobsConnection, StreamingS
async def cleanup(conn: SlobsConnection):
"""Clean up test scenes and ensure streaming, recording, and replay buffer are stopped."""
ss = ScenesService(conn)
scenes = await ss.get_scenes()
for scene in scenes:
if scene.name.startswith("slobs-test-scene-"):
if scene.name.startswith('slobs-test-scene-'):
await ss.remove_scene(scene.id)
ss = StreamingService(conn)
model = await ss.get_model()
if model.streaming_status != "offline":
if model.streaming_status != 'offline':
await ss.toggle_streaming()
if model.replay_buffer_status != "offline":
if model.replay_buffer_status != 'offline':
await ss.stop_replay_buffer()
if model.recording_status != "offline":
if model.recording_status != 'offline':
await ss.toggle_recording()
conn.close()
async def main():
"""Establish connection and clean up test scenes."""
conn = SlobsConnection(
ConnectionConfig(
domain=os.environ["SLOBS_DOMAIN"],
domain=os.environ['SLOBS_DOMAIN'],
port=59650,
token=os.environ["SLOBS_TOKEN"],
token=os.environ['SLOBS_TOKEN'],
)
)
@@ -38,5 +47,5 @@ async def main():
tg.start_soon(cleanup, conn)
if __name__ == "__main__":
if __name__ == '__main__':
anyio.run(main)