diff --git a/platypush/backend/__init__.py b/platypush/backend/__init__.py index 0d81c2f74..4c9a670ae 100644 --- a/platypush/backend/__init__.py +++ b/platypush/backend/__init__.py @@ -191,7 +191,7 @@ class Backend(Thread): backend is configured then it will try to deliver the message to other consumers through the configured Redis main queue. - Param: + Params: msg -- The message """ try: diff --git a/platypush/plugins/video/omxplayer.py b/platypush/plugins/video/omxplayer.py index 38e22d504..34a904f01 100644 --- a/platypush/plugins/video/omxplayer.py +++ b/platypush/plugins/video/omxplayer.py @@ -10,6 +10,7 @@ import urllib.parse from dbus.exceptions import DBusException from omxplayer import OMXPlayer +from platypush.context import get_backend from platypush.plugins.media import PlayerState from platypush.message.response import Response from platypush.message.event.video import VideoPlayEvent, VideoPauseEvent, \ @@ -195,6 +196,18 @@ class VideoOmxplayerPlugin(Plugin): 'state': PlayerState.STOP.value })) + def send_message(self, msg): + try: + redis = get_backend('redis') + if not redis: + raise KeyError() + except KeyError: + self.logger.warning("Backend {} does not implement send_message " + + "and the fallback Redis backend isn't configured") + return + + redis.send_message(msg) + def on_play(self): def _f(player): self.send_message(VideoPlayEvent(video=self.player.get_source()))