← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~trb143/openlp/bugs into lp:openlp

 

Tim Bentley has proposed merging lp:~trb143/openlp/bugs into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)


Fix up mime type bug #657465
And comment cleanups 
-- 
https://code.launchpad.net/~trb143/openlp/bugs/+merge/39685
Your team OpenLP Core is requested to review the proposed merge of lp:~trb143/openlp/bugs into lp:openlp.
=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py	2010-10-30 10:14:22 +0000
+++ openlp/core/ui/mainwindow.py	2010-10-30 10:21:44 +0000
@@ -602,7 +602,7 @@
         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 @@
             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

=== modified file 'openlp/plugins/media/mediaplugin.py'
--- openlp/plugins/media/mediaplugin.py	2010-10-07 21:49:25 +0000
+++ openlp/plugins/media/mediaplugin.py	2010-10-30 10:21:44 +0000
@@ -25,6 +25,7 @@
 ###############################################################################
 
 import logging
+import mimetypes
 
 from PyQt4.phonon import Phonon
 
@@ -45,6 +46,7 @@
         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 @@
             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)
@@ -97,42 +104,42 @@
         ## Load Button ##
         self.textStrings[StringContent.Load] = {
             u'title': translate('MediaPlugin', 'Load'),
-            u'tooltip': translate('MediaPlugin', 
+            u'tooltip': translate('MediaPlugin',
                 'Load a new Media')
         }
         ## New Button ##
         self.textStrings[StringContent.New] = {
             u'title': translate('MediaPlugin', 'Add'),
-            u'tooltip': translate('MediaPlugin', 
+            u'tooltip': translate('MediaPlugin',
                 'Add a new Media')
         }
         ## Edit Button ##
         self.textStrings[StringContent.Edit] = {
             u'title': translate('MediaPlugin', 'Edit'),
-            u'tooltip': translate('MediaPlugin', 
+            u'tooltip': translate('MediaPlugin',
                 'Edit the selected Media')
         }
         ## Delete Button ##
         self.textStrings[StringContent.Delete] = {
             u'title': translate('MediaPlugin', 'Delete'),
-            u'tooltip': translate('MediaPlugin', 
+            u'tooltip': translate('MediaPlugin',
                 'Delete the selected Media')
         }
         ## Preview ##
         self.textStrings[StringContent.Preview] = {
             u'title': translate('MediaPlugin', 'Preview'),
-            u'tooltip': translate('MediaPlugin', 
+            u'tooltip': translate('MediaPlugin',
                 'Preview the selected Media')
         }
         ## Live  Button ##
         self.textStrings[StringContent.Live] = {
             u'title': translate('MediaPlugin', 'Live'),
-            u'tooltip': translate('MediaPlugin', 
+            u'tooltip': translate('MediaPlugin',
                 'Send the selected Media live')
         }
         ## Add to service Button ##
         self.textStrings[StringContent.Service] = {
             u'title': translate('MediaPlugin', 'Service'),
-            u'tooltip': translate('MediaPlugin', 
+            u'tooltip': translate('MediaPlugin',
                 'Add the selected Media to the service')
         }


Follow ups