From 12a09fdaac2c0ed4ad62c3dc8d5241d39c85d491 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernd=20Sch=C3=B6rgers?= Date: Thu, 15 Oct 2020 21:34:20 +0200 Subject: [PATCH] Add volume and configurationBool commands (#4) --- fullykiosk/__init__.py | 17 ++++++++++++++--- setup.py | 2 +- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/fullykiosk/__init__.py b/fullykiosk/__init__.py index 229add7..5fdf3c0 100644 --- a/fullykiosk/__init__.py +++ b/fullykiosk/__init__.py @@ -14,7 +14,8 @@ def __init__(self, host, port, password): def sendCommand(self, cmd, **kwargs): url = f"http://{self.host}:{self.port}/?cmd={cmd}&password={self.password}&type=json" for key, value in kwargs.items(): - url = url + f"&{key}={value}" + if value is not None: + url = url + f"&{key}={value}" try: result = json.loads(requests.get(url, timeout=10).content) @@ -48,6 +49,11 @@ def setScreenBrightness(self, brightness): "setStringSetting", key="screenBrightness", value=brightness ) + def setAudioVolume(self, volume, stream=None): + return self.sendCommand( + "setAudioVolume", volume=volume, stream=stream + ) + def restartApp(self): return self.sendCommand("restartApp") @@ -57,8 +63,8 @@ def loadStartUrl(self): def loadUrl(self, url): return self.sendCommand("loadUrl", url=url) - def playSound(self, url): - return self.sendCommand("playSound", url=url) + def playSound(self, url, stream=None): + return self.sendCommand("playSound", url=url, stream=stream) def stopSound(self): return self.sendCommand("stopSound") @@ -74,6 +80,11 @@ def setConfigurationString(self, setting, stringValue): "setStringSetting", key=setting, value=stringValue ) + def setConfigurationBool(self, setting, boolValue): + return self.sendCommand( + "setBooleanSetting", key=setting, value=boolValue + ) + def enableLockedMode(self): return self.sendCommand("enableLockedMode") diff --git a/setup.py b/setup.py index ff4abb0..ac30d2b 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ PROJECT_DIR = Path(__file__).parent.resolve() README_FILE = PROJECT_DIR / "README.md" -VERSION = "0.0.5" +VERSION = "0.0.6" setup(