Automate Media type list from phonon

bzr-revno: 718
This commit is contained in:
Tim Bentley 2010-02-27 19:27:28 +00:00
commit 69af99f5dc
3 changed files with 23 additions and 7 deletions

View File

@ -61,9 +61,9 @@ class MediaMediaItem(MediaManagerItem):
def retranslateUi(self):
self.OnNewPrompt = self.trUtf8('Select Media')
self.OnNewFileMasks = self.trUtf8('Videos (*.avi *.mpeg *.mpg *.wmv '
'*.mov *.mp4 *.flv);;Audio (*.ogg *.mp3 *.wma *.wav *.flac)'
';;All files (*)')
self.OnNewFileMasks = self.trUtf8('Videos (%s);;'
'Audio (%s);;'
'All files (*)' % (self.parent.video_list, self.parent.audio_list))
def requiredIcons(self):
MediaManagerItem.requiredIcons(self)

View File

@ -41,9 +41,25 @@ class MediaPlugin(Plugin):
# passed with drag and drop messages
self.dnd_id = u'Media'
self.status = PluginStatus.Active
# print Phonon.BackendCapabilities.availableMimeTypes()
# for mimetype in Phonon.BackendCapabilities.availableMimeTypes():
# print mimetype
self.audio_list = u''
self.video_list = u''
for mimetype in Phonon.BackendCapabilities.availableMimeTypes():
mimetype = unicode(mimetype)
type = mimetype.split(u'audio/x-')
self.audio_list, mimetype = self._add_to_list(self.audio_list, type, mimetype)
type = mimetype.split(u'audio/')
self.audio_list, mimetype = self._add_to_list(self.audio_list, type, mimetype)
type = mimetype.split(u'video/x-')
self.video_list, mimetype = self._add_to_list(self.video_list, type, mimetype)
type = mimetype.split(u'video/')
self.video_list, mimetype = self._add_to_list(self.video_list, type, mimetype)
def _add_to_list(self, list, value, type):
if len(value) == 2:
if list.find(value[1]) == -1:
list += u'*.%s ' % value[1]
type = u''
return list, type
def initialise(self):
log.info(u'Plugin Initialising')

View File

@ -1 +1 @@
1.9.0-716
1.9.0-718