openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #06934
[Merge] lp:~mahfiaz/openlp/extensions into lp:openlp
mahfiaz has proposed merging lp:~mahfiaz/openlp/extensions into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
For more details, see:
https://code.launchpad.net/~mahfiaz/openlp/extensions/+merge/53100
Hack to add missing extensions, which are supported, a often reported thing.
A closer loo to get the hardcoded mimetype → extensions table right: https://bugs.launchpad.net/openlp/+bug/724385
--
https://code.launchpad.net/~mahfiaz/openlp/extensions/+merge/53100
Your team OpenLP Core is requested to review the proposed merge of lp:~mahfiaz/openlp/extensions into lp:openlp.
=== modified file 'openlp/plugins/media/mediaplugin.py'
--- openlp/plugins/media/mediaplugin.py 2011-03-10 19:17:05 +0000
+++ openlp/plugins/media/mediaplugin.py 2011-03-11 22:11:38 +0000
@@ -45,6 +45,18 @@
self.icon = build_icon(self.icon_path)
# passed with drag and drop messages
self.dnd_id = u'Media'
+ self.additional_extensions = {
+ u'audio/ac3': [u'.ac3'],
+ u'audio/flac': [u'.flac'],
+ u'audio/x-m4a': [u'.m4a'],
+ u'audio/x-mp3': [u'.mp3'],
+ u'audio/mpeg': [u'.mp3', u'.mp2', u'.mpga', u'.mpega', u'.m4a'],
+ u'audio/qcelp': [u'.qcp'],
+ u'audio/x-wma': [u'.wma'],
+ u'audio/x-ms-wma': [u'.wma'],
+ u'video/x-matroska': [u'.mpv', u'.mkv'],
+ u'video/x-wmv': [u'.wmv'],
+ u'video/x-ms-wmv': [u'.wmv']}
self.audio_extensions_list = []
self.video_extensions_list = []
mimetypes.init()
@@ -65,6 +77,17 @@
self.serviceManager.supportedSuffixes(extension[1:])
log.info(u'MediaPlugin: %s extensions: %s' % (mimetype,
u' '.join(extensions)))
+ # Add extensions for this mimetype from self.additional_extensions.
+ # This hack clears mimetypes' and operating system's shortcomings
+ # by providing possibly missing extensions.
+ if mimetype in self.additional_extensions.keys():
+ for extension in self.additional_extensions[mimetype]:
+ ext = u'*%s' % extensions
+ if ext not in list:
+ list.append(ext)
+ self.serviceManager.supportedSuffixes(extension[1:])
+ log.info(u'MediaPlugin: %s additional extensions: %s' % (mimetype,
+ u' '.join(self.additional_extensions[mimetype])))
def about(self):
about_text = translate('MediaPlugin', '<strong>Media Plugin</strong>'
Follow ups