openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #33807
[Merge] lp:~trb143/openlp/more_media into lp:openlp
Tim Bentley has proposed merging lp:~trb143/openlp/more_media into lp:openlp.
Commit message:
Media plays successfully and cleanups.
Added VLC additions
Requested reviews:
OpenLP Core (openlp-core)
For more details, see:
https://code.launchpad.net/~trb143/openlp/more_media/+merge/366336
Media now plays, stops, seeks and repeats.
Media Tab now works but needs more love.
VLC addtitions is now added and usable.
Experimental flag added to UI. Set this and it may go bang. You will need to edit settings manually to release this!
Add code (provided by tgc and superfly) to get media components. Works fine outside OpenLP but takes out OpenLP on Fedora 30. Activate by using experimental and restart.
Fixed the imagemanager bug on saving themes. Now works except preview image is black!
Removed many bits of commented out code.
--
Your team OpenLP Core is requested to review the proposed merge of lp:~trb143/openlp/more_media into lp:openlp.
=== modified file 'openlp/core/common/settings.py'
--- openlp/core/common/settings.py 2019-04-09 17:21:35 +0000
+++ openlp/core/common/settings.py 2019-04-21 12:51:38 +0000
@@ -213,6 +213,7 @@
'images/background color': '#000000',
'media/media auto start': QtCore.Qt.Unchecked,
'media/stream command': '',
+ 'media/vlc additions': '',
'remotes/download version': '0.0',
'players/background color': '#000000',
'servicemanager/last directory': None,
=== modified file 'openlp/core/ui/__init__.py'
--- openlp/core/ui/__init__.py 2019-02-14 15:09:09 +0000
+++ openlp/core/ui/__init__.py 2019-04-21 12:51:38 +0000
@@ -93,4 +93,4 @@
self.resizeRowsToContents()
-__all__ = ['SingleColumnTableWidget']
+__all__ = ['SingleColumnTableWidget', 'DisplayControllerType']
=== modified file 'openlp/core/ui/generaltab.py'
--- openlp/core/ui/generaltab.py 2019-03-16 10:20:46 +0000
+++ openlp/core/ui/generaltab.py 2019-04-21 12:51:38 +0000
@@ -113,6 +113,9 @@
self.check_for_updates_check_box = QtWidgets.QCheckBox(self.startup_group_box)
self.check_for_updates_check_box.setObjectName('check_for_updates_check_box')
self.startup_layout.addWidget(self.check_for_updates_check_box)
+ self.experimental_check_box = QtWidgets.QCheckBox(self.startup_group_box)
+ self.experimental_check_box.setObjectName('experimental_check_box')
+ self.startup_layout.addWidget(self.experimental_check_box)
self.right_layout.addWidget(self.startup_group_box)
# Logo
self.logo_group_box = QtWidgets.QGroupBox(self.right_column)
@@ -180,6 +183,8 @@
self.logo_file_label.setText(translate('OpenLP.GeneralTab', 'Logo file:'))
self.logo_hide_on_startup_check_box.setText(translate('OpenLP.GeneralTab', 'Don\'t show logo on startup'))
self.check_for_updates_check_box.setText(translate('OpenLP.GeneralTab', 'Check for updates to OpenLP'))
+ self.experimental_check_box.setText(translate('OpenLP.GeneralTab',
+ 'Experimental features (use at your own risk)'))
self.settings_group_box.setTitle(translate('OpenLP.GeneralTab', 'Application Settings'))
self.save_check_service_check_box.setText(translate('OpenLP.GeneralTab',
'Prompt to save before starting a new service'))
@@ -222,6 +227,7 @@
self.logo_hide_on_startup_check_box.setChecked(settings.value('logo hide on startup'))
self.logo_color_button.color = self.logo_background_color
self.check_for_updates_check_box.setChecked(settings.value('update check'))
+ self.experimental_check_box.setChecked(settings.value('experimental'))
self.auto_preview_check_box.setChecked(settings.value('auto preview'))
self.timeout_spin_box.setValue(settings.value('loop delay'))
self.start_paused_check_box.setChecked(settings.value('audio start paused'))
@@ -241,6 +247,7 @@
settings.setValue('logo file', self.logo_file_path_edit.path)
settings.setValue('logo hide on startup', self.logo_hide_on_startup_check_box.isChecked())
settings.setValue('update check', self.check_for_updates_check_box.isChecked())
+ settings.setValue('experimental', self.experimental_check_box.isChecked())
settings.setValue('save prompt', self.save_check_service_check_box.isChecked())
settings.setValue('auto unblank', self.auto_unblank_check_box.isChecked())
settings.setValue('click live slide to unblank', self.click_live_slide_to_unblank_check_box.isChecked())
=== modified file 'openlp/core/ui/media/mediacontroller.py'
--- openlp/core/ui/media/mediacontroller.py 2019-04-12 16:37:45 +0000
+++ openlp/core/ui/media/mediacontroller.py 2019-04-21 12:51:38 +0000
@@ -20,8 +20,7 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
"""
-The :mod:`~openlp.core.ui.media.mediacontroller` module contains a base class for media components and other widgets
-related to playing media, such as sliders.
+The :mod:`~openlp.core.ui.media.mediacontroller` module is the control module for all media playing.
"""
import logging
@@ -124,14 +123,14 @@
"""
self.setup()
self.vlc_player = VlcPlayer(self)
- State().add_service("mediacontroller", 0)
- State().add_service("media_live", 0, requires="mediacontroller")
+ State().add_service('mediacontroller', 0)
+ State().add_service('media_live', 0)
if get_vlc() and pymediainfo_available:
- State().update_pre_conditions("mediacontroller", True)
+ State().update_pre_conditions('mediacontroller', True)
State().update_pre_conditions('media_live', True)
else:
- State().missing_text("mediacontroller", translate('OpenLP.SlideController',
- "VLC or pymediainfo are missing, so you are unable to play any media"))
+ State().missing_text('media_live', translate('OpenLP.SlideController',
+ 'VLC or pymediainfo are missing, so you are unable to play any media'))
self._generate_extensions_lists()
return True
@@ -144,6 +143,8 @@
self.setup_display(self.live_controller.display, False)
except AttributeError:
State().update_pre_conditions('media_live', False)
+ State().missing_text('media_live', translate('OpenLP.SlideController',
+ 'No Displays configure so Live Media has been disabled'))
self.setup_display(self.preview_controller.preview_display, True)
def display_controllers(self, controller_type):
@@ -215,9 +216,6 @@
"""
# Generic controls
controller.mediabar.setVisible(value)
- # if controller.is_live and controller.display:
- # if self.current_media_players and value:
- # controller.display.set_transparency(False)
@staticmethod
def resize(display, player):
@@ -563,8 +561,7 @@
total_seconds = controller.media_info.length // 1000
total_minutes = total_seconds // 60
total_seconds %= 60
- controller.position_label.setText(' %02d:%02d / %02d:%02d' %
- (0, 0, total_minutes, total_seconds))
+ controller.position_label.setText(' %02d:%02d / %02d:%02d' % (0, 0, total_minutes, total_seconds))
controller.mediabar.actions['playbackPlay'].setVisible(True)
controller.mediabar.actions['playbackStop'].setDisabled(True)
controller.mediabar.actions['playbackPause'].setVisible(False)
=== modified file 'openlp/core/ui/media/mediaplayer.py'
--- openlp/core/ui/media/mediaplayer.py 2019-03-24 07:53:19 +0000
+++ openlp/core/ui/media/mediaplayer.py 2019-04-21 12:51:38 +0000
@@ -139,11 +139,12 @@
"""
pass
- def update_ui(self, display):
+ def update_ui(self, controller, output_display):
"""
Do some ui related stuff (e.g. update the seek slider)
- :param display: The display to be updated.
+ :param controller: Which Controller is running the show.
+ :param output_display: The display where the media is
"""
pass
=== modified file 'openlp/core/ui/media/mediatab.py'
--- openlp/core/ui/media/mediatab.py 2019-04-09 17:32:10 +0000
+++ openlp/core/ui/media/mediatab.py 2019-04-21 12:51:38 +0000
@@ -20,11 +20,11 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
"""
-The :mod:`~openlp.core.ui.media.playertab` module holds the configuration tab for the media stuff.
+The :mod:`~openlp.core.ui.media.mediatab` module holds the configuration tab for the media stuff.
"""
from PyQt5 import QtWidgets
-# from PyQt5.QtMultimedia import QCameraInfo, QAudioDeviceInfo, QAudio
+from PyQt5.QtMultimedia import QCameraInfo, QAudioDeviceInfo, QAudio
from openlp.core.common import is_linux, is_win
from openlp.core.common.i18n import translate
@@ -32,8 +32,9 @@
from openlp.core.lib.settingstab import SettingsTab
from openlp.core.ui.icons import UiIcons
-LINUX_STREAM = 'v4l2:///dev/video0'
-WIN_STREAM = 'dshow:// :dshow-vdev='
+LINUX_STREAM = 'v4l2://{video} :v4l2-standard= :input-slave={audio} :live-caching=300'
+WIN_STREAM = 'dshow://:dshow-vdev={video} :dshow-adev={audio} :live-caching=300'
+OSX_STREAM = 'avcapture://{video} :qtsound://{audio} :live-caching=300'
class MediaTab(SettingsTab):
@@ -44,8 +45,6 @@
"""
Constructor
"""
- # self.media_players = Registry().get('media_controller').media_players
- # self.saved_used_players = None
self.icon_path = UiIcons().video
player_translated = translate('OpenLP.MediaTab', 'Media')
super(MediaTab, self).__init__(parent, 'Media', player_translated)
@@ -67,7 +66,7 @@
self.stream_media_group_box = QtWidgets.QGroupBox(self.left_column)
self.stream_media_group_box.setObjectName('stream_media_group_box')
self.stream_media_layout = QtWidgets.QHBoxLayout(self.stream_media_group_box)
- self.stream_media_layout.setObjectName('live_media_layout')
+ self.stream_media_layout.setObjectName('stream_media_layout')
self.stream_media_layout.setContentsMargins(0, 0, 0, 0)
self.stream_edit = QtWidgets.QPlainTextEdit(self)
self.stream_media_layout.addWidget(self.stream_edit)
@@ -75,19 +74,28 @@
self.browse_button.setIcon(UiIcons().undo)
self.stream_media_layout.addWidget(self.browse_button)
self.left_layout.addWidget(self.stream_media_group_box)
- self.left_layout.addWidget(self.stream_media_group_box)
+ self.vlc_additions_group_box = QtWidgets.QGroupBox(self.left_column)
+ self.vlc_additions_group_box.setObjectName('vlc_additions_group_box')
+ self.vlc_additions_layout = QtWidgets.QHBoxLayout(self.vlc_additions_group_box)
+ self.vlc_additions_layout.setObjectName('vlc_additions_layout')
+ self.vlc_additions_layout.setContentsMargins(0, 0, 0, 0)
+ self.vlc_additions_edit = QtWidgets.QPlainTextEdit(self)
+ self.vlc_additions_layout.addWidget(self.vlc_additions_edit)
+ self.vlc_additions_layout.addWidget(self.browse_button)
+ self.left_layout.addWidget(self.vlc_additions_group_box)
self.left_layout.addStretch()
self.right_layout.addStretch()
# # Signals and slots
self.browse_button.clicked.connect(self.on_revert)
- def retranslateUi(self):
+ def retranslate_ui(self):
"""
Translate the UI on the fly
"""
self.live_media_group_box.setTitle(translate('MediaPlugin.MediaTab', 'Live Media'))
self.stream_media_group_box.setTitle(translate('MediaPlugin.MediaTab', 'Stream Media Command'))
- self.auto_start_check_box.setText(translate('MediaPlugin.MediaTab', 'Start automatically'))
+ self.vlc_additions_group_box.setTitle(translate('MediaPlugin.MediaTab', 'VLC additional commands'))
+ self.auto_start_check_box.setText(translate('MediaPlugin.MediaTab', 'Start Live items automatically'))
def load(self):
"""
@@ -100,6 +108,20 @@
self.stream_edit.setPlainText(LINUX_STREAM)
elif is_win:
self.stream_edit.setPlainText(WIN_STREAM)
+ else:
+ self.stream_edit.setPlainText(OSX_STREAM)
+ self.vlc_additions_edit.setPlainText(Settings().value(self.settings_section + '/vlc additions'))
+ if Settings().value('core/experimental'):
+ print('Video input:')
+ for cam in QCameraInfo.availableCameras():
+ print('===============')
+ print(cam.deviceName())
+ print(cam.description())
+ print()
+ print('Audio input:')
+ for au in QAudioDeviceInfo.availableDevices(QAudio.AudioInput):
+ print('===============')
+ print(au.deviceName())
def save(self):
"""
@@ -108,17 +130,8 @@
setting_key = self.settings_section + '/media auto start'
if Settings().value(setting_key) != self.auto_start_check_box.checkState():
Settings().setValue(setting_key, self.auto_start_check_box.checkState())
- # settings = Settings()
- # settings.beginGroup(self.settings_section)
- # settings.setValue('background color', self.background_color)
- # settings.endGroup()
- # old_players, override_player = get_media_players()
- # if self.used_players != old_players:
- # # clean old Media stuff
- # set_media_players(self.used_players, override_player)
- # self.settings_form.register_post_process('mediaitem_suffix_reset')
- # self.settings_form.register_post_process('mediaitem_media_rebuild')
- # self.settings_form.register_post_process('config_screen_changed')
+ Settings().setValue(self.settings_section + '/stream command', self.stream_edit.toPlainText())
+ Settings().setValue(self.settings_section + '/vlc additions', self.vlc_additions_edit.toPlainText())
def post_set_up(self, post_update=False):
"""
@@ -127,22 +140,6 @@
:param post_update: Indicates if called before or after updates.
"""
pass
- # for key, player in self.media_players.items():
- # player = self.media_players[key]
- # checkbox = MediaQCheckBox(self.media_player_group_box)
- # checkbox.setEnabled(player.available)
- # checkbox.setObjectName(player.name + '_check_box')
- # checkbox.setToolTip(player.get_info())
- # checkbox.set_player_name(player.name)
- # self.player_check_boxes[player.name] = checkbox
- # checkbox.stateChanged.connect(self.on_player_check_box_changed)
- # self.media_player_layout.addWidget(checkbox)
- # if player.available and player.name in self.used_players:
- # checkbox.setChecked(True)
- # else:
- # checkbox.setChecked(False)
- # self.update_player_list()
- # self.retranslate_players()
def on_revert(self):
pass
=== modified file 'openlp/core/ui/media/vlcplayer.py'
--- openlp/core/ui/media/vlcplayer.py 2019-04-08 17:19:18 +0000
+++ openlp/core/ui/media/vlcplayer.py 2019-04-21 12:51:38 +0000
@@ -164,9 +164,11 @@
output_display.vlc_widget = QtWidgets.QFrame(output_display)
output_display.vlc_widget.setFrameStyle(QtWidgets.QFrame.NoFrame)
# creating a basic vlc instance
- command_line_options = '--no-video-title-show'
+ command_line_options = '--no-video-title-show '
if Settings().value('advanced/hide mouse') and live_display:
- command_line_options += ' --mouse-hide-timeout=0'
+ command_line_options += '--mouse-hide-timeout=0 '
+ if Settings().value('media/vlc additions'):
+ command_line_options += Settings().value('media/vlc additions')
output_display.vlc_instance = vlc.Instance(command_line_options)
# creating an empty vlc media player
output_display.vlc_media_player = output_display.vlc_instance.media_player_new()
@@ -224,7 +226,8 @@
return False
output_display.vlc_media = audio_cd_tracks.item_at_index(controller.media_info.title_track)
elif controller.media_info.media_type == MediaType.Stream:
- output_display.vlc_media = output_display.vlc_instance.media_new_location('ZZZZZZ')
+ stream_cmd = Settings().value('media/stream command')
+ output_display.vlc_media = output_display.vlc_instance.media_new_location(stream_cmd)
else:
output_display.vlc_media = output_display.vlc_instance.media_new_path(path)
# put the media in the media player
@@ -240,7 +243,7 @@
Wait no longer than 60 seconds. (loading an iso file needs a long time)
:param media_state: The state of the playing media
- :param display: The display where the media is
+ :param output_display: The display where the media is
:return:
"""
vlc = get_vlc()
@@ -314,7 +317,7 @@
self.volume(output_display, output_display.media_info.volume)
if start_time > 0 and output_display.vlc_media_player.is_seekable():
output_display.vlc_media_player.set_time(int(start_time))
- controller.seek_slider.setMaximum(output_display.media_info.length)
+ controller.seek_slider.setMaximum(controller.media_info.length)
self.set_state(MediaState.Playing, output_display)
output_display.vlc_widget.raise_()
return True
@@ -361,9 +364,9 @@
:param seek_value: The position of where a seek goes to
:param output_display: The display where the media is
"""
- if output_display.controller.media_info.media_type == MediaType.CD \
- or output_display.controller.media_info.media_type == MediaType.DVD:
- seek_value += int(output_display.controller.media_info.start_time)
+ if output_display.media_info.media_type == MediaType.CD \
+ or output_display.media_info.media_type == MediaType.DVD:
+ seek_value += int(output_display.media_info.start_time)
if output_display.vlc_media_player.is_seekable():
output_display.vlc_media_player.set_time(seek_value)
=== modified file 'openlp/core/ui/settingsform.py'
--- openlp/core/ui/settingsform.py 2019-04-09 17:21:35 +0000
+++ openlp/core/ui/settingsform.py 2019-04-21 12:51:38 +0000
@@ -30,7 +30,6 @@
from openlp.core.api.tab import ApiTab
from openlp.core.common.mixins import RegistryProperties
from openlp.core.common.registry import Registry
-from openlp.core.common.settings import Settings
from openlp.core.lib import build_icon
from openlp.core.projectors.tab import ProjectorTab
from openlp.core.ui.advancedtab import AdvancedTab
@@ -61,6 +60,7 @@
self.setting_list_widget.currentRowChanged.connect(self.list_item_changed)
self.general_tab = None
self.themes_tab = None
+ self.player_tab = None
self.projector_tab = None
self.advanced_tab = None
self.api_tab = None
@@ -79,8 +79,7 @@
self.insert_tab(self.advanced_tab)
self.insert_tab(self.screens_tab)
self.insert_tab(self.themes_tab)
- if Settings().value('core/experimental'):
- self.insert_tab(self.player_tab)
+ self.insert_tab(self.player_tab)
self.insert_tab(self.projector_tab)
self.insert_tab(self.api_tab)
for plugin in State().list_plugins():
@@ -161,8 +160,7 @@
self.themes_tab = ThemesTab(self)
self.projector_tab = ProjectorTab(self)
self.advanced_tab = AdvancedTab(self)
- if Settings().value('core/experimental'):
- self.player_tab = MediaTab(self)
+ self.player_tab = MediaTab(self)
self.api_tab = ApiTab(self)
self.screens_tab = ScreensTab(self)
except Exception as e:
@@ -170,8 +168,7 @@
self.general_tab.post_set_up()
self.themes_tab.post_set_up()
self.advanced_tab.post_set_up()
- if Settings().value('core/experimental'):
- self.player_tab.post_set_up()
+ self.player_tab.post_set_up()
self.api_tab.post_set_up()
for plugin in State().list_plugins():
if plugin.settings_tab:
=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py 2019-03-24 07:53:19 +0000
+++ openlp/core/ui/slidecontroller.py 2019-04-21 12:51:38 +0000
@@ -112,7 +112,7 @@
class InfoLabel(QtWidgets.QLabel):
"""
- InfoLabel is a subclassed QLabel. Created to provide the ablilty to add a ellipsis if the text is cut off. Original
+ InfoLabel is a subclassed QLabel. Created to provide the ability to add a ellipsis if the text is cut off. Original
source: https://stackoverflow.com/questions/11446478/pyside-pyqt-truncate-text-in-qlabel-based-on-minimumsize
"""
@@ -177,7 +177,6 @@
if screen.is_display:
display = DisplayWindow(self, screen)
self.displays.append(display)
- # display.media_watcher.progress.connect(self.on_audio_time_remaining)
@property
def display(self):
@@ -381,7 +380,7 @@
self.position_label.setMinimumSize(90, 0)
self.position_label.setObjectName('position_label')
self.mediabar.add_toolbar_widget(self.position_label)
- # Build the seek_slider.
+ # Build the media seek_slider.
self.seek_slider = MediaSlider(QtCore.Qt.Horizontal, self, self)
self.seek_slider.setMaximum(1000)
self.seek_slider.setTracking(True)
@@ -398,7 +397,6 @@
self.volume_slider.setMaximum(100)
self.volume_slider.setTracking(True)
self.volume_slider.setToolTip(translate('OpenLP.SlideController', 'Audio Volume.'))
- # self.volume_slider.setValue(self.media_info.volume)
self.volume_slider.setGeometry(QtCore.QRect(90, 160, 221, 24))
self.volume_slider.setObjectName('volume_slider')
self.mediabar.add_toolbar_widget(self.volume_slider)
=== modified file 'openlp/core/ui/thememanager.py'
--- openlp/core/ui/thememanager.py 2019-03-10 21:01:39 +0000
+++ openlp/core/ui/thememanager.py 2019-04-21 12:51:38 +0000
@@ -26,19 +26,18 @@
import zipfile
from xml.etree.ElementTree import XML, ElementTree
-from PyQt5 import QtCore, QtGui, QtWidgets
+from PyQt5 import QtCore, QtWidgets
from openlp.core.common import delete_file
from openlp.core.common.applocation import AppLocation
from openlp.core.common.i18n import UiStrings, get_locale_key, translate
from openlp.core.common.mixins import LogMixin, RegistryProperties
-from openlp.core.common.path import Path, copyfile, create_paths, path_to_str
+from openlp.core.common.path import Path, copyfile, create_paths
from openlp.core.common.registry import Registry, RegistryBase
from openlp.core.common.settings import Settings
-from openlp.core.lib import ImageSource, build_icon, check_item_selected, create_thumb, get_text_file_string, \
- validate_thumb
+from openlp.core.lib import build_icon, check_item_selected, create_thumb, get_text_file_string, validate_thumb
from openlp.core.lib.exceptions import ValidationError
-from openlp.core.lib.theme import BackgroundType, Theme
+from openlp.core.lib.theme import Theme
from openlp.core.lib.ui import create_widget_action, critical_error_message_box
from openlp.core.ui.filerenameform import FileRenameForm
from openlp.core.ui.icons import UiIcons
@@ -648,11 +647,6 @@
:rtype: None
"""
self._write_theme(theme, image_source_path, image_destination_path)
- if theme.background_type == BackgroundType.to_string(BackgroundType.Image):
- self.image_manager.update_image_border(path_to_str(theme.background_filename),
- ImageSource.Theme,
- QtGui.QColor(theme.background_border_color))
- self.image_manager.process_updates()
def _write_theme(self, theme, image_source_path=None, image_destination_path=None):
"""
=== modified file 'openlp/plugins/media/lib/mediaitem.py'
--- openlp/plugins/media/lib/mediaitem.py 2019-04-09 16:47:23 +0000
+++ openlp/plugins/media/lib/mediaitem.py 2019-04-21 12:51:38 +0000
@@ -93,16 +93,6 @@
to another language.
"""
self.on_new_prompt = translate('MediaPlugin.MediaItem', 'Select Media')
- # self.replace_action.setText(UiStrings().ReplaceBG)
- # self.replace_action_context.setText(UiStrings().ReplaceBG)
- # self.replace_action.setToolTip(UiStrings().ReplaceLiveBGDisabled)
- # self.replace_action_context.setToolTip(UiStrings().ReplaceLiveBGDisabled)
- # self.reset_action.setText(UiStrings().ResetBG)
- # self.reset_action.setToolTip(UiStrings().ResetLiveBG)
- # self.reset_action_context.setText(UiStrings().ResetBG)
- # self.reset_action_context.setToolTip(UiStrings().ResetLiveBG)
- # self.automatic = UiStrings().Automatic
- # self.display_type_label.setText(translate('MediaPlugin.MediaItem', 'Use Player:'))
def required_icons(self):
"""
@@ -117,7 +107,7 @@
self.can_make_live = False
self.can_add_to_service = False
if State().check_preconditions('media_live'):
- self.can_make_live = False
+ self.can_make_live = True
def add_list_view_to_toolbar(self):
"""
=== modified file 'tests/functional/openlp_core/ui/media/test_vlcplayer.py'
--- tests/functional/openlp_core/ui/media/test_vlcplayer.py 2019-03-27 18:59:03 +0000
+++ tests/functional/openlp_core/ui/media/test_vlcplayer.py 2019-04-21 12:51:38 +0000
@@ -126,7 +126,7 @@
mocked_is_macosx.return_value = False
mocked_is_win.return_value = False
mocked_settings = MagicMock()
- mocked_settings.value.return_value = True
+ mocked_settings.value.return_value = ''
MockedSettings.return_value = mocked_settings
mocked_qframe = MagicMock()
mocked_qframe.winId.return_value = 2
@@ -150,8 +150,9 @@
# THEN: The VLC widget should be set up correctly
assert mocked_output_display.vlc_widget == mocked_qframe
mocked_qframe.setFrameStyle.assert_called_with(1)
- mocked_settings.value.assert_called_with('advanced/hide mouse')
- mocked_vlc.Instance.assert_called_with('--no-video-title-show --mouse-hide-timeout=0')
+ mocked_settings.value.assert_any_call('advanced/hide mouse')
+ mocked_settings.value.assert_any_call('media/vlc additions')
+ mocked_vlc.Instance.assert_called_with('--no-video-title-show ')
assert mocked_output_display.vlc_instance == mocked_instance
mocked_instance.media_player_new.assert_called_with()
assert mocked_output_display.vlc_media_player == mocked_media_player_new
@@ -175,7 +176,7 @@
mocked_is_macosx.return_value = False
mocked_is_win.return_value = False
mocked_settings = MagicMock()
- mocked_settings.value.return_value = True
+ mocked_settings.value.return_value = ''
MockedSettings.return_value = mocked_settings
mocked_qframe = MagicMock()
mocked_qframe.winId.return_value = 2
@@ -197,7 +198,7 @@
vlc_player.setup(mocked_output_display, mocked_controller)
# THEN: The VLC instance should be created with the correct options
- mocked_vlc.Instance.assert_called_with('--no-video-title-show --mouse-hide-timeout=0')
+ mocked_vlc.Instance.assert_called_with('--no-video-title-show ')
@patch('openlp.core.ui.media.vlcplayer.is_win')
@patch('openlp.core.ui.media.vlcplayer.is_macosx')
@@ -213,7 +214,7 @@
mocked_is_macosx.return_value = False
mocked_is_win.return_value = False
mocked_settings = MagicMock()
- mocked_settings.value.return_value = False
+ mocked_settings.value.return_value = ''
MockedSettings.return_value = mocked_settings
mocked_qframe = MagicMock()
mocked_qframe.winId.return_value = 2
@@ -235,7 +236,7 @@
vlc_player.setup(mocked_output_display, mocked_controller)
# THEN: The VLC instance should be created with the correct options
- mocked_vlc.Instance.assert_called_with('--no-video-title-show')
+ mocked_vlc.Instance.assert_called_with('--no-video-title-show ')
@patch('openlp.core.ui.media.vlcplayer.is_win')
@patch('openlp.core.ui.media.vlcplayer.is_macosx')
@@ -863,7 +864,7 @@
# THEN: nothing should happen
mocked_display.vlc_media_player.is_seekable.assert_called_with()
- mocked_display.vlc_media_player.set_time.assert_called_with(5000)
+ mocked_display.vlc_media_player.set_time.assert_called_with(2000)
def test_reset(self):
"""
Follow ups