forked from openlp/openlp
revert changes
This commit is contained in:
parent
334eb6c8c5
commit
72a180716b
@ -134,7 +134,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
|||||||
"""
|
"""
|
||||||
saved_players = get_media_players()[0]
|
saved_players = get_media_players()[0]
|
||||||
for player in list(self.media_players.keys()):
|
for player in list(self.media_players.keys()):
|
||||||
self.media_players[player][0].is_active = player in saved_players
|
self.media_players[player].is_active = player in saved_players
|
||||||
|
|
||||||
def _generate_extensions_lists(self):
|
def _generate_extensions_lists(self):
|
||||||
"""
|
"""
|
||||||
@ -143,30 +143,28 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
|||||||
suffix_list = []
|
suffix_list = []
|
||||||
self.audio_extensions_list = []
|
self.audio_extensions_list = []
|
||||||
for player in list(self.media_players.values()):
|
for player in list(self.media_players.values()):
|
||||||
if player[0].is_active:
|
if player.is_active:
|
||||||
for item in player[0].audio_extensions_list:
|
for item in player.audio_extensions_list:
|
||||||
if item not in self.audio_extensions_list:
|
if item not in self.audio_extensions_list:
|
||||||
self.audio_extensions_list.append(item)
|
self.audio_extensions_list.append(item)
|
||||||
suffix_list.append(item[2:])
|
suffix_list.append(item[2:])
|
||||||
self.video_extensions_list = []
|
self.video_extensions_list = []
|
||||||
for player in list(self.media_players.values()):
|
for player in list(self.media_players.values()):
|
||||||
if player[0].is_active:
|
if player.is_active:
|
||||||
for item in player[0].video_extensions_list:
|
for item in player.video_extensions_list:
|
||||||
if item not in self.video_extensions_list:
|
if item not in self.video_extensions_list:
|
||||||
self.video_extensions_list.append(item)
|
self.video_extensions_list.append(item)
|
||||||
suffix_list.append(item[2:])
|
suffix_list.append(item[2:])
|
||||||
self.service_manager.supported_suffixes(suffix_list)
|
self.service_manager.supported_suffixes(suffix_list)
|
||||||
|
|
||||||
def register_players(self, live_player, preview_player):
|
def register_players(self, player):
|
||||||
"""
|
"""
|
||||||
Register each media Player (Webkit, Phonon, etc) and store
|
Register each media Player (Webkit, Phonon, etc) and store
|
||||||
for later use
|
for later use
|
||||||
|
|
||||||
:param live_player: Individual player class which has been enabled for live use
|
:param player: Individual player class which has been enabled
|
||||||
:param preview_player: Individual player class which has been enabled for preview use
|
|
||||||
"""
|
"""
|
||||||
self.media_players[live_player.name] = {DisplayControllerType.Preview: preview_player,
|
self.media_players[player.name] = player
|
||||||
DisplayControllerType.Live: live_player}
|
|
||||||
|
|
||||||
def bootstrap_initialise(self):
|
def bootstrap_initialise(self):
|
||||||
"""
|
"""
|
||||||
@ -188,14 +186,14 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
|||||||
log.warning('Failed to import %s on path %s', module_name, path)
|
log.warning('Failed to import %s on path %s', module_name, path)
|
||||||
player_classes = MediaPlayer.__subclasses__()
|
player_classes = MediaPlayer.__subclasses__()
|
||||||
for player_class in player_classes:
|
for player_class in player_classes:
|
||||||
# player = player_class(self)
|
player = player_class(self)
|
||||||
self.register_players(player_class(self), player_class(self))
|
self.register_players(player)
|
||||||
if not self.media_players:
|
if not self.media_players:
|
||||||
return False
|
return False
|
||||||
saved_players, overridden_player = get_media_players()
|
saved_players, overridden_player = get_media_players()
|
||||||
invalid_media_players = \
|
invalid_media_players = \
|
||||||
[media_player for media_player in saved_players if media_player not in self.media_players or
|
[media_player for media_player in saved_players if media_player not in self.media_players or
|
||||||
not self.media_players[media_player][0].check_available()]
|
not self.media_players[media_player].check_available()]
|
||||||
if invalid_media_players:
|
if invalid_media_players:
|
||||||
for invalidPlayer in invalid_media_players:
|
for invalidPlayer in invalid_media_players:
|
||||||
saved_players.remove(invalidPlayer)
|
saved_players.remove(invalidPlayer)
|
||||||
@ -234,6 +232,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
|||||||
self.current_media_players[source].update_ui(display)
|
self.current_media_players[source].update_ui(display)
|
||||||
if self.current_media_players[source].state == MediaState.Playing:
|
if self.current_media_players[source].state == MediaState.Playing:
|
||||||
any_active = True
|
any_active = True
|
||||||
|
print(source)
|
||||||
self.tick(self.display_controllers[source])
|
self.tick(self.display_controllers[source])
|
||||||
# There are still any active players - no need to stop live_timer.
|
# There are still any active players - no need to stop live_timer.
|
||||||
if any_active:
|
if any_active:
|
||||||
@ -253,8 +252,8 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
|||||||
"""
|
"""
|
||||||
css = ''
|
css = ''
|
||||||
for player in list(self.media_players.values()):
|
for player in list(self.media_players.values()):
|
||||||
if player[0].is_active:
|
if player.is_active:
|
||||||
css += player[0].get_media_display_css()
|
css += player.get_media_display_css()
|
||||||
return css
|
return css
|
||||||
|
|
||||||
def get_media_display_javascript(self):
|
def get_media_display_javascript(self):
|
||||||
@ -263,8 +262,8 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
|||||||
"""
|
"""
|
||||||
js = ''
|
js = ''
|
||||||
for player in list(self.media_players.values()):
|
for player in list(self.media_players.values()):
|
||||||
if player[0].is_active:
|
if player.is_active:
|
||||||
js += player[0].get_media_display_javascript()
|
js += player.get_media_display_javascript()
|
||||||
return js
|
return js
|
||||||
|
|
||||||
def get_media_display_html(self):
|
def get_media_display_html(self):
|
||||||
@ -273,8 +272,8 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
|||||||
"""
|
"""
|
||||||
html = ''
|
html = ''
|
||||||
for player in list(self.media_players.values()):
|
for player in list(self.media_players.values()):
|
||||||
if player[0].is_active:
|
if player.is_active:
|
||||||
html += player[0].get_media_display_html()
|
html += player.get_media_display_html()
|
||||||
return html
|
return html
|
||||||
|
|
||||||
def register_controller(self, controller):
|
def register_controller(self, controller):
|
||||||
@ -362,8 +361,8 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
|||||||
if preview:
|
if preview:
|
||||||
display.has_audio = False
|
display.has_audio = False
|
||||||
for player in list(self.media_players.values()):
|
for player in list(self.media_players.values()):
|
||||||
if player[0].is_active:
|
if player.is_active:
|
||||||
player[0].setup(display)
|
player.setup(display)
|
||||||
|
|
||||||
def set_controls_visible(self, controller, value):
|
def set_controls_visible(self, controller, value):
|
||||||
"""
|
"""
|
||||||
@ -483,7 +482,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
|||||||
suffix = '*.%s' % media_info.file_info.suffix().lower()
|
suffix = '*.%s' % media_info.file_info.suffix().lower()
|
||||||
used_players = get_media_players()[0]
|
used_players = get_media_players()[0]
|
||||||
player = self.media_players[used_players[0]]
|
player = self.media_players[used_players[0]]
|
||||||
if suffix not in player[0].video_extensions_list and suffix not in player[0].audio_extensions_list:
|
if suffix not in player.video_extensions_list and suffix not in player.audio_extensions_list:
|
||||||
# Media could not be loaded correctly
|
# Media could not be loaded correctly
|
||||||
critical_error_message_box(translate('MediaPlugin.MediaItem', 'Unsupported Media File'),
|
critical_error_message_box(translate('MediaPlugin.MediaItem', 'Unsupported Media File'),
|
||||||
translate('MediaPlugin.MediaItem', 'File %s not supported using player %s') %
|
translate('MediaPlugin.MediaItem', 'File %s not supported using player %s') %
|
||||||
@ -590,31 +589,31 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
|||||||
if title == 'system':
|
if title == 'system':
|
||||||
if not controller.media_info.is_background or controller.media_info.is_background and \
|
if not controller.media_info.is_background or controller.media_info.is_background and \
|
||||||
player.can_background:
|
player.can_background:
|
||||||
self.resize(display, player[controller.controller_type])
|
self.resize(display, player)
|
||||||
if player.load(display):
|
if player.load(display):
|
||||||
self.current_media_players[controller.controller_type] = player
|
self.current_media_players[controller.controller_type] = player
|
||||||
controller.media_info.media_type = MediaType.Video
|
controller.media_info.media_type = MediaType.Video
|
||||||
return True
|
return True
|
||||||
if suffix in player[controller.controller_type].video_extensions_list:
|
if suffix in player.video_extensions_list:
|
||||||
if not controller.media_info.is_background or controller.media_info.is_background and \
|
if not controller.media_info.is_background or controller.media_info.is_background and \
|
||||||
player[controller.controller_type].can_background:
|
player.can_background:
|
||||||
self.resize(display, player[controller.controller_type])
|
self.resize(display, player)
|
||||||
if player[controller.controller_type].load(display):
|
if player.load(display):
|
||||||
self.current_media_players[controller.controller_type] = player[controller.controller_type]
|
self.current_media_players[controller.controller_type] = player
|
||||||
controller.media_info.media_type = MediaType.Video
|
controller.media_info.media_type = MediaType.Video
|
||||||
return True
|
return True
|
||||||
if suffix in player[controller.controller_type].audio_extensions_list:
|
if suffix in player.audio_extensions_list:
|
||||||
if player[controller.controller_type].load(display):
|
if player.load(display):
|
||||||
self.current_media_players[controller.controller_type] = player[controller.controller_type]
|
self.current_media_players[controller.controller_type] = player
|
||||||
controller.media_info.media_type = MediaType.Audio
|
controller.media_info.media_type = MediaType.Audio
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
for title in used_players:
|
for title in used_players:
|
||||||
player = self.media_players[title]
|
player = self.media_players[title]
|
||||||
if player[controller.controller_type].can_folder:
|
if player.can_folder:
|
||||||
self.resize(display, player[controller.controller_type])
|
self.resize(display, player)
|
||||||
if player[controller.controller_type].load(display):
|
if player.load(display):
|
||||||
self.current_media_players[controller.controller_type] = player[controller.controller_type]
|
self.current_media_players[controller.controller_type] = player
|
||||||
controller.media_info.media_type = MediaType.Video
|
controller.media_info.media_type = MediaType.Video
|
||||||
return True
|
return True
|
||||||
# no valid player found
|
# no valid player found
|
||||||
|
@ -165,7 +165,7 @@ class PlayerTab(SettingsTab):
|
|||||||
self.player_check_boxes['%s' % player].setEnabled(False)
|
self.player_check_boxes['%s' % player].setEnabled(False)
|
||||||
else:
|
else:
|
||||||
self.player_check_boxes['%s' % player].setEnabled(True)
|
self.player_check_boxes['%s' % player].setEnabled(True)
|
||||||
self.player_order_list_widget.addItem(self.media_players[player][0].original_name)
|
self.player_order_list_widget.addItem(self.media_players[str(player)].original_name)
|
||||||
|
|
||||||
def on_up_button_clicked(self):
|
def on_up_button_clicked(self):
|
||||||
"""
|
"""
|
||||||
@ -230,14 +230,14 @@ class PlayerTab(SettingsTab):
|
|||||||
for key, player in self.media_players.items():
|
for key, player in self.media_players.items():
|
||||||
player = self.media_players[key]
|
player = self.media_players[key]
|
||||||
checkbox = MediaQCheckBox(self.media_player_group_box)
|
checkbox = MediaQCheckBox(self.media_player_group_box)
|
||||||
checkbox.setEnabled(player[0].available)
|
checkbox.setEnabled(player.available)
|
||||||
checkbox.setObjectName(player[0].name + '_check_box')
|
checkbox.setObjectName(player.name + '_check_box')
|
||||||
checkbox.setToolTip(player[0].get_info())
|
checkbox.setToolTip(player.get_info())
|
||||||
checkbox.set_player_name(player[0].name)
|
checkbox.set_player_name(player.name)
|
||||||
self.player_check_boxes[player[0].name] = checkbox
|
self.player_check_boxes[player.name] = checkbox
|
||||||
checkbox.stateChanged.connect(self.on_player_check_box_changed)
|
checkbox.stateChanged.connect(self.on_player_check_box_changed)
|
||||||
self.media_player_layout.addWidget(checkbox)
|
self.media_player_layout.addWidget(checkbox)
|
||||||
if player[0].available and player[0].name in self.used_players:
|
if player.available and player.name in self.used_players:
|
||||||
checkbox.setChecked(True)
|
checkbox.setChecked(True)
|
||||||
else:
|
else:
|
||||||
checkbox.setChecked(False)
|
checkbox.setChecked(False)
|
||||||
@ -250,13 +250,13 @@ class PlayerTab(SettingsTab):
|
|||||||
"""
|
"""
|
||||||
for key in self.media_players and self.player_check_boxes:
|
for key in self.media_players and self.player_check_boxes:
|
||||||
player = self.media_players[key]
|
player = self.media_players[key]
|
||||||
checkbox = self.player_check_boxes[player[0].name]
|
checkbox = self.player_check_boxes[player.name]
|
||||||
checkbox.set_player_name(player[0].name)
|
checkbox.set_player_name(player.name)
|
||||||
if player[0].available:
|
if player.available:
|
||||||
checkbox.setText(player[0].display_name)
|
checkbox.setText(player.display_name)
|
||||||
else:
|
else:
|
||||||
checkbox_text = translate('OpenLP.PlayerTab', '%s (unavailable)') % player[0].display_name
|
checkbox_text = translate('OpenLP.PlayerTab', '%s (unavailable)') % player.display_name
|
||||||
if player[0].name == 'vlc':
|
if player.name == 'vlc':
|
||||||
checkbox_text += ' ' + translate('OpenLP.PlayerTab',
|
checkbox_text += ' ' + translate('OpenLP.PlayerTab',
|
||||||
'NOTE: To use VLC you must install the %s version',
|
'NOTE: To use VLC you must install the %s version',
|
||||||
'Will insert "32bit" or "64bit"') % platform.architecture()[0]
|
'Will insert "32bit" or "64bit"') % platform.architecture()[0]
|
||||||
|
@ -30,7 +30,7 @@ from openlp.core.common import Registry, RegistryProperties, AppLocation, Settin
|
|||||||
from openlp.core.lib import ItemCapabilities, MediaManagerItem, MediaType, ServiceItem, ServiceItemContext, \
|
from openlp.core.lib import ItemCapabilities, MediaManagerItem, MediaType, ServiceItem, ServiceItemContext, \
|
||||||
build_icon, check_item_selected
|
build_icon, check_item_selected
|
||||||
from openlp.core.lib.ui import create_widget_action, critical_error_message_box, create_horizontal_adjusting_combo_box
|
from openlp.core.lib.ui import create_widget_action, critical_error_message_box, create_horizontal_adjusting_combo_box
|
||||||
from openlp.core.ui import DisplayControllerType
|
from openlp.core.ui import DisplayController, DisplayControllerType
|
||||||
from openlp.core.ui.media import get_media_players, set_media_players, parse_optical_path, format_milliseconds
|
from openlp.core.ui.media import get_media_players, set_media_players, parse_optical_path, format_milliseconds
|
||||||
from openlp.core.utils import get_locale_key
|
from openlp.core.utils import get_locale_key
|
||||||
from openlp.core.ui.media.vlcplayer import get_vlc
|
from openlp.core.ui.media.vlcplayer import get_vlc
|
||||||
@ -81,6 +81,7 @@ class MediaMediaItem(MediaManagerItem, RegistryProperties):
|
|||||||
# self.display_controller = DisplayController(self.parent())
|
# self.display_controller = DisplayController(self.parent())
|
||||||
Registry().register_function('video_background_replaced', self.video_background_replaced)
|
Registry().register_function('video_background_replaced', self.video_background_replaced)
|
||||||
Registry().register_function('mediaitem_media_rebuild', self.rebuild_players)
|
Registry().register_function('mediaitem_media_rebuild', self.rebuild_players)
|
||||||
|
# Registry().register_function('config_screen_changed', self.display_setup)
|
||||||
# Allow DnD from the desktop
|
# Allow DnD from the desktop
|
||||||
self.list_view.activateDnD()
|
self.list_view.activateDnD()
|
||||||
|
|
||||||
@ -281,6 +282,7 @@ class MediaMediaItem(MediaManagerItem, RegistryProperties):
|
|||||||
service_item.title = name
|
service_item.title = name
|
||||||
service_item.processor = self.display_type_combo_box.currentText()
|
service_item.processor = self.display_type_combo_box.currentText()
|
||||||
service_item.add_from_command(path, name, CLAPPERBOARD)
|
service_item.add_from_command(path, name, CLAPPERBOARD)
|
||||||
|
# Only get start and end times if going to a service
|
||||||
if not self.media_controller.media_length(service_item):
|
if not self.media_controller.media_length(service_item):
|
||||||
return False
|
return False
|
||||||
service_item.add_capability(ItemCapabilities.CanAutoStartForLive)
|
service_item.add_capability(ItemCapabilities.CanAutoStartForLive)
|
||||||
@ -288,7 +290,7 @@ class MediaMediaItem(MediaManagerItem, RegistryProperties):
|
|||||||
service_item.add_capability(ItemCapabilities.RequiresMedia)
|
service_item.add_capability(ItemCapabilities.RequiresMedia)
|
||||||
if Settings().value(self.settings_section + '/media auto start') == QtCore.Qt.Checked:
|
if Settings().value(self.settings_section + '/media auto start') == QtCore.Qt.Checked:
|
||||||
service_item.will_auto_start = True
|
service_item.will_auto_start = True
|
||||||
# force a non-existent theme
|
# force a non-existent theme
|
||||||
service_item.theme = -1
|
service_item.theme = -1
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@ -311,6 +313,13 @@ class MediaMediaItem(MediaManagerItem, RegistryProperties):
|
|||||||
' '.join(self.media_controller.video_extensions_list),
|
' '.join(self.media_controller.video_extensions_list),
|
||||||
' '.join(self.media_controller.audio_extensions_list), UiStrings().AllFiles)
|
' '.join(self.media_controller.audio_extensions_list), UiStrings().AllFiles)
|
||||||
|
|
||||||
|
def display_setup(self):
|
||||||
|
"""
|
||||||
|
Setup media controller display.
|
||||||
|
"""
|
||||||
|
# self.media_controller.setup_display(self.display_controller.preview_display, False)
|
||||||
|
pass
|
||||||
|
|
||||||
def populate_display_types(self):
|
def populate_display_types(self):
|
||||||
"""
|
"""
|
||||||
Load the combobox with the enabled media players, allowing user to select a specific player if settings allow.
|
Load the combobox with the enabled media players, allowing user to select a specific player if settings allow.
|
||||||
@ -323,7 +332,7 @@ class MediaMediaItem(MediaManagerItem, RegistryProperties):
|
|||||||
current_index = 0
|
current_index = 0
|
||||||
for player in used_players:
|
for player in used_players:
|
||||||
# load the drop down selection
|
# load the drop down selection
|
||||||
self.display_type_combo_box.addItem(media_players[player][0].original_name)
|
self.display_type_combo_box.addItem(media_players[player].original_name)
|
||||||
if override_player == player:
|
if override_player == player:
|
||||||
current_index = len(self.display_type_combo_box)
|
current_index = len(self.display_type_combo_box)
|
||||||
if self.display_type_combo_box.count() > 1:
|
if self.display_type_combo_box.count() > 1:
|
||||||
@ -385,16 +394,16 @@ class MediaMediaItem(MediaManagerItem, RegistryProperties):
|
|||||||
if item_name:
|
if item_name:
|
||||||
self.list_view.addItem(item_name)
|
self.list_view.addItem(item_name)
|
||||||
|
|
||||||
def get_list(self, media_type=MediaType.Audio):
|
def get_list(self, type=MediaType.Audio):
|
||||||
"""
|
"""
|
||||||
Get the list of media, optional select media type.
|
Get the list of media, optional select media type.
|
||||||
|
|
||||||
:param media_type: Type to get, defaults to audio.
|
:param type: Type to get, defaults to audio.
|
||||||
:return: The media list
|
:return: The media list
|
||||||
"""
|
"""
|
||||||
media = Settings().value(self.settings_section + '/media files')
|
media = Settings().value(self.settings_section + '/media files')
|
||||||
media.sort(key=lambda filename: get_locale_key(os.path.split(str(filename))[1]))
|
media.sort(key=lambda filename: get_locale_key(os.path.split(str(filename))[1]))
|
||||||
if media_type == MediaType.Audio:
|
if type == MediaType.Audio:
|
||||||
extension = self.media_controller.audio_extensions_list
|
extension = self.media_controller.audio_extensions_list
|
||||||
else:
|
else:
|
||||||
extension = self.media_controller.video_extensions_list
|
extension = self.media_controller.video_extensions_list
|
||||||
|
Loading…
Reference in New Issue
Block a user