Skip to content

Commit

Permalink
Only call get_available_playback_functions() for version 1.2 (#145)
Browse files Browse the repository at this point in the history
  • Loading branch information
allistermaguire authored Jan 22, 2024
1 parent 1b380a3 commit 8fb3f21
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions songpal/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,19 +278,20 @@ async def activate_system_update(self) -> bool:

async def get_inputs(self) -> List[Input]:
"""Return list of available outputs."""
active_input_uri = (await self.get_available_playback_functions())[0].uri
method = self.services["avContent"]["getCurrentExternalTerminalsStatus"]
if method.supports_version("1.2"):
method.use_version("1.2")
res = await method({})
active_input_uri = (await self.get_available_playback_functions())[0].uri
else:
res = await method()
inputs = []
for x in res:
# Hidden inputs (device settings) return with title=""
if x.get("title") and "meta:zone:output" not in x["meta"]:
input_ = Input.make(services=self.services, **x)
input_.active = input_.uri == active_input_uri
if method.supports_version("1.2"):
input_.active = input_.uri == active_input_uri
inputs.append(input_)
return inputs

Expand Down

0 comments on commit 8fb3f21

Please sign in to comment.