diff --git a/actions.py b/actions.py index bb77778..ac5774a 100644 --- a/actions.py +++ b/actions.py @@ -194,6 +194,10 @@ class Actions(object): def seek_back_on_player(self): self.video_driver.current_player.seek(-(self.data.settings['sampler']['SEEK_TIME']['value'])) + def seek_to_location_on_player(self, position): + print("seek_to_location_on_player passed %s" % position) + self.video_driver.current_player.seek_percent(position) + def toggle_function(self): self.data.function_on = not self.data.function_on diff --git a/video_centre/alt_video_player.py b/video_centre/alt_video_player.py index 37f4d1a..6cc008d 100644 --- a/video_centre/alt_video_player.py +++ b/video_centre/alt_video_player.py @@ -125,6 +125,12 @@ class AltVideoPlayer: else: self.message_handler.set_message('INFO', 'can not seek outside range') + def seek_percent(self, percent): + # convert % to absolute position in current clip + duration = self.end - self.start + pos = duration * percent + self.set_position(self.start + pos) + def change_rate(self, amount): if self.rate is None: self.rate = 1 diff --git a/video_centre/video_player.py b/video_centre/video_player.py index cb8458a..3898b7e 100644 --- a/video_centre/video_player.py +++ b/video_centre/video_player.py @@ -156,6 +156,12 @@ class VideoPlayer: else: self.message_handler.set_message('INFO', 'can not seek outside range') + def seek_percent(self, percent): + # convert % to absolute position in current clip + duration = self.end - self.start + pos = duration * percent + self.set_position(self.start + pos) + def change_rate(self, amount): new_rate = self.rate + amount if (new_rate > self.omx_player.minimum_rate() and new_rate < self.omx_player.maximum_rate()):