← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~phill-ridout/openlp/bug1154059_2.0 into lp:openlp/2.0

 

Phill has proposed merging lp:~phill-ridout/openlp/bug1154059_2.0 into lp:openlp/2.0.

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  Bug #1154059 in OpenLP: "OpenLP does not start due to mimetypes bug"
  https://bugs.launchpad.net/openlp/+bug/1154059

For more details, see:
https://code.launchpad.net/~phill-ridout/openlp/bug1154059_2.0/+merge/153024

Fixes #1154059 catching Unicode decode error.
-- 
https://code.launchpad.net/~phill-ridout/openlp/bug1154059_2.0/+merge/153024
Your team OpenLP Core is requested to review the proposed merge of lp:~phill-ridout/openlp/bug1154059_2.0 into lp:openlp/2.0.
=== modified file 'openlp/core/ui/media/phononplayer.py'
--- openlp/core/ui/media/phononplayer.py	2012-12-30 19:41:24 +0000
+++ openlp/core/ui/media/phononplayer.py	2013-03-12 22:09:22 +0000
@@ -69,13 +69,20 @@
         self.display_name = u'&Phonon'
         self.parent = parent
         self.additional_extensions = ADDITIONAL_EXT
-        mimetypes.init()
-        for mimetype in Phonon.BackendCapabilities.availableMimeTypes():
-            mimetype = unicode(mimetype)
-            if mimetype.startswith(u'audio/'):
-                self._addToList(self.audio_extensions_list, mimetype)
-            elif mimetype.startswith(u'video/'):
-                self._addToList(self.video_extensions_list, mimetype)
+        try:
+            mimetypes.init()
+            for mimetype in Phonon.BackendCapabilities.availableMimeTypes():
+                mimetype = unicode(mimetype)
+                if mimetype.startswith(u'audio/'):
+                    self._addToList(self.audio_extensions_list, mimetype)
+                elif mimetype.startswith(u'video/'):
+                    self._addToList(self.video_extensions_list, mimetype)
+        # Work around for http://bugs.python.org/issue9291
+        except UnicodeDecodeError:
+            log.exception(u'UnicodeDecodeError when trying to read mime types.'
+                'Setting extensions to all files')
+            self.audio_extensions_list = [u'*']
+            self.video_extensions_list = [u'*']
 
     def _addToList(self, list, mimetype):
         # Add all extensions which mimetypes provides us for supported types.


Follow ups