forked from openlp/openlp
Additional extensions hack.
This commit is contained in:
parent
e8b6bbe141
commit
fdb5c57468
@ -61,8 +61,8 @@ class MediaMediaItem(MediaManagerItem):
|
|||||||
self.onNewPrompt = translate('MediaPlugin.MediaItem', 'Select Media')
|
self.onNewPrompt = translate('MediaPlugin.MediaItem', 'Select Media')
|
||||||
self.onNewFileMasks = unicode(translate('MediaPlugin.MediaItem',
|
self.onNewFileMasks = unicode(translate('MediaPlugin.MediaItem',
|
||||||
'Videos (%s);;Audio (%s);;%s (*)')) % (
|
'Videos (%s);;Audio (%s);;%s (*)')) % (
|
||||||
u' '.join(self.parent.video_list),
|
u' '.join(self.parent.video_extensions_list),
|
||||||
u' '.join(self.parent.audio_list), UiStrings.AllFiles)
|
u' '.join(self.parent.audio_extensions_list), UiStrings.AllFiles)
|
||||||
self.replaceAction.setText(UiStrings.ReplaceBG)
|
self.replaceAction.setText(UiStrings.ReplaceBG)
|
||||||
self.replaceAction.setToolTip(UiStrings.ReplaceLiveBG)
|
self.replaceAction.setToolTip(UiStrings.ReplaceLiveBG)
|
||||||
self.resetAction.setText(UiStrings.ResetBG)
|
self.resetAction.setText(UiStrings.ResetBG)
|
||||||
|
@ -45,15 +45,19 @@ class MediaPlugin(Plugin):
|
|||||||
self.icon = build_icon(self.icon_path)
|
self.icon = build_icon(self.icon_path)
|
||||||
# passed with drag and drop messages
|
# passed with drag and drop messages
|
||||||
self.dnd_id = u'Media'
|
self.dnd_id = u'Media'
|
||||||
self.audio_list = []
|
# This is yet a dummy example:
|
||||||
self.video_list = []
|
self.additional_extensions = {
|
||||||
|
'audio/msaudio': ['.mp3', '.aac'],
|
||||||
|
'video/msvideo': ['.wmv', '.avi']}
|
||||||
|
self.audio_extensions_list = []
|
||||||
|
self.video_extensions_list = []
|
||||||
mimetypes.init()
|
mimetypes.init()
|
||||||
for mimetype in Phonon.BackendCapabilities.availableMimeTypes():
|
for mimetype in Phonon.BackendCapabilities.availableMimeTypes():
|
||||||
mimetype = unicode(mimetype)
|
mimetype = unicode(mimetype)
|
||||||
if mimetype.startswith(u'audio/'):
|
if mimetype.startswith(u'audio/'):
|
||||||
self._addToList(self.audio_list, mimetype)
|
self._addToList(self.audio_extensions_list, mimetype)
|
||||||
elif mimetype.startswith(u'video/'):
|
elif mimetype.startswith(u'video/'):
|
||||||
self._addToList(self.video_list, mimetype)
|
self._addToList(self.video_extensions_list, mimetype)
|
||||||
|
|
||||||
def _addToList(self, list, mimetype):
|
def _addToList(self, list, mimetype):
|
||||||
extensions = mimetypes.guess_all_extensions(unicode(mimetype))
|
extensions = mimetypes.guess_all_extensions(unicode(mimetype))
|
||||||
@ -64,6 +68,14 @@ class MediaPlugin(Plugin):
|
|||||||
self.serviceManager.supportedSuffixes(extension[1:])
|
self.serviceManager.supportedSuffixes(extension[1:])
|
||||||
log.info(u'MediaPlugin: %s extensions: %s' % (mimetype,
|
log.info(u'MediaPlugin: %s extensions: %s' % (mimetype,
|
||||||
u' '.join(extensions)))
|
u' '.join(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):
|
def about(self):
|
||||||
about_text = translate('MediaPlugin', '<strong>Media Plugin</strong>'
|
about_text = translate('MediaPlugin', '<strong>Media Plugin</strong>'
|
||||||
|
Loading…
Reference in New Issue
Block a user