From 607d678780ca7e05e37b3bf134ca2fbd76d9dfeb Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 21 Apr 2019 09:20:43 +0100 Subject: [PATCH] seek slider works --- openlp/core/ui/media/mediacontroller.py | 3 --- openlp/core/ui/media/mediaplayer.py | 5 +++-- openlp/core/ui/media/vlcplayer.py | 13 +++++++------ openlp/core/ui/slidecontroller.py | 6 ++---- 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/openlp/core/ui/media/mediacontroller.py b/openlp/core/ui/media/mediacontroller.py index 12f6c8ba2..a916b8cc0 100644 --- a/openlp/core/ui/media/mediacontroller.py +++ b/openlp/core/ui/media/mediacontroller.py @@ -216,9 +216,6 @@ class MediaController(RegistryBase, LogMixin, RegistryProperties): """ # Generic controls controller.mediabar.setVisible(value) - # if controller.is_live and controller.display: - # if self.current_media_players and value: - # controller.display.set_transparency(False) @staticmethod def resize(display, player): diff --git a/openlp/core/ui/media/mediaplayer.py b/openlp/core/ui/media/mediaplayer.py index 36d5ef13f..79d6d529d 100644 --- a/openlp/core/ui/media/mediaplayer.py +++ b/openlp/core/ui/media/mediaplayer.py @@ -139,11 +139,12 @@ class MediaPlayer(RegistryProperties): """ pass - def update_ui(self, display): + def update_ui(self, controller, output_display): """ Do some ui related stuff (e.g. update the seek slider) - :param display: The display to be updated. + :param controller: Which Controller is running the show. + :param output_display: The display where the media is """ pass diff --git a/openlp/core/ui/media/vlcplayer.py b/openlp/core/ui/media/vlcplayer.py index f254ebaf9..3675a0378 100644 --- a/openlp/core/ui/media/vlcplayer.py +++ b/openlp/core/ui/media/vlcplayer.py @@ -226,7 +226,8 @@ class VlcPlayer(MediaPlayer): return False output_display.vlc_media = audio_cd_tracks.item_at_index(controller.media_info.title_track) elif controller.media_info.media_type == MediaType.Stream: - output_display.vlc_media = output_display.vlc_instance.media_new_location('ZZZZZZ') + stream_cmd = Settings().value('media/stream command') + output_display.vlc_media = output_display.vlc_instance.media_new_location(stream_cmd) else: output_display.vlc_media = output_display.vlc_instance.media_new_path(path) # put the media in the media player @@ -242,7 +243,7 @@ class VlcPlayer(MediaPlayer): 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 + :param output_display: The display where the media is :return: """ vlc = get_vlc() @@ -316,7 +317,7 @@ class VlcPlayer(MediaPlayer): self.volume(output_display, output_display.media_info.volume) if start_time > 0 and output_display.vlc_media_player.is_seekable(): output_display.vlc_media_player.set_time(int(start_time)) - controller.seek_slider.setMaximum(output_display.media_info.length) + controller.seek_slider.setMaximum(controller.media_info.length) self.set_state(MediaState.Playing, output_display) output_display.vlc_widget.raise_() return True @@ -363,9 +364,9 @@ class VlcPlayer(MediaPlayer): :param seek_value: The position of where a seek goes to :param output_display: The display where the media is """ - if output_display.controller.media_info.media_type == MediaType.CD \ - or output_display.controller.media_info.media_type == MediaType.DVD: - seek_value += int(output_display.controller.media_info.start_time) + if output_display.media_info.media_type == MediaType.CD \ + or output_display.media_info.media_type == MediaType.DVD: + seek_value += int(output_display.media_info.start_time) if output_display.vlc_media_player.is_seekable(): output_display.vlc_media_player.set_time(seek_value) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 146c060f6..86ceef5d2 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -112,7 +112,7 @@ class MediaSlider(QtWidgets.QSlider): class InfoLabel(QtWidgets.QLabel): """ - InfoLabel is a subclassed QLabel. Created to provide the ablilty to add a ellipsis if the text is cut off. Original + InfoLabel is a subclassed QLabel. Created to provide the ability to add a ellipsis if the text is cut off. Original source: https://stackoverflow.com/questions/11446478/pyside-pyqt-truncate-text-in-qlabel-based-on-minimumsize """ @@ -177,7 +177,6 @@ class SlideController(QtWidgets.QWidget, LogMixin, RegistryProperties): if screen.is_display: display = DisplayWindow(self, screen) self.displays.append(display) - # display.media_watcher.progress.connect(self.on_audio_time_remaining) @property def display(self): @@ -381,7 +380,7 @@ class SlideController(QtWidgets.QWidget, LogMixin, RegistryProperties): self.position_label.setMinimumSize(90, 0) self.position_label.setObjectName('position_label') self.mediabar.add_toolbar_widget(self.position_label) - # Build the seek_slider. + # Build the media seek_slider. self.seek_slider = MediaSlider(QtCore.Qt.Horizontal, self, self) self.seek_slider.setMaximum(1000) self.seek_slider.setTracking(True) @@ -398,7 +397,6 @@ class SlideController(QtWidgets.QWidget, LogMixin, RegistryProperties): self.volume_slider.setMaximum(100) self.volume_slider.setTracking(True) self.volume_slider.setToolTip(translate('OpenLP.SlideController', 'Audio Volume.')) - # self.volume_slider.setValue(self.media_info.volume) self.volume_slider.setGeometry(QtCore.QRect(90, 160, 221, 24)) self.volume_slider.setObjectName('volume_slider') self.mediabar.add_toolbar_widget(self.volume_slider)