Fixed bug #963894 for the moment by dynamically removing VLC support from OpenLP on Mac OS X.

bzr-revno: 2066
Fixes: https://launchpad.net/bugs/963894
This commit is contained in:
Martin Zibricky 2012-09-19 23:59:26 +02:00 committed by Raoul Snyman
commit 906f259d8e

View File

@ -28,6 +28,7 @@
import logging import logging
import os import os
import sys
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import OpenLPToolbar, Receiver, translate from openlp.core.lib import OpenLPToolbar, Receiver, translate
@ -105,8 +106,12 @@ class MediaController(object):
AppLocation.get_directory(AppLocation.AppDir), AppLocation.get_directory(AppLocation.AppDir),
u'core', u'ui', u'media') u'core', u'ui', u'media')
for filename in os.listdir(controller_dir): for filename in os.listdir(controller_dir):
if filename.endswith(u'player.py') and not \ # TODO vlc backend is not yet working on Mac OS X.
filename == 'media_player.py': # For now just ignore vlc backend on Mac OS X.
if sys.platform == 'darwin' and filename == 'vlcplayer.py':
log.warn(u'Disabling vlc media player')
continue
if filename.endswith(u'player.py'):
path = os.path.join(controller_dir, filename) path = os.path.join(controller_dir, filename)
if os.path.isfile(path): if os.path.isfile(path):
modulename = u'openlp.core.ui.media.' + \ modulename = u'openlp.core.ui.media.' + \
@ -114,7 +119,9 @@ class MediaController(object):
log.debug(u'Importing controller %s', modulename) log.debug(u'Importing controller %s', modulename)
try: try:
__import__(modulename, globals(), locals(), []) __import__(modulename, globals(), locals(), [])
except ImportError: # On some platforms importing vlc.py might cause
# also OSError exceptions. (e.g. Mac OS X)
except (ImportError, OSError):
log.warn(u'Failed to import %s on path %s', log.warn(u'Failed to import %s on path %s',
modulename, path) modulename, path)
controller_classes = MediaPlayer.__subclasses__() controller_classes = MediaPlayer.__subclasses__()