forked from openlp/openlp
Reference tidy up
This commit is contained in:
parent
a106244aba
commit
a1bd9013cb
@ -370,6 +370,8 @@ class MediaController(object):
|
|||||||
log.debug(u'video')
|
log.debug(u'video')
|
||||||
isValid = False
|
isValid = False
|
||||||
controller = self.displayControllers[source]
|
controller = self.displayControllers[source]
|
||||||
|
print "video"
|
||||||
|
print source, controller
|
||||||
# stop running videos
|
# stop running videos
|
||||||
self.media_reset(controller)
|
self.media_reset(controller)
|
||||||
controller.media_info = MediaInfo()
|
controller.media_info = MediaInfo()
|
||||||
@ -381,13 +383,9 @@ class MediaController(object):
|
|||||||
controller.media_info.is_background = False
|
controller.media_info.is_background = False
|
||||||
controller.media_info.file_info = \
|
controller.media_info.file_info = \
|
||||||
QtCore.QFileInfo(serviceItem.get_filename())
|
QtCore.QFileInfo(serviceItem.get_filename())
|
||||||
display = None
|
display = self._define_display(controller)
|
||||||
if controller.isLive:
|
if controller.isLive:
|
||||||
##if controller.previewDisplay:
|
#display = controller.display
|
||||||
# display = controller.previewDisplay
|
|
||||||
# isValid = self._check_file_type(controller, display,
|
|
||||||
# serviceItem)
|
|
||||||
display = controller.display
|
|
||||||
isValid = self._check_file_type(controller, display, serviceItem)
|
isValid = self._check_file_type(controller, display, serviceItem)
|
||||||
display.override[u'theme'] = u''
|
display.override[u'theme'] = u''
|
||||||
display.override[u'video'] = True
|
display.override[u'video'] = True
|
||||||
@ -400,7 +398,7 @@ class MediaController(object):
|
|||||||
display.serviceItem.start_time
|
display.serviceItem.start_time
|
||||||
controller.media_info.end_time = serviceItem.end_time
|
controller.media_info.end_time = serviceItem.end_time
|
||||||
elif controller.previewDisplay:
|
elif controller.previewDisplay:
|
||||||
display = controller.previewDisplay
|
#display = controller.previewDisplay
|
||||||
isValid = self._check_file_type(controller, display, serviceItem)
|
isValid = self._check_file_type(controller, display, serviceItem)
|
||||||
if not isValid:
|
if not isValid:
|
||||||
# Media could not be loaded correctly
|
# Media could not be loaded correctly
|
||||||
@ -481,7 +479,7 @@ class MediaController(object):
|
|||||||
``serviceItem``
|
``serviceItem``
|
||||||
The ServiceItem containing the details to be played.
|
The ServiceItem containing the details to be played.
|
||||||
"""
|
"""
|
||||||
print display
|
print "_check_file_type", controller,display
|
||||||
usedPlayers = get_media_players()[0]
|
usedPlayers = get_media_players()[0]
|
||||||
if serviceItem.title != u'Automatic':
|
if serviceItem.title != u'Automatic':
|
||||||
usedPlayers = [serviceItem.title.lower()]
|
usedPlayers = [serviceItem.title.lower()]
|
||||||
@ -532,11 +530,11 @@ class MediaController(object):
|
|||||||
Responds to the request to play a loaded video
|
Responds to the request to play a loaded video
|
||||||
|
|
||||||
``controller``
|
``controller``
|
||||||
First element is the controller which should be used
|
The controller to be played
|
||||||
"""
|
"""
|
||||||
log.debug(u'media_play')
|
log.debug(u'media_play')
|
||||||
for display in self.curDisplayMediaPlayer.keys():
|
|
||||||
if display.controller == controller:
|
display = self._define_display(controller)
|
||||||
if not self.curDisplayMediaPlayer[display].play(display):
|
if not self.curDisplayMediaPlayer[display].play(display):
|
||||||
return False
|
return False
|
||||||
if status:
|
if status:
|
||||||
@ -571,12 +569,11 @@ class MediaController(object):
|
|||||||
"""
|
"""
|
||||||
Responds to the request to pause a loaded video
|
Responds to the request to pause a loaded video
|
||||||
|
|
||||||
``msg``
|
``controller``
|
||||||
First element is the controller which should be used
|
The Controller to be paused
|
||||||
"""
|
"""
|
||||||
log.debug(u'media_pause')
|
log.debug(u'media_pause')
|
||||||
for display in self.curDisplayMediaPlayer.keys():
|
display = self._define_display(controller)
|
||||||
if display.controller == controller:
|
|
||||||
self.curDisplayMediaPlayer[display].pause(display)
|
self.curDisplayMediaPlayer[display].pause(display)
|
||||||
controller.mediabar.actions[u'playbackPlay']\
|
controller.mediabar.actions[u'playbackPlay']\
|
||||||
.setVisible(True)
|
.setVisible(True)
|
||||||
@ -599,12 +596,12 @@ class MediaController(object):
|
|||||||
"""
|
"""
|
||||||
Responds to the request to stop a loaded video
|
Responds to the request to stop a loaded video
|
||||||
|
|
||||||
``msg``
|
``controller``
|
||||||
First element is the controller which should be used
|
The controller that needs to be stopped
|
||||||
"""
|
"""
|
||||||
log.debug(u'media_stop')
|
log.debug(u'media_stop')
|
||||||
for display in self.curDisplayMediaPlayer.keys():
|
display = self._define_display(controller)
|
||||||
if display.controller == controller:
|
if display in self.curDisplayMediaPlayer:
|
||||||
display.frame.evaluateJavaScript(u'show_blank("black");')
|
display.frame.evaluateJavaScript(u'show_blank("black");')
|
||||||
self.curDisplayMediaPlayer[display].stop(display)
|
self.curDisplayMediaPlayer[display].stop(display)
|
||||||
self.curDisplayMediaPlayer[display].set_visible(display, False)
|
self.curDisplayMediaPlayer[display].set_visible(display, False)
|
||||||
@ -626,8 +623,7 @@ class MediaController(object):
|
|||||||
controller = msg[0]
|
controller = msg[0]
|
||||||
vol = msg[1][0]
|
vol = msg[1][0]
|
||||||
log.debug(u'media_volume %d' % vol)
|
log.debug(u'media_volume %d' % vol)
|
||||||
for display in self.curDisplayMediaPlayer.keys():
|
display = self._define_display(controller)
|
||||||
if display.controller == controller:
|
|
||||||
self.curDisplayMediaPlayer[display].volume(display, vol)
|
self.curDisplayMediaPlayer[display].volume(display, vol)
|
||||||
|
|
||||||
def media_seek(self, msg):
|
def media_seek(self, msg):
|
||||||
@ -651,8 +647,8 @@ class MediaController(object):
|
|||||||
"""
|
"""
|
||||||
log.debug(u'media_reset')
|
log.debug(u'media_reset')
|
||||||
self.set_controls_visible(controller, False)
|
self.set_controls_visible(controller, False)
|
||||||
for display in self.curDisplayMediaPlayer.keys():
|
display = self._define_display(controller)
|
||||||
if display.controller == controller:
|
if display in self.curDisplayMediaPlayer:
|
||||||
display.override = {}
|
display.override = {}
|
||||||
self.curDisplayMediaPlayer[display].reset(display)
|
self.curDisplayMediaPlayer[display].reset(display)
|
||||||
self.curDisplayMediaPlayer[display].set_visible(display, False)
|
self.curDisplayMediaPlayer[display].set_visible(display, False)
|
||||||
@ -726,3 +722,11 @@ class MediaController(object):
|
|||||||
self.timer.stop()
|
self.timer.stop()
|
||||||
for controller in self.controller:
|
for controller in self.controller:
|
||||||
self.media_reset(controller)
|
self.media_reset(controller)
|
||||||
|
|
||||||
|
def _define_display(self, controller):
|
||||||
|
"""
|
||||||
|
Extract the correct display for a given controller
|
||||||
|
"""
|
||||||
|
if controller.isLive:
|
||||||
|
return controller.display
|
||||||
|
return controller.previewDisplay
|
||||||
|
@ -175,9 +175,12 @@ class VlcPlayer(MediaPlayer):
|
|||||||
display.vlcWidget.resize(display.size())
|
display.vlcWidget.resize(display.size())
|
||||||
|
|
||||||
def play(self, display):
|
def play(self, display):
|
||||||
|
print "vlc play",display
|
||||||
controller = display.controller
|
controller = display.controller
|
||||||
|
print controller
|
||||||
start_time = 0
|
start_time = 0
|
||||||
if controller.media_info.start_time > 0:
|
if self.state != MediaState.Paused and\
|
||||||
|
controller.media_info.start_time > 0:
|
||||||
start_time = controller.media_info.start_time
|
start_time = controller.media_info.start_time
|
||||||
display.vlcMediaPlayer.play()
|
display.vlcMediaPlayer.play()
|
||||||
if not self.media_state_wait(display, vlc.State.Playing):
|
if not self.media_state_wait(display, vlc.State.Playing):
|
||||||
|
@ -64,22 +64,22 @@ class MediaMediaItem(MediaManagerItem):
|
|||||||
self.singleServiceItem = False
|
self.singleServiceItem = False
|
||||||
self.hasSearch = True
|
self.hasSearch = True
|
||||||
self.mediaObject = None
|
self.mediaObject = None
|
||||||
self.mediaController = DisplayController(parent)
|
self.displayController = DisplayController(parent)
|
||||||
self.mediaController.controllerLayout = QtGui.QVBoxLayout()
|
self.displayController.controllerLayout = QtGui.QVBoxLayout()
|
||||||
self.plugin.mediaController.register_controller(self.mediaController,
|
self.plugin.mediaController.register_controller(self.displayController,
|
||||||
DisplayControllerType.Plugin,
|
DisplayControllerType.Plugin,
|
||||||
self.mediaController.controllerLayout)
|
self.displayController.controllerLayout)
|
||||||
self.plugin.mediaController.set_controls_visible(self.mediaController,
|
self.plugin.mediaController.set_controls_visible(self.displayController,
|
||||||
False)
|
False)
|
||||||
self.mediaController.previewDisplay = Display(self.mediaController,
|
self.displayController.previewDisplay = Display(self.displayController,
|
||||||
False, self.mediaController)
|
False, self.displayController)
|
||||||
self.mediaController.previewDisplay.setGeometry(
|
self.displayController.previewDisplay.setGeometry(
|
||||||
QtCore.QRect(0, 0, 300, 300))
|
QtCore.QRect(0, 0, 300, 300))
|
||||||
self.mediaController.previewDisplay.screen = \
|
self.displayController.previewDisplay.screen = \
|
||||||
{u'size':self.mediaController.previewDisplay.geometry()}
|
{u'size':self.displayController.previewDisplay.geometry()}
|
||||||
self.mediaController.previewDisplay.setup()
|
self.displayController.previewDisplay.setup()
|
||||||
self.plugin.mediaController.setup_display(
|
self.plugin.mediaController.setup_display(
|
||||||
self.mediaController.previewDisplay, False)
|
self.displayController.previewDisplay, False)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
QtCore.SIGNAL(u'video_background_replaced'),
|
QtCore.SIGNAL(u'video_background_replaced'),
|
||||||
self.videobackgroundReplaced)
|
self.videobackgroundReplaced)
|
||||||
|
Loading…
Reference in New Issue
Block a user