Head and review comments

This commit is contained in:
Tim Bentley 2016-04-13 19:38:49 +01:00
commit 19d120de1b
6 changed files with 14 additions and 15 deletions

View File

@ -61,12 +61,12 @@ class MediaInfo(object):
file_info = None file_info = None
volume = 100 volume = 100
is_background = False is_background = False
loop_playback = False can_loop_playback = False
length = 0 length = 0
start_time = 0 start_time = 0
end_time = 0 end_time = 0
title_track = 0 title_track = 0
playing = False is_playing = False
timer = 1000 timer = 1000
audio_track = 0 audio_track = 0
subtitle_track = 0 subtitle_track = 0

View File

@ -215,7 +215,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
else: else:
self.live_timer.stop() self.live_timer.stop()
self.media_stop(self.display_controllers[DisplayControllerType.Live]) self.media_stop(self.display_controllers[DisplayControllerType.Live])
if self.display_controllers[DisplayControllerType.Live].media_info.loop_playback: if self.display_controllers[DisplayControllerType.Live].media_info.can_loop_playback:
self.media_play(self.display_controllers[DisplayControllerType.Live], True) self.media_play(self.display_controllers[DisplayControllerType.Live], True)
def media_state_preview(self): def media_state_preview(self):
@ -232,7 +232,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
else: else:
self.preview_timer.stop() self.preview_timer.stop()
self.media_stop(self.display_controllers[DisplayControllerType.Preview]) self.media_stop(self.display_controllers[DisplayControllerType.Preview])
if self.display_controllers[DisplayControllerType.Preview].media_info.loop_playback: if self.display_controllers[DisplayControllerType.Preview].media_info.can_loop_playback:
self.media_play(self.display_controllers[DisplayControllerType.Preview], True) self.media_play(self.display_controllers[DisplayControllerType.Preview], True)
def get_media_display_css(self): def get_media_display_css(self):
@ -394,7 +394,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
controller.media_info.volume = controller.volume_slider.value() controller.media_info.volume = controller.volume_slider.value()
controller.media_info.is_background = video_behind_text controller.media_info.is_background = video_behind_text
# background will always loop video. # background will always loop video.
controller.media_info.loop_playback = video_behind_text controller.media_info.can_loop_playback = video_behind_text
controller.media_info.file_info = QtCore.QFileInfo(service_item.get_frame_path()) controller.media_info.file_info = QtCore.QFileInfo(service_item.get_frame_path())
display = self._define_display(controller) display = self._define_display(controller)
if controller.is_live: if controller.is_live:
@ -654,7 +654,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
self.preview_timer.start() self.preview_timer.start()
controller.seek_slider.blockSignals(False) controller.seek_slider.blockSignals(False)
controller.volume_slider.blockSignals(False) controller.volume_slider.blockSignals(False)
controller.media_info.playing = True controller.media_info.is_playing = True
display = self._define_display(controller) display = self._define_display(controller)
display.setVisible(True) display.setVisible(True)
return True return True
@ -666,10 +666,10 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
:param controller: The Controller to be processed :param controller: The Controller to be processed
""" """
start_again = False start_again = False
if controller.media_info.playing and controller.media_info.length > 0: if controller.media_info.is_playing and controller.media_info.length > 0:
if controller.media_info.timer > controller.media_info.length: if controller.media_info.timer > controller.media_info.length:
self.media_stop(controller, True) self.media_stop(controller, True)
if controller.media_info.loop_playback: if controller.media_info.can_loop_playback:
start_again = True start_again = True
controller.media_info.timer += TICK_TIME controller.media_info.timer += TICK_TIME
seconds = controller.media_info.timer // 1000 seconds = controller.media_info.timer // 1000
@ -703,7 +703,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
controller.mediabar.actions['playbackPlay'].setVisible(True) controller.mediabar.actions['playbackPlay'].setVisible(True)
controller.mediabar.actions['playbackStop'].setDisabled(False) controller.mediabar.actions['playbackStop'].setDisabled(False)
controller.mediabar.actions['playbackPause'].setVisible(False) controller.mediabar.actions['playbackPause'].setVisible(False)
controller.media_info.playing = False controller.media_info.is_playing = False
def media_loop_msg(self, msg): def media_loop_msg(self, msg):
""" """
@ -720,8 +720,8 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
:param controller: The controller that needs to be stopped :param controller: The controller that needs to be stopped
""" """
controller.media_info.loop_playback = not controller.media_info.loop_playback controller.media_info.can_loop_playback = not controller.media_info.can_loop_playback
controller.mediabar.actions['playbackLoop'].setChecked(controller.media_info.loop_playback) controller.mediabar.actions['playbackLoop'].setChecked(controller.media_info.can_loop_playback)
def media_stop_msg(self, msg): def media_stop_msg(self, msg):
""" """
@ -748,7 +748,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
controller.mediabar.actions['playbackPlay'].setVisible(True) controller.mediabar.actions['playbackPlay'].setVisible(True)
controller.mediabar.actions['playbackStop'].setDisabled(True) controller.mediabar.actions['playbackStop'].setDisabled(True)
controller.mediabar.actions['playbackPause'].setVisible(False) controller.mediabar.actions['playbackPause'].setVisible(False)
controller.media_info.playing = False controller.media_info.is_playing = False
controller.media_info.timer = 1000 controller.media_info.timer = 1000
controller.media_timer = 0 controller.media_timer = 0

View File

@ -195,7 +195,7 @@ class ImageMediaItem(MediaManagerItem):
Add custom buttons to the end of the toolbar Add custom buttons to the end of the toolbar
""" """
self.replace_action = self.toolbar.add_toolbar_action('replace_action', self.replace_action = self.toolbar.add_toolbar_action('replace_action',
icon=':/slides/slide_blank.png', icon=':/slides/slide_theme.png',
triggers=self.on_replace_click) triggers=self.on_replace_click)
self.reset_action = self.toolbar.add_toolbar_action('reset_action', self.reset_action = self.toolbar.add_toolbar_action('reset_action',
icon=':/system/system_close.png', icon=':/system/system_close.png',

View File

@ -146,7 +146,7 @@ class MediaMediaItem(MediaManagerItem, RegistryProperties):
Adds buttons to the end of the header bar. Adds buttons to the end of the header bar.
""" """
# Replace backgrounds do not work at present so remove functionality. # Replace backgrounds do not work at present so remove functionality.
self.replace_action = self.toolbar.add_toolbar_action('replace_action', icon=':/slides/slide_blank.png', self.replace_action = self.toolbar.add_toolbar_action('replace_action', icon=':/slides/slide_theme.png',
triggers=self.on_replace_click) triggers=self.on_replace_click)
if 'webkit' not in get_media_players()[0]: if 'webkit' not in get_media_players()[0]:
self.replace_action.setDisabled(True) self.replace_action.setDisabled(True)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 815 B

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -54,7 +54,6 @@ class MediaPluginTest(TestCase, TestMixin):
media_plugin.initialise() media_plugin.initialise()
# THEN: The settings should be upgraded and the base initialise() method should be called # THEN: The settings should be upgraded and the base initialise() method should be called
# mocked_settings.get_files_from_config.assert_called_with(media_plugin)
mocked_settings.setValue.assert_called_with('media/media files', True) mocked_settings.setValue.assert_called_with('media/media files', True)
mocked_initialise.assert_called_with() mocked_initialise.assert_called_with()