mirror of
https://github.com/onyx-and-iris/slobs-cli.git
synced 2025-06-27 15:20:24 +01:00
read conn from closure
This commit is contained in:
parent
ad6c0bb042
commit
7227183073
@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "slobs-cli"
|
||||
version = "0.3.0"
|
||||
version = "0.3.1"
|
||||
description = "A command line application for Streamlabs Desktop"
|
||||
authors = [{ name = "onyx-and-iris", email = "code@onyxandiris.online" }]
|
||||
dependencies = ["pyslobs>=2.0.4", "asyncclick>=8.1.8"]
|
||||
|
@ -43,7 +43,7 @@ async def current(ctx: click.Context):
|
||||
conn = ctx.obj["connection"]
|
||||
ss = ScenesService(conn)
|
||||
|
||||
async def _run(conn):
|
||||
async def _run():
|
||||
active_scene = await ss.active_scene()
|
||||
if active_scene:
|
||||
click.echo(
|
||||
@ -55,7 +55,7 @@ async def current(ctx: click.Context):
|
||||
|
||||
async with create_task_group() as tg:
|
||||
tg.start_soon(conn.background_processing)
|
||||
tg.start_soon(_run, conn)
|
||||
tg.start_soon(_run)
|
||||
|
||||
|
||||
@scene.command()
|
||||
@ -67,7 +67,7 @@ async def switch(ctx: click.Context, scene_name: str):
|
||||
conn = ctx.obj["connection"]
|
||||
ss = ScenesService(conn)
|
||||
|
||||
async def _run(conn):
|
||||
async def _run():
|
||||
scenes = await ss.get_scenes()
|
||||
for scene in scenes:
|
||||
if scene.name == scene_name:
|
||||
@ -83,4 +83,4 @@ async def switch(ctx: click.Context, scene_name: str):
|
||||
|
||||
async with create_task_group() as tg:
|
||||
tg.start_soon(conn.background_processing)
|
||||
tg.start_soon(_run, conn)
|
||||
tg.start_soon(_run)
|
||||
|
@ -18,7 +18,7 @@ async def start(ctx: click.Context):
|
||||
conn = ctx.obj["connection"]
|
||||
ss = StreamingService(conn)
|
||||
|
||||
async def _run(conn):
|
||||
async def _run():
|
||||
current_state = await ss.get_model()
|
||||
active = current_state.streaming_status != "offline"
|
||||
|
||||
@ -32,7 +32,7 @@ async def start(ctx: click.Context):
|
||||
|
||||
async with create_task_group() as tg:
|
||||
tg.start_soon(conn.background_processing)
|
||||
tg.start_soon(_run, conn)
|
||||
tg.start_soon(_run)
|
||||
|
||||
|
||||
@stream.command()
|
||||
@ -43,7 +43,7 @@ async def stop(ctx: click.Context):
|
||||
conn = ctx.obj["connection"]
|
||||
ss = StreamingService(conn)
|
||||
|
||||
async def _run(conn):
|
||||
async def _run():
|
||||
current_state = await ss.get_model()
|
||||
active = current_state.streaming_status != "offline"
|
||||
|
||||
@ -57,7 +57,7 @@ async def stop(ctx: click.Context):
|
||||
|
||||
async with create_task_group() as tg:
|
||||
tg.start_soon(conn.background_processing)
|
||||
tg.start_soon(_run, conn)
|
||||
tg.start_soon(_run)
|
||||
|
||||
|
||||
@stream.command()
|
||||
@ -68,7 +68,7 @@ async def status(ctx: click.Context):
|
||||
conn = ctx.obj["connection"]
|
||||
ss = StreamingService(conn)
|
||||
|
||||
async def _run(conn):
|
||||
async def _run():
|
||||
current_state = await ss.get_model()
|
||||
status = current_state.streaming_status
|
||||
click.echo(f"Current stream status: {status}")
|
||||
@ -76,7 +76,7 @@ async def status(ctx: click.Context):
|
||||
|
||||
async with create_task_group() as tg:
|
||||
tg.start_soon(conn.background_processing)
|
||||
tg.start_soon(_run, conn)
|
||||
tg.start_soon(_run)
|
||||
|
||||
|
||||
@stream.command()
|
||||
@ -87,7 +87,7 @@ async def toggle(ctx: click.Context):
|
||||
conn = ctx.obj["connection"]
|
||||
ss = StreamingService(conn)
|
||||
|
||||
async def _run(conn):
|
||||
async def _run():
|
||||
current_state = await ss.get_model()
|
||||
active = current_state.streaming_status != "offline"
|
||||
|
||||
@ -102,4 +102,4 @@ async def toggle(ctx: click.Context):
|
||||
|
||||
async with create_task_group() as tg:
|
||||
tg.start_soon(conn.background_processing)
|
||||
tg.start_soon(_run, conn)
|
||||
tg.start_soon(_run)
|
||||
|
Loading…
x
Reference in New Issue
Block a user