Phill has proposed merging lp:~phill-ridout/openlp/media_ext_refactors into
lp:openlp.
Commit message:
refactor media extensions
Requested reviews:
Tim Bentley (trb143)
For more details, see:
https://code.launchpad.net/~phill-ridout/openlp/media_ext_refactors/+merge/368221
--
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/common/json.py'
--- openlp/core/common/json.py 2019-05-23 19:33:46 +
+++ openlp/core/common/json.py 2019-06-01 07:22:55 +
@@ -23,7 +23,6 @@
from json import JSONDecoder, JSONEncoder
from pathlib import Path
-
_registered_classes = {}
=== modified file 'openlp/core/lib/mediamanageritem.py'
--- openlp/core/lib/mediamanageritem.py 2019-05-22 06:47:00 +
+++ openlp/core/lib/mediamanageritem.py 2019-06-01 07:22:55 +
@@ -589,7 +589,7 @@
"""
Add this item to the current service.
-:param item: Item to be processed
+:param QtWidgets.QListWidgetItem | QtWidgets.QTreeWidgetItem | None item: Item to be processed
:param replace: Replace the existing item
:param remote: Triggered from remote
:param position: Position to place item
@@ -627,7 +627,7 @@
def build_service_item(self, item=None, remote=False, context=ServiceItemContext.Live):
"""
Common method for generating a service item
-:param item: Service Item to be built.
+:param QtWidgets.QListWidgetItem | QtWidgets.QTreeWidgetItem | None item: Service Item to be built.
:param remote: Remote triggered (False)
:param context: The context on which this is called
"""
=== modified file 'openlp/core/lib/serviceitem.py'
--- openlp/core/lib/serviceitem.py 2019-05-22 06:47:00 +
+++ openlp/core/lib/serviceitem.py 2019-06-01 07:22:55 +
@@ -593,9 +593,11 @@
"""
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 @@
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
=== modified file 'openlp/core/ui/media/mediacontroller.py'
--- openlp/core/ui/media/mediacontroller.py 2019-05-05 05:59:29 +
+++ openlp/core/ui/media/mediacontroller.py 2019-06-01 07:22:55 +
@@ -44,7 +44,7 @@
from openlp.core.ui import DisplayControllerType
from openlp.core.ui.media import MediaState, ItemMediaInfo, MediaType, parse_optical_path
from openlp.core.ui.media.endpoint import media_endpoint
-from openlp.core.ui.media.vlcplayer import VlcPlayer, get_vlc
+from openlp.core.ui.media.vlcplayer import AUDIO_EXT, VIDEO_EXT, VlcPlayer, get_vlc
log = logging.getLogger(__name__)
@@ -65,11 +65,6 @@
current_media_players is an array of player instances keyed on ControllerType.
"""
-def __init__(self, parent=None):
-"""
-Constructor
-"""
-super(MediaController, self).__init__(parent)
def setup(self):
self.vlc_player = None
@@ -95,28 +90,8 @@
Registry().register_function('songs_hide', self.media_hide)
Registry().register_function('songs_blank', self.media_blank)
Registry().register_function('songs_unblank', self.media_unblank)
-Registry().register_function('mediaitem_suffixes', self._generate_extensions_lists)
register_endpoint(media_endpoint)
-def _generate_extensions_lists(self):
-"""
-Set the active players and available media files
-"""
-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:])
-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:])
-self.service_manager.supported_suffixes(suffix_list)
-
def bootstrap_initialise(self):
"""
Check to see if we have any media Player's availab