forked from openlp/openlp
prints
This commit is contained in:
parent
fe0cdc70fb
commit
9c2b472ee8
@ -542,6 +542,8 @@ class ServiceItem(RegistryProperties):
|
|||||||
|
|
||||||
:param length: The length of the media item
|
:param length: The length of the media item
|
||||||
"""
|
"""
|
||||||
|
print("set_media_length " + str(length) + " " + self.processor)
|
||||||
|
print("set_media_length " + str(self.start_time) + " " + str(self.end_time))
|
||||||
self.media_length = length
|
self.media_length = length
|
||||||
if length > 0:
|
if length > 0:
|
||||||
self.add_capability(ItemCapabilities.HasVariableStartTime)
|
self.add_capability(ItemCapabilities.HasVariableStartTime)
|
||||||
@ -611,6 +613,7 @@ class ServiceItem(RegistryProperties):
|
|||||||
if self.media_length != 0:
|
if self.media_length != 0:
|
||||||
end = translate('OpenLP.ServiceItem', '<strong>Length</strong>: %s') % \
|
end = translate('OpenLP.ServiceItem', '<strong>Length</strong>: %s') % \
|
||||||
str(datetime.timedelta(seconds=self.media_length))
|
str(datetime.timedelta(seconds=self.media_length))
|
||||||
|
print("get_media_time " + str(self.media_length))
|
||||||
if not start and not end:
|
if not start and not end:
|
||||||
return ''
|
return ''
|
||||||
elif start and not end:
|
elif start and not end:
|
||||||
|
@ -435,6 +435,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
|||||||
|
|
||||||
:param service_item: The ServiceItem containing the details to be played.
|
:param service_item: The ServiceItem containing the details to be played.
|
||||||
"""
|
"""
|
||||||
|
print('### media_length')
|
||||||
controller = self.display_controllers[DisplayControllerType.Plugin]
|
controller = self.display_controllers[DisplayControllerType.Plugin]
|
||||||
# stop running videos
|
# stop running videos
|
||||||
self.media_reset(controller)
|
self.media_reset(controller)
|
||||||
@ -451,8 +452,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
|||||||
critical_error_message_box(translate('MediaPlugin.MediaItem', 'Unsupported File'),
|
critical_error_message_box(translate('MediaPlugin.MediaItem', 'Unsupported File'),
|
||||||
translate('MediaPlugin.MediaItem', 'Unsupported File'))
|
translate('MediaPlugin.MediaItem', 'Unsupported File'))
|
||||||
return False
|
return False
|
||||||
print("####")
|
print("media_length " + str(controller.media_info.length))
|
||||||
print(controller.media_info.length)
|
|
||||||
service_item.set_media_length(controller.media_info.length)
|
service_item.set_media_length(controller.media_info.length)
|
||||||
self.media_stop(controller)
|
self.media_stop(controller)
|
||||||
log.debug('use %s controller' % self.current_media_players[controller.controller_type])
|
log.debug('use %s controller' % self.current_media_players[controller.controller_type])
|
||||||
@ -589,6 +589,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
|||||||
:param controller: The controller to be played
|
:param controller: The controller to be played
|
||||||
:param status:
|
:param status:
|
||||||
"""
|
"""
|
||||||
|
print('### media_play')
|
||||||
controller.seek_slider.blockSignals(True)
|
controller.seek_slider.blockSignals(True)
|
||||||
controller.volume_slider.blockSignals(True)
|
controller.volume_slider.blockSignals(True)
|
||||||
display = self._define_display(controller)
|
display = self._define_display(controller)
|
||||||
@ -637,6 +638,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
|||||||
|
|
||||||
:param controller: The Controller to be processed
|
:param controller: The Controller to be processed
|
||||||
"""
|
"""
|
||||||
|
print('### tick')
|
||||||
if controller.media_info.playing:
|
if controller.media_info.playing:
|
||||||
if controller.media_info.timer > controller.media_info.length:
|
if controller.media_info.timer > controller.media_info.length:
|
||||||
controller.media_info.timer = controller.media_info.length
|
controller.media_info.timer = controller.media_info.length
|
||||||
@ -658,6 +660,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
|||||||
|
|
||||||
:param controller: The Controller to be paused
|
:param controller: The Controller to be paused
|
||||||
"""
|
"""
|
||||||
|
print('### media_pause')
|
||||||
display = self._define_display(controller)
|
display = self._define_display(controller)
|
||||||
self.current_media_players[controller.controller_type].pause(display)
|
self.current_media_players[controller.controller_type].pause(display)
|
||||||
controller.mediabar.actions['playbackPlay'].setVisible(True)
|
controller.mediabar.actions['playbackPlay'].setVisible(True)
|
||||||
@ -679,6 +682,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
|||||||
|
|
||||||
:param controller: The controller that needs to be stopped
|
:param controller: The controller that needs to be stopped
|
||||||
"""
|
"""
|
||||||
|
print('### media_stop')
|
||||||
display = self._define_display(controller)
|
display = self._define_display(controller)
|
||||||
if controller.controller_type in self.current_media_players:
|
if controller.controller_type in self.current_media_players:
|
||||||
display.frame.evaluateJavaScript('show_blank("black");')
|
display.frame.evaluateJavaScript('show_blank("black");')
|
||||||
|
@ -134,6 +134,9 @@ class VlcPlayer(MediaPlayer):
|
|||||||
def setup(self, display):
|
def setup(self, display):
|
||||||
"""
|
"""
|
||||||
Set up the media player
|
Set up the media player
|
||||||
|
|
||||||
|
:param display: The display where the media is
|
||||||
|
:return:
|
||||||
"""
|
"""
|
||||||
vlc = get_vlc()
|
vlc = get_vlc()
|
||||||
display.vlc_widget = QtWidgets.QFrame(display)
|
display.vlc_widget = QtWidgets.QFrame(display)
|
||||||
@ -176,6 +179,9 @@ class VlcPlayer(MediaPlayer):
|
|||||||
def load(self, display):
|
def load(self, display):
|
||||||
"""
|
"""
|
||||||
Load a video into VLC
|
Load a video into VLC
|
||||||
|
|
||||||
|
:param display: The display where the media is
|
||||||
|
:return:
|
||||||
"""
|
"""
|
||||||
vlc = get_vlc()
|
vlc = get_vlc()
|
||||||
log.debug('load vid in Vlc Controller')
|
log.debug('load vid in Vlc Controller')
|
||||||
@ -216,6 +222,10 @@ class VlcPlayer(MediaPlayer):
|
|||||||
"""
|
"""
|
||||||
Wait for the video to change its state
|
Wait for the video to change its state
|
||||||
Wait no longer than 60 seconds. (loading an iso file needs a long time)
|
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
|
||||||
|
:return:
|
||||||
"""
|
"""
|
||||||
vlc = get_vlc()
|
vlc = get_vlc()
|
||||||
start = datetime.now()
|
start = datetime.now()
|
||||||
@ -230,12 +240,18 @@ class VlcPlayer(MediaPlayer):
|
|||||||
def resize(self, display):
|
def resize(self, display):
|
||||||
"""
|
"""
|
||||||
Resize the player
|
Resize the player
|
||||||
|
|
||||||
|
:param display: The display where the media is
|
||||||
|
:return:
|
||||||
"""
|
"""
|
||||||
display.vlc_widget.resize(display.size())
|
display.vlc_widget.resize(display.size())
|
||||||
|
|
||||||
def play(self, display):
|
def play(self, display):
|
||||||
"""
|
"""
|
||||||
Play the current item
|
Play the current item
|
||||||
|
|
||||||
|
:param display: The display where the media is
|
||||||
|
:return:
|
||||||
"""
|
"""
|
||||||
vlc = get_vlc()
|
vlc = get_vlc()
|
||||||
controller = display.controller
|
controller = display.controller
|
||||||
@ -275,6 +291,7 @@ class VlcPlayer(MediaPlayer):
|
|||||||
if start_time > 0 and display.vlc_media_player.is_seekable():
|
if start_time > 0 and display.vlc_media_player.is_seekable():
|
||||||
display.vlc_media_player.set_time(int(start_time * 1000))
|
display.vlc_media_player.set_time(int(start_time * 1000))
|
||||||
controller.seek_slider.setMaximum(controller.media_info.length * 1000)
|
controller.seek_slider.setMaximum(controller.media_info.length * 1000)
|
||||||
|
print("VLC play " + str(controller.media_info.length))
|
||||||
self.state = MediaState.Playing
|
self.state = MediaState.Playing
|
||||||
display.vlc_widget.raise_()
|
display.vlc_widget.raise_()
|
||||||
return True
|
return True
|
||||||
@ -282,6 +299,9 @@ class VlcPlayer(MediaPlayer):
|
|||||||
def pause(self, display):
|
def pause(self, display):
|
||||||
"""
|
"""
|
||||||
Pause the current item
|
Pause the current item
|
||||||
|
|
||||||
|
:param display: The display where the media is
|
||||||
|
:return:
|
||||||
"""
|
"""
|
||||||
vlc = get_vlc()
|
vlc = get_vlc()
|
||||||
if display.vlc_media.get_state() != vlc.State.Playing:
|
if display.vlc_media.get_state() != vlc.State.Playing:
|
||||||
@ -293,6 +313,9 @@ class VlcPlayer(MediaPlayer):
|
|||||||
def stop(self, display):
|
def stop(self, display):
|
||||||
"""
|
"""
|
||||||
Stop the current item
|
Stop the current item
|
||||||
|
|
||||||
|
:param display: The display where the media is
|
||||||
|
:return:
|
||||||
"""
|
"""
|
||||||
threading.Thread(target=display.vlc_media_player.stop).start()
|
threading.Thread(target=display.vlc_media_player.stop).start()
|
||||||
self.state = MediaState.Stopped
|
self.state = MediaState.Stopped
|
||||||
@ -300,6 +323,10 @@ class VlcPlayer(MediaPlayer):
|
|||||||
def volume(self, display, vol):
|
def volume(self, display, vol):
|
||||||
"""
|
"""
|
||||||
Set the volume
|
Set the volume
|
||||||
|
|
||||||
|
:param vol: The volume to be sets
|
||||||
|
:param display: The display where the media is
|
||||||
|
:return:
|
||||||
"""
|
"""
|
||||||
if display.has_audio:
|
if display.has_audio:
|
||||||
display.vlc_media_player.audio_set_volume(vol)
|
display.vlc_media_player.audio_set_volume(vol)
|
||||||
@ -307,6 +334,9 @@ class VlcPlayer(MediaPlayer):
|
|||||||
def seek(self, display, seek_value):
|
def seek(self, display, seek_value):
|
||||||
"""
|
"""
|
||||||
Go to a particular position
|
Go to a particular position
|
||||||
|
|
||||||
|
:param seek_value: The position of where a seek goes to
|
||||||
|
:param display: The display where the media is
|
||||||
"""
|
"""
|
||||||
if display.controller.media_info.media_type == MediaType.CD \
|
if display.controller.media_info.media_type == MediaType.CD \
|
||||||
or display.controller.media_info.media_type == MediaType.DVD:
|
or display.controller.media_info.media_type == MediaType.DVD:
|
||||||
@ -317,6 +347,8 @@ class VlcPlayer(MediaPlayer):
|
|||||||
def reset(self, display):
|
def reset(self, display):
|
||||||
"""
|
"""
|
||||||
Reset the player
|
Reset the player
|
||||||
|
|
||||||
|
:param display: The display where the media is
|
||||||
"""
|
"""
|
||||||
display.vlc_media_player.stop()
|
display.vlc_media_player.stop()
|
||||||
display.vlc_widget.setVisible(False)
|
display.vlc_widget.setVisible(False)
|
||||||
@ -325,6 +357,9 @@ class VlcPlayer(MediaPlayer):
|
|||||||
def set_visible(self, display, status):
|
def set_visible(self, display, status):
|
||||||
"""
|
"""
|
||||||
Set the visibility
|
Set the visibility
|
||||||
|
|
||||||
|
:param display: The display where the media is
|
||||||
|
:param status: The visibility status
|
||||||
"""
|
"""
|
||||||
if self.has_own_widget:
|
if self.has_own_widget:
|
||||||
display.vlc_widget.setVisible(status)
|
display.vlc_widget.setVisible(status)
|
||||||
@ -332,6 +367,8 @@ class VlcPlayer(MediaPlayer):
|
|||||||
def update_ui(self, display):
|
def update_ui(self, display):
|
||||||
"""
|
"""
|
||||||
Update the UI
|
Update the UI
|
||||||
|
|
||||||
|
:param display: The display where the media is
|
||||||
"""
|
"""
|
||||||
vlc = get_vlc()
|
vlc = get_vlc()
|
||||||
# Stop video if playback is finished.
|
# Stop video if playback is finished.
|
||||||
|
@ -281,6 +281,7 @@ class WebkitPlayer(MediaPlayer):
|
|||||||
if start_time > 0:
|
if start_time > 0:
|
||||||
self.seek(display, controller.media_info.start_time * 1000)
|
self.seek(display, controller.media_info.start_time * 1000)
|
||||||
# TODO add playing check and get the correct media length
|
# TODO add playing check and get the correct media length
|
||||||
|
print("Webkit play " + str(length))
|
||||||
controller.media_info.length = length
|
controller.media_info.length = length
|
||||||
self.state = MediaState.Playing
|
self.state = MediaState.Playing
|
||||||
display.web_view.raise_()
|
display.web_view.raise_()
|
||||||
|
Loading…
Reference in New Issue
Block a user