Added status method to mplayer plugin

This commit is contained in:
Fabio Manganiello 2019-02-02 17:55:26 +01:00
parent 9ebb265458
commit 4b7730d4cf

View file

@ -329,6 +329,33 @@ class MediaMplayerPlugin(MediaPlugin):
"""
return self._exec('volume', volume)
@action
def status(self):
"""
Get the current player state.
:returns: A dictionary containing the current state.
Example::
output = {
"state": "play" # or "stop" or "pause"
}
"""
state = { 'state': PlayerState.STOP.value }
try:
paused = self.get_property('pause').output.get('pause')
if paused is True:
state['state'] = PlayerState.PAUSE.value
elif paused is False:
state['state'] = PlayerState.PLAY.value
except:
pass
finally:
return state
@action
def get_property(self, property, args=None):
"""