Add media extensions in the service manager

This commit is contained in:
Phill 2019-06-01 07:59:45 +01:00
parent 52eb196e5b
commit aaaab9bf43
3 changed files with 10 additions and 4 deletions

View File

@ -106,8 +106,6 @@ class MediaController(RegistryBase, LogMixin, RegistryProperties):
else: else:
State().missing_text('media_live', translate('OpenLP.SlideController', State().missing_text('media_live', translate('OpenLP.SlideController',
'VLC or pymediainfo are missing, so you are unable to play any media')) 'VLC or pymediainfo are missing, so you are unable to play any media'))
self.service_manager.supported_suffixes(AUDIO_EXT)
self.service_manager.supported_suffixes(VIDEO_EXT)
return True return True
def bootstrap_post_set_up(self): def bootstrap_post_set_up(self):

View File

@ -48,6 +48,7 @@ from openlp.core.lib.plugin import PluginStatus
from openlp.core.lib.serviceitem import ItemCapabilities, ServiceItem from openlp.core.lib.serviceitem import ItemCapabilities, ServiceItem
from openlp.core.lib.ui import create_widget_action, critical_error_message_box, find_and_set_in_combo_box from openlp.core.lib.ui import create_widget_action, critical_error_message_box, find_and_set_in_combo_box
from openlp.core.ui.icons import UiIcons from openlp.core.ui.icons import UiIcons
from openlp.core.ui.media.vlcplayer import AUDIO_EXT, VIDEO_EXT
from openlp.core.ui.serviceitemeditform import ServiceItemEditForm from openlp.core.ui.serviceitemeditform import ServiceItemEditForm
from openlp.core.ui.servicenoteform import ServiceNoteForm from openlp.core.ui.servicenoteform import ServiceNoteForm
from openlp.core.ui.starttimeform import StartTimeForm from openlp.core.ui.starttimeform import StartTimeForm
@ -321,6 +322,7 @@ class ServiceManager(QtWidgets.QWidget, RegistryBase, Ui_ServiceManager, LogMixi
super().__init__(parent) super().__init__(parent)
self.service_items = [] self.service_items = []
self.suffixes = set() self.suffixes = set()
self.add_media_suffixes()
self.drop_position = -1 self.drop_position = -1
self.service_id = 0 self.service_id = 0
# is a new service and has not been saved # is a new service and has not been saved
@ -347,6 +349,13 @@ class ServiceManager(QtWidgets.QWidget, RegistryBase, Ui_ServiceManager, LogMixi
self.service_item_edit_form = ServiceItemEditForm() self.service_item_edit_form = ServiceItemEditForm()
self.start_time_form = StartTimeForm() self.start_time_form = StartTimeForm()
def add_media_suffixes(self):
"""
Add the suffixes supported by :mod:`openlp.core.ui.media.vlcplayer`
"""
self.suffixes.update(AUDIO_EXT)
self.suffixes.update(VIDEO_EXT)
def set_modified(self, modified=True): def set_modified(self, modified=True):
""" """
Setter for property "modified". Sets whether or not the current service has been modified. Setter for property "modified". Sets whether or not the current service has been modified.
@ -401,7 +410,6 @@ class ServiceManager(QtWidgets.QWidget, RegistryBase, Ui_ServiceManager, LogMixi
def reset_supported_suffixes(self): def reset_supported_suffixes(self):
""" """
Resets the Suffixes list. Resets the Suffixes list.
""" """
self.suffixes.clear() self.suffixes.clear()

View File

@ -303,7 +303,7 @@ class MediaMediaItem(MediaManagerItem, RegistryProperties):
if media_type == MediaType.Audio: if media_type == MediaType.Audio:
extension = AUDIO_EXT extension = AUDIO_EXT
else: else:
extension = VIDEO_EXT # TODO: Rename extension to extensions extension = VIDEO_EXT
extension = [x[1:] for x in extension] extension = [x[1:] for x in extension]
media = [x for x in media_file_paths if x.suffix in extension] media = [x for x in media_file_paths if x.suffix in extension]
return media return media