Prevent player loops in case of dbus errors

This commit is contained in:
Fabio Manganiello 2017-12-27 11:27:06 +01:00
parent 7c55848651
commit ec6f1b1457
1 changed files with 8 additions and 1 deletions

View File

@ -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):