forked from platypush/platypush
- Unwrap the response in the decorator if we got a Response object from the decorated plugin
- No need for @action wrappers around omxplayer event handlers
This commit is contained in:
parent
0ae233d092
commit
a2898f63c3
2 changed files with 3 additions and 3 deletions
|
@ -14,6 +14,9 @@ def action(f):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
output = f(*args, **kwargs)
|
output = f(*args, **kwargs)
|
||||||
|
if output and isinstance(output, Response):
|
||||||
|
errors = output.errors
|
||||||
|
output = output.output
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if isinstance(args[0], Plugin):
|
if isinstance(args[0], Plugin):
|
||||||
args[0].logger.exception(e)
|
args[0].logger.exception(e)
|
||||||
|
|
|
@ -327,19 +327,16 @@ class VideoOmxplayerPlugin(Plugin):
|
||||||
|
|
||||||
redis.send_message(msg)
|
redis.send_message(msg)
|
||||||
|
|
||||||
@action
|
|
||||||
def on_play(self):
|
def on_play(self):
|
||||||
def _f(player):
|
def _f(player):
|
||||||
self.send_message(VideoPlayEvent(video=self.player.get_source()))
|
self.send_message(VideoPlayEvent(video=self.player.get_source()))
|
||||||
return _f
|
return _f
|
||||||
|
|
||||||
@action
|
|
||||||
def on_pause(self):
|
def on_pause(self):
|
||||||
def _f(player):
|
def _f(player):
|
||||||
self.send_message(VideoPauseEvent(video=self.player.get_source()))
|
self.send_message(VideoPauseEvent(video=self.player.get_source()))
|
||||||
return _f
|
return _f
|
||||||
|
|
||||||
@action
|
|
||||||
def on_stop(self):
|
def on_stop(self):
|
||||||
def _f(player):
|
def _f(player):
|
||||||
self.send_message(VideoStopEvent())
|
self.send_message(VideoStopEvent())
|
||||||
|
|
Loading…
Reference in a new issue