Automatically switch mpd between resume and start playing on media_play (#37854)

* Automatically switch between resume and start playing

* Fix Black issue

Weirdly when i run it i had an error `1544 files left unchanged, 3313 files failed to reformat.`
I didn't watch the commit check output afterward.
pull/37467/head
Vaarlion 2020-08-07 22:28:49 +02:00 committed by GitHub
parent 3e9f2b8246
commit 353817337e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -307,7 +307,10 @@ class MpdDevice(MediaPlayerEntity):
def media_play(self):
"""Service to send the MPD the command for play/pause."""
self._client.pause(0)
if self._status["state"] == "pause":
self._client.pause(0)
else:
self._client.play()
def media_pause(self):
"""Service to send the MPD the command for play/pause."""