Deduplicate media extension filter with existing list of media extensions
This commit is contained in:
parent
af4d4af55d
commit
2ae342592c
@ -3,6 +3,7 @@
|
|||||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
import base64
|
import base64
|
||||||
import html
|
import html
|
||||||
|
import itertools
|
||||||
import json
|
import json
|
||||||
import mimetypes
|
import mimetypes
|
||||||
import re
|
import re
|
||||||
@ -553,10 +554,10 @@ to a cloze type first, via Edit>Change Note Type."""))
|
|||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
def onAddMedia(self):
|
def onAddMedia(self):
|
||||||
key = (_("Media") +
|
extension_filter = ' '.join(
|
||||||
" (*.jpg *.png *.gif *.tiff *.svg *.tif *.jpeg "+
|
'*.' + extension
|
||||||
"*.mp3 *.ogg *.wav *.avi *.ogv *.mpg *.mpeg *.mov *.mp4 " +
|
for extension in sorted(itertools.chain(pics, audio)))
|
||||||
"*.mkv *.ogx *.ogv *.oga *.flv *.swf *.flac *.webp *.m4a)")
|
key = (_("Media") + " (" + extension_filter + ")")
|
||||||
def accept(file):
|
def accept(file):
|
||||||
self.addMedia(file, canDelete=True)
|
self.addMedia(file, canDelete=True)
|
||||||
file = getFile(self.widget, _("Add Media"), accept, key, key="media")
|
file = getFile(self.widget, _("Add Media"), accept, key, key="media")
|
||||||
|
Loading…
Reference in New Issue
Block a user