summaryrefslogtreecommitdiff
path: root/kvmd/clients/kvmd.py
diff options
context:
space:
mode:
Diffstat (limited to 'kvmd/clients/kvmd.py')
-rw-r--r--kvmd/clients/kvmd.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/kvmd/clients/kvmd.py b/kvmd/clients/kvmd.py
index e514fb16..d78aedbd 100644
--- a/kvmd/clients/kvmd.py
+++ b/kvmd/clients/kvmd.py
@@ -66,11 +66,24 @@ class _AuthApiPart(_BaseApiPart):
class _StreamerApiPart(_BaseApiPart):
- async def set_params(self, quality: int, desired_fps: int) -> None:
+ async def get_state(self) -> Dict:
+ session = self._ensure_http_session()
+ async with session.get(self._make_url("streamer")) as response:
+ htclient.raise_not_200(response)
+ return (await response.json())["result"]
+
+ async def set_params(self, quality: Optional[int]=None, desired_fps: Optional[int]=None) -> None:
session = self._ensure_http_session()
async with session.post(
url=self._make_url("streamer/set_params"),
- params={"quality": quality, "desired_fps": desired_fps},
+ params={
+ key: value
+ for (key, value) in [
+ ("quality", quality),
+ ("desired_fps", desired_fps),
+ ]
+ if value is not None
+ },
) as response:
htclient.raise_not_200(response)