From 2c01be044c3bb77b71e0eb674123db229ec87e5e Mon Sep 17 00:00:00 2001 From: phill-ridout Date: Tue, 12 Mar 2013 21:03:38 +0000 Subject: [PATCH 1/5] Fixes #1154059 --- openlp/core/ui/media/phononplayer.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/openlp/core/ui/media/phononplayer.py b/openlp/core/ui/media/phononplayer.py index 4be0a91a4..0a218a093 100644 --- a/openlp/core/ui/media/phononplayer.py +++ b/openlp/core/ui/media/phononplayer.py @@ -69,13 +69,19 @@ class PhononPlayer(MediaPlayer): 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) + 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. From d5f8201c8b5215d79652fb09113704ec682b8466 Mon Sep 17 00:00:00 2001 From: phill-ridout Date: Tue, 12 Mar 2013 21:26:38 +0000 Subject: [PATCH 2/5] --- openlp/core/ui/media/phononplayer.py | 1 + 1 file changed, 1 insertion(+) diff --git a/openlp/core/ui/media/phononplayer.py b/openlp/core/ui/media/phononplayer.py index 0a218a093..905e9c78a 100644 --- a/openlp/core/ui/media/phononplayer.py +++ b/openlp/core/ui/media/phononplayer.py @@ -77,6 +77,7 @@ class PhononPlayer(MediaPlayer): self._addToList(self.audio_extensions_list, mimetype) elif mimetype.startswith(u'video/'): self._addToList(self.video_extensions_list, mimetype) + # Work arround for http://bugs.python.org/issue9291 except UnicodeDecodeError: log.exception(u'UnicodeDecodeError when trying to read mime types.' ' Setting extensions to all files') From 5ac1d0809ea73c225db769db7cb9929584d11378 Mon Sep 17 00:00:00 2001 From: phill-ridout Date: Tue, 12 Mar 2013 21:56:04 +0000 Subject: [PATCH 3/5] --- openlp/core/ui/media/phononplayer.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/openlp/core/ui/media/phononplayer.py b/openlp/core/ui/media/phononplayer.py index 905e9c78a..ab859562f 100644 --- a/openlp/core/ui/media/phononplayer.py +++ b/openlp/core/ui/media/phononplayer.py @@ -77,10 +77,9 @@ class PhononPlayer(MediaPlayer): self._addToList(self.audio_extensions_list, mimetype) elif mimetype.startswith(u'video/'): self._addToList(self.video_extensions_list, mimetype) - # Work arround for http://bugs.python.org/issue9291 + # 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') + 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'*'] From 633bbc02cf9c52b5f54b0f14188c62b83b5e8821 Mon Sep 17 00:00:00 2001 From: phill-ridout Date: Tue, 12 Mar 2013 22:02:53 +0000 Subject: [PATCH 4/5] --- openlp/core/ui/media/phononplayer.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openlp/core/ui/media/phononplayer.py b/openlp/core/ui/media/phononplayer.py index ab859562f..793a0ad25 100644 --- a/openlp/core/ui/media/phononplayer.py +++ b/openlp/core/ui/media/phononplayer.py @@ -79,7 +79,8 @@ class PhononPlayer(MediaPlayer): 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') + 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'*'] From 1ac1619b85309efd9deed7d7959f5e504b671dc6 Mon Sep 17 00:00:00 2001 From: phill-ridout Date: Thu, 14 Mar 2013 22:16:36 +0000 Subject: [PATCH 5/5] Changed extenstion to *.* --- openlp/core/ui/media/phononplayer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/core/ui/media/phononplayer.py b/openlp/core/ui/media/phononplayer.py index 793a0ad25..e5894f7c1 100644 --- a/openlp/core/ui/media/phononplayer.py +++ b/openlp/core/ui/media/phononplayer.py @@ -81,8 +81,8 @@ class PhononPlayer(MediaPlayer): 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'*'] + 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.