Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to change googlecast settings #38

Merged
merged 2 commits into from
Jan 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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