Skip to content

Commit

Permalink
Add volume and configurationBool commands (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
bjw-s authored Oct 15, 2020
1 parent 7a3c720 commit 12a09fd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
17 changes: 14 additions & 3 deletions fullykiosk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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")

Expand All @@ -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")
Expand All @@ -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")

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 12a09fd

Please sign in to comment.