diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index f284f59bb..3366cd858 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -593,9 +593,11 @@ class ServiceItem(RegistryProperties): """ return not bool(self.slides) - def validate_item(self, suffix_list=None): + def validate_item(self, suffixes=None): """ Validates a service item to make sure it is valid + + :param set[str] suffixes: A set of vaild suffixes """ self.is_valid = True for slide in self.slides: @@ -612,8 +614,8 @@ class ServiceItem(RegistryProperties): if not os.path.exists(file_name): self.is_valid = False break - if suffix_list and not self.is_text(): + if suffixes and not self.is_text(): file_suffix = slide['title'].split('.')[-1] - if file_suffix.lower() not in suffix_list: + if file_suffix.lower() not in suffixes: self.is_valid = False break diff --git a/openlp/core/ui/media/mediacontroller.py b/openlp/core/ui/media/mediacontroller.py index 69fee7189..4cb2a8e79 100644 --- a/openlp/core/ui/media/mediacontroller.py +++ b/openlp/core/ui/media/mediacontroller.py @@ -104,17 +104,15 @@ class MediaController(RegistryBase, LogMixin, RegistryProperties): """ suffix_list = [] self.audio_extensions_list = [] - if self.vlc_player.is_active: - for item in self.vlc_player.audio_extensions_list: - if item not in self.audio_extensions_list: - self.audio_extensions_list.append(item) - suffix_list.append(item[2:]) + for item in self.vlc_player.audio_extensions_list: + if item not in self.audio_extensions_list: + self.audio_extensions_list.append(item) + suffix_list.append(item[2:]) self.video_extensions_list = [] - if self.vlc_player.is_active: - for item in self.vlc_player.video_extensions_list: - if item not in self.video_extensions_list: - self.video_extensions_list.append(item) - suffix_list.append(item[2:]) + for item in self.vlc_player.video_extensions_list: + if item not in self.video_extensions_list: + self.video_extensions_list.append(item) + suffix_list.append(item[2:]) self.service_manager.supported_suffixes(suffix_list) def bootstrap_initialise(self): diff --git a/openlp/core/ui/media/mediaplayer.py b/openlp/core/ui/media/mediaplayer.py index f4bc4a1df..9eb186665 100644 --- a/openlp/core/ui/media/mediaplayer.py +++ b/openlp/core/ui/media/mediaplayer.py @@ -38,7 +38,6 @@ class MediaPlayer(RegistryProperties): self.parent = parent self.name = name self.available = self.check_available() - self.is_active = False self.can_background = False self.can_folder = False self.state = {0: MediaState.Off, 1: MediaState.Off} diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 5e8b3e0cd..9e8b915fb 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -320,7 +320,7 @@ class ServiceManager(QtWidgets.QWidget, RegistryBase, Ui_ServiceManager, LogMixi """ super().__init__(parent) self.service_items = [] - self.suffixes = [] + self.suffixes = set() self.drop_position = -1 self.service_id = 0 # is a new service and has not been saved @@ -403,20 +403,18 @@ class ServiceManager(QtWidgets.QWidget, RegistryBase, Ui_ServiceManager, LogMixi Resets the Suffixes list. """ - self.suffixes = [] + self.suffixes.clear() def supported_suffixes(self, suffix_list): """ Adds Suffixes supported to the master list. Called from Plugins. - :param suffix_list: New Suffix's to be supported + :param list[str] | str suffix_list: New suffix(s) to be supported """ if isinstance(suffix_list, str): - self.suffixes.append(suffix_list) + self.suffixes.add(suffix_list) else: - for suffix in suffix_list: - if suffix not in self.suffixes: - self.suffixes.append(suffix) + self.suffixes.update(suffix_list) def on_new_service_clicked(self): """ @@ -475,9 +473,11 @@ class ServiceManager(QtWidgets.QWidget, RegistryBase, Ui_ServiceManager, LogMixi QtWidgets.QMessageBox.Save | QtWidgets.QMessageBox.Discard | QtWidgets.QMessageBox.Cancel, QtWidgets.QMessageBox.Save) - def on_recent_service_clicked(self): + def on_recent_service_clicked(self, checked): """ Load a recent file as the service triggered by mainwindow recent service list. + + :param bool checked: Not used """ if self.is_modified(): result = self.save_modified_service() diff --git a/tests/functional/openlp_core/ui/media/test_mediacontroller.py b/tests/functional/openlp_core/ui/media/test_mediacontroller.py index e6209cd37..a1a1122a1 100644 --- a/tests/functional/openlp_core/ui/media/test_mediacontroller.py +++ b/tests/functional/openlp_core/ui/media/test_mediacontroller.py @@ -50,7 +50,6 @@ class TestMediaController(TestCase, TestMixin): # GIVEN: A MediaController and an active player with audio and video extensions media_controller = MediaController() media_controller.vlc_player = VlcPlayer(None) - media_controller.vlc_player.is_active = True media_controller.vlc_player.audio_extensions_list = ['*.mp3', '*.wav', '*.wma', '*.ogg'] media_controller.vlc_player.video_extensions_list = ['*.mp4', '*.mov', '*.avi', '*.ogm']