Clean up video api

This commit is contained in:
Tim Bentley 2012-10-25 21:33:28 +01:00
parent 34b4828c30
commit 90a3493d89
3 changed files with 9 additions and 14 deletions

View File

@ -350,20 +350,16 @@ class MediaController(object):
""" """
player.resize(display) player.resize(display)
def video(self, source, serviceItem, muted, isBackground, def video(self, source, serviceItem, hidden=False):
hidden=False):
""" """
Loads and starts a video to run with the option of sound Loads and starts a video to run with the option of sound
``source``
Where the call originated form
``serviceItem`` ``serviceItem``
The player which is doing the playing The player which is doing the playing
``muted``
The player which is doing the playing
``isBackground``
The player which is doing the playing
``hidden`` ``hidden``
The player which is doing the playing The player which is doing the playing
""" """
@ -373,13 +369,14 @@ class MediaController(object):
# stop running videos # stop running videos
self.media_reset(controller) self.media_reset(controller)
controller.media_info = MediaInfo() controller.media_info = MediaInfo()
if muted: if source == DisplayControllerType.Plugin:
controller.media_info.volume = 0 controller.media_info.volume = 0
controller.media_info.is_background = False
else: else:
controller.media_info.volume = controller.volumeSlider.value() controller.media_info.volume = controller.volumeSlider.value()
controller.media_info.is_background = True
controller.media_info.file_info = \ controller.media_info.file_info = \
QtCore.QFileInfo(serviceItem.get_filename()) QtCore.QFileInfo(serviceItem.get_filename())
controller.media_info.is_background = isBackground
display = None display = None
#self.curDisplayMediaPlayer[u'current'] = serviceItem.name #self.curDisplayMediaPlayer[u'current'] = serviceItem.name
if controller.isLive: if controller.isLive:

View File

@ -1355,8 +1355,7 @@ class SlideController(DisplayController):
Respond to the arrival of a media service item Respond to the arrival of a media service item
""" """
log.debug(u'SlideController onMediaStart') log.debug(u'SlideController onMediaStart')
self.mediaController.video(self.controllerType, item, False, False, \ self.mediaController.video(self.controllerType, item, self.hideMode())
self.hideMode())
if not self.isLive: if not self.isLive:
self.previewDisplay.show() self.previewDisplay.show()
self.slidePreview.hide() self.slidePreview.hide()

View File

@ -161,7 +161,6 @@ class MediaMediaItem(MediaManagerItem):
""" """
Called to replace Live background with the media selected. Called to replace Live background with the media selected.
""" """
# Todo fix me up
if check_item_selected(self.listView, if check_item_selected(self.listView,
translate('MediaPlugin.MediaItem', translate('MediaPlugin.MediaItem',
'You must select a media file to replace the background with.')): 'You must select a media file to replace the background with.')):
@ -175,7 +174,7 @@ class MediaMediaItem(MediaManagerItem):
(path, name) = os.path.split(filename) (path, name) = os.path.split(filename)
service_item.add_from_command(path, name,CLAPPERBOARD) service_item.add_from_command(path, name,CLAPPERBOARD)
if self.plugin.liveController.mediaController.video( if self.plugin.liveController.mediaController.video(
DisplayControllerType.Live, service_item, True, True): DisplayControllerType.Live, service_item):
self.resetAction.setVisible(True) self.resetAction.setVisible(True)
else: else:
critical_error_message_box(UiStrings().LiveBGError, critical_error_message_box(UiStrings().LiveBGError,