Fix mimetype issues

bzr-revno: 1109
Fixes: https://launchpad.net/bugs/657465
This commit is contained in:
Tim Bentley 2010-10-30 13:56:51 +01:00
commit a1d2e8390b
2 changed files with 26 additions and 19 deletions

View File

@ -602,7 +602,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
QtCore.QObject.connect(self.FileSaveAsItem,
QtCore.SIGNAL(u'triggered()'),
self.ServiceManagerContents.onSaveService)
#i18n set signals for languages
# i18n set signals for languages
QtCore.QObject.connect(self.AutoLanguageItem,
QtCore.SIGNAL(u'toggled(bool)'), self.setAutoLanguage)
self.LanguageGroup.triggered.connect(LanguageManager.set_language)
@ -622,15 +622,15 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
QtCore.SIGNAL(u'config_screen_changed'), self.screenChanged)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'maindisplay_status_text'), self.showStatusMessage)
#warning cyclic dependency
#RenderManager needs to call ThemeManager and
#ThemeManager needs to call RenderManager
# warning cyclic dependency
# RenderManager needs to call ThemeManager and
# ThemeManager needs to call RenderManager
self.RenderManager = RenderManager(
self.ThemeManagerContents, self.screens)
#Define the media Dock Manager
# Define the media Dock Manager
self.mediaDockManager = MediaDockManager(self.MediaToolBox)
log.info(u'Load Plugins')
#make the controllers available to the plugins
# make the controllers available to the plugins
self.plugin_helpers[u'preview'] = self.PreviewController
self.plugin_helpers[u'live'] = self.LiveController
self.plugin_helpers[u'render'] = self.RenderManager

View File

@ -25,6 +25,7 @@
###############################################################################
import logging
import mimetypes
from PyQt4.phonon import Phonon
@ -45,6 +46,7 @@ class MediaPlugin(Plugin):
self.dnd_id = u'Media'
self.audio_list = u''
self.video_list = u''
mimetypes.init()
for mimetype in Phonon.BackendCapabilities.availableMimeTypes():
mimetype = unicode(mimetype)
type = mimetype.split(u'audio/x-')
@ -60,13 +62,18 @@ class MediaPlugin(Plugin):
self.video_list, mimetype = self._addToList(self.video_list,
type, mimetype)
def _addToList(self, list, value, type):
def _addToList(self, list, value, mimetype):
# Is it a media type
if len(value) == 2:
if list.find(value[1]) == -1:
list += u'*.%s ' % value[1]
self.serviceManager.supportedSuffixes(value[1])
type = u''
return list, type
extensions = mimetypes.guess_all_extensions(unicode(mimetype))
# we have an extension
if extensions:
for extension in extensions:
if list.find(extension) == -1:
list += u'*%s ' % extension
self.serviceManager.supportedSuffixes(extension[1:])
mimetype = u''
return list, mimetype
def getSettingsTab(self):
return MediaTab(self.name)