Added status method to mplayer plugin
This commit is contained in:
parent
9ebb265458
commit
4b7730d4cf
1 changed files with 27 additions and 0 deletions
|
@ -329,6 +329,33 @@ class MediaMplayerPlugin(MediaPlugin):
|
||||||
"""
|
"""
|
||||||
return self._exec('volume', volume)
|
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
|
@action
|
||||||
def get_property(self, property, args=None):
|
def get_property(self, property, args=None):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue