Skip to content

Commit 12a09fd

Browse files
authored
Add volume and configurationBool commands (#4)
1 parent 7a3c720 commit 12a09fd

2 files changed

Lines changed: 15 additions & 4 deletions

File tree

fullykiosk/__init__.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ def __init__(self, host, port, password):
1414
def sendCommand(self, cmd, **kwargs):
1515
url = f"http://{self.host}:{self.port}/?cmd={cmd}&password={self.password}&type=json"
1616
for key, value in kwargs.items():
17-
url = url + f"&{key}={value}"
17+
if value is not None:
18+
url = url + f"&{key}={value}"
1819

1920
try:
2021
result = json.loads(requests.get(url, timeout=10).content)
@@ -48,6 +49,11 @@ def setScreenBrightness(self, brightness):
4849
"setStringSetting", key="screenBrightness", value=brightness
4950
)
5051

52+
def setAudioVolume(self, volume, stream=None):
53+
return self.sendCommand(
54+
"setAudioVolume", volume=volume, stream=stream
55+
)
56+
5157
def restartApp(self):
5258
return self.sendCommand("restartApp")
5359

@@ -57,8 +63,8 @@ def loadStartUrl(self):
5763
def loadUrl(self, url):
5864
return self.sendCommand("loadUrl", url=url)
5965

60-
def playSound(self, url):
61-
return self.sendCommand("playSound", url=url)
66+
def playSound(self, url, stream=None):
67+
return self.sendCommand("playSound", url=url, stream=stream)
6268

6369
def stopSound(self):
6470
return self.sendCommand("stopSound")
@@ -74,6 +80,11 @@ def setConfigurationString(self, setting, stringValue):
7480
"setStringSetting", key=setting, value=stringValue
7581
)
7682

83+
def setConfigurationBool(self, setting, boolValue):
84+
return self.sendCommand(
85+
"setBooleanSetting", key=setting, value=boolValue
86+
)
87+
7788
def enableLockedMode(self):
7889
return self.sendCommand("enableLockedMode")
7990

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
PROJECT_DIR = Path(__file__).parent.resolve()
77
README_FILE = PROJECT_DIR / "README.md"
8-
VERSION = "0.0.5"
8+
VERSION = "0.0.6"
99

1010

1111
setup(

0 commit comments

Comments
 (0)