From ec6f1b1457bd18c768376fe0b95c6347c8ca7ba9 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Wed, 27 Dec 2017 11:27:06 +0100 Subject: [PATCH] Prevent player loops in case of dbus errors --- platypush/plugins/video/omxplayer.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/platypush/plugins/video/omxplayer.py b/platypush/plugins/video/omxplayer.py index d871725a..3892df6d 100644 --- a/platypush/plugins/video/omxplayer.py +++ b/platypush/plugins/video/omxplayer.py @@ -2,6 +2,7 @@ import json import re import subprocess +from dbus.exceptions import DBusException from omxplayer import OMXPlayer from platypush.message.response import Response @@ -18,7 +19,13 @@ class VideoOmxplayerPlugin(Plugin): or resource.startswith('https://www.youtube.com/watch?v='): resource = self._get_youtube_content(resource) - self.player = OMXPlayer(resource, args=self.args) + try: + self.player = OMXPlayer(resource, args=self.args) + except DBusException as e: + logging.warning('DBus connection failed: you will probably not ' + + 'be able to control the media') + logging.exception(e) + return self.status() def pause(self):