forked from openlp/openlp
more simplifications
This commit is contained in:
parent
4aebe441e7
commit
81c9f5f1ca
|
@ -611,7 +611,7 @@ class ServiceItem(RegistryProperties):
|
|||
str(datetime.timedelta(seconds=self.start_time))
|
||||
if self.media_length != 0:
|
||||
end = translate('OpenLP.ServiceItem', '<strong>Length</strong>: %s') % \
|
||||
str(datetime.timedelta(seconds=self.media_length))
|
||||
str(datetime.timedelta(seconds=self.media_length // 1000))
|
||||
print("get_media_time " + str(self.media_length))
|
||||
if not start and not end:
|
||||
return ''
|
||||
|
|
|
@ -362,6 +362,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
|||
:param hidden: The player which is doing the playing
|
||||
:param video_behind_text: Is the video to be played behind text.
|
||||
"""
|
||||
print("### video", source)
|
||||
is_valid = False
|
||||
controller = self.display_controllers[source]
|
||||
print(controller)
|
||||
|
@ -382,6 +383,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
|||
controller)
|
||||
else:
|
||||
log.debug('video is not optical and live')
|
||||
controller.media_info.length = service_item.media_length
|
||||
is_valid = self._check_file_type(controller, display, service_item)
|
||||
display.override['theme'] = ''
|
||||
display.override['video'] = True
|
||||
|
@ -401,6 +403,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
|||
controller)
|
||||
else:
|
||||
log.debug('video is not optical and preview')
|
||||
controller.media_info.length = service_item.media_length
|
||||
is_valid = self._check_file_type(controller, display, service_item)
|
||||
if not is_valid:
|
||||
# Media could not be loaded correctly
|
||||
|
@ -453,7 +456,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
|||
return False
|
||||
media_data = MediaInfoWrapper.parse(service_item.get_frame_path())
|
||||
print(media_data.to_data())
|
||||
# duration returns in nano seconds
|
||||
# duration returns in milli seconds
|
||||
service_item.set_media_length(media_data.tracks[0].duration)
|
||||
log.debug('use %s controller' % self.current_media_players[controller.controller_type])
|
||||
return True
|
||||
|
@ -639,6 +642,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
|||
:param controller: The Controller to be processed
|
||||
"""
|
||||
if controller.media_info.playing and controller.media_info.length > 0:
|
||||
print("tick", 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
|
||||
|
@ -647,7 +651,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
|||
seconds = controller.media_info.timer // 1000
|
||||
minutes = seconds // 60
|
||||
seconds %= 60
|
||||
total_seconds = controller.media_info.length // 1000
|
||||
total_seconds = controller.media_info.length
|
||||
total_minutes = total_seconds // 60
|
||||
total_seconds %= 60
|
||||
controller.position_label.setText(' %02d:%02d / %02d:%02d' %
|
||||
|
|
|
@ -209,7 +209,8 @@ class SystemPlayer(MediaPlayer):
|
|||
|
||||
@staticmethod
|
||||
def set_duration(controller, duration):
|
||||
controller.media_info.length = int(duration / 1000)
|
||||
print("system set duration", controller.media_info.length, duration)
|
||||
#controller.media_info.length = int(duration / 1000)
|
||||
controller.seek_slider.setMaximum(controller.media_info.length * 1000)
|
||||
|
||||
def update_ui(self, display):
|
||||
|
|
|
@ -225,7 +225,7 @@ class VlcPlayer(MediaPlayer):
|
|||
# and once to just get media length.
|
||||
#
|
||||
# Media plugin depends on knowing media length before playback.
|
||||
controller.media_info.length = int(display.vlc_media_player.get_media().get_duration() / 1000)
|
||||
#controller.media_info.length = int(display.vlc_media_player.get_media().get_duration() / 1000)
|
||||
return True
|
||||
|
||||
def media_state_wait(self, display, media_state):
|
||||
|
@ -296,11 +296,12 @@ class VlcPlayer(MediaPlayer):
|
|||
start_time = controller.media_info.start_time
|
||||
controller.media_info.length = controller.media_info.end_time - controller.media_info.start_time
|
||||
else:
|
||||
controller.media_info.length = int(display.vlc_media_player.get_media().get_duration() / 1000)
|
||||
print("vlc len", controller.media_info.length)
|
||||
#controller.media_info.length = int(display.vlc_media_player.get_media().get_duration())
|
||||
self.volume(display, controller.media_info.volume)
|
||||
if start_time > 0 and display.vlc_media_player.is_seekable():
|
||||
display.vlc_media_player.set_time(int(start_time * 1000))
|
||||
controller.seek_slider.setMaximum(controller.media_info.length * 1000)
|
||||
display.vlc_media_player.set_time(int(start_time))
|
||||
controller.seek_slider.setMaximum(controller.media_info.length)
|
||||
print("VLC play " + str(controller.media_info.length))
|
||||
self.state = MediaState.Playing
|
||||
display.vlc_widget.raise_()
|
||||
|
|
|
@ -282,7 +282,7 @@ class WebkitPlayer(MediaPlayer):
|
|||
self.seek(display, controller.media_info.start_time * 1000)
|
||||
# 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
|
||||
display.web_view.raise_()
|
||||
return True
|
||||
|
@ -377,6 +377,7 @@ class WebkitPlayer(MediaPlayer):
|
|||
if length and length != float('inf'):
|
||||
length = int(length * 1000)
|
||||
if current_time and length:
|
||||
print("webkit update_ui", controller.media_info.length)
|
||||
controller.media_info.length = length
|
||||
controller.seek_slider.setMaximum(length)
|
||||
if not controller.seek_slider.isSliderDown():
|
||||
|
|
|
@ -272,6 +272,7 @@ class MediaMediaItem(MediaManagerItem, RegistryProperties):
|
|||
service_item.title = name
|
||||
service_item.processor = self.display_type_combo_box.currentText()
|
||||
service_item.add_from_command(path, name, CLAPPERBOARD)
|
||||
print("building service item")
|
||||
# Only get start and end times if going to a service
|
||||
if not self.media_controller.media_length(service_item):
|
||||
return False
|
||||
|
|
Loading…
Reference in New Issue