Skip to content

Commit

Permalink
Add ability to change googlecast settings (#38)
Browse files Browse the repository at this point in the history
* Add ability to change googlecast settings

* rename {set,get}_wutang() to {set,get}_googlecast_settings
  • Loading branch information
rytilahti committed Jan 21, 2019
1 parent 9e20c3e commit 5a1d9a6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
6 changes: 3 additions & 3 deletions songpal/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,17 +184,17 @@ async def set_power_settings(self, target: str, value: str) -> None:
params = {"settings": [{"target": target, "value": value}]}
return await self.services["system"]["setPowerSettings"](params)

async def get_wutang(self) -> List[Setting]:
async def get_googlecast_settings(self) -> List[Setting]:
"""Get Googlecast settings."""
return [
Setting.make(**x)
for x in await self.services["system"]["getWuTangInfo"]({})
]

async def set_wutang(self, target: str, value: str):
async def set_googlecast_settings(self, target: str, value: str):
"""Set Googlecast settings."""
params = {"settings": [{"target": target, "value": value}]}
return await self.services["system"]["setWuTangSettings"](params)
return await self.services["system"]["setWuTangInfo"](params)

async def request_settings_tree(self):
"""Get raw settings tree JSON.
Expand Down
9 changes: 7 additions & 2 deletions songpal/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,16 @@ async def input(dev: Device, input):


@cli.command()
@click.argument("target", required=False)
@click.argument("value", required=False)
@pass_dev
@coro
async def googlecast(dev: Device):
async def googlecast(dev: Device, target, value):
"""Return Googlecast settings."""
print_settings(await dev.get_wutang())
if target and value:
click.echo("Setting %s = %s" % (target, value))
await dev.set_googlecast_settings(target, value)
print_settings(await dev.get_googlecast_settings())


@cli.command()
Expand Down

0 comments on commit 5a1d9a6

Please sign in to comment.