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

View file

@ -2,6 +2,7 @@ import json
import re import re
import subprocess import subprocess
from dbus.exceptions import DBusException
from omxplayer import OMXPlayer from omxplayer import OMXPlayer
from platypush.message.response import Response from platypush.message.response import Response
@ -18,7 +19,13 @@ class VideoOmxplayerPlugin(Plugin):
or resource.startswith('https://www.youtube.com/watch?v='): or resource.startswith('https://www.youtube.com/watch?v='):
resource = self._get_youtube_content(resource) 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() return self.status()
def pause(self): def pause(self):