Skip to content

Commit

Permalink
Better play/pause command not relied on playback state which may be u…
Browse files Browse the repository at this point in the history
…ncorrect)
  • Loading branch information
albaintor committed Jun 7, 2024
1 parent 735dfa4 commit b716498
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions intg-kodi/kodi.py
Original file line number Diff line number Diff line change
Expand Up @@ -673,10 +673,15 @@ async def async_media_pause(self):
@cmd_wrapper
async def play_pause(self):
"""Send toggle-play-pause command to Kodi"""
if self._paused:
await self.async_media_play()
else:
await self.async_media_pause()
try:
players = await self._kodi.get_players()
player_id = players[0]["playerid"]
await self._kodi.call_method("Player.PlayPause", **{"playerid": player_id})
except Exception:
if self._paused:
await self.async_media_play()
else:
await self.async_media_pause()

@cmd_wrapper
async def stop(self):
Expand Down

0 comments on commit b716498

Please sign in to comment.