From 5cb50bf231e6868eab0a941ef0b22b9e2f963d17 Mon Sep 17 00:00:00 2001 From: langolierz Date: Sat, 11 Nov 2017 08:54:56 +0000 Subject: [PATCH] seek stuff --- data_centre.py | 2 +- display_centre.py | 4 ++-- display_data.json | 3 +-- next_bank_number.json | 2 +- omxdriver.py | 3 ++- video_centre.py | 10 +++++----- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/data_centre.py b/data_centre.py index 4698155..423f859 100644 --- a/data_centre.py +++ b/data_centre.py @@ -120,7 +120,7 @@ def add_folder_to_browser_list(current_path, current_level,open_folder_list): add_folder_to_browser_list(next_path, next_level,open_folder_list) for f in files: - if (os.path.splitext(f)[1] in ['.mp4']): + if (os.path.splitext(f)[1] in ['.mp4', '.mkv']): #print('{}{}'.format(indent, f)) results.append(dict(name='{}{}'.format(indent, f), bank='-')) diff --git a/display_centre.py b/display_centre.py index aa292d4..00a9ab0 100644 --- a/display_centre.py +++ b/display_centre.py @@ -237,9 +237,9 @@ def key(event): elif(event.char in ['l']): video_driver.current_player.toggle_pause() elif(event.char in ['j']): - video_driver.current_player.seek_video_to(-2) + video_driver.current_player.jump_video_back() elif(event.char in ['k']): - video_driver.current_player.seek_video_to(2) + video_driver.current_player.jump_video_forward() def up_key(event): diff --git a/display_data.json b/display_data.json index 612c886..83e3dbf 100644 --- a/display_data.json +++ b/display_data.json @@ -1,2 +1 @@ -[{"start": -1, "length": 4, "end": -1, "location": "/media/pi/TIM1/samplerloop3s.mp4", "name": "samplerloop3s.mp4"}, {"start": -1, "length": 5, "end": -1, "location": "/media/pi/TIM1/samplerloop3s2.mp4", "name": "samplerloop3s2.mp4"}, {"start": -1, "length": 3, "end": -1, "location": "/media/pi/TIM1/samplerloop3s3.mp4", "name": "samplerloop3s3.mp4"}, {"start": -1, "length": 3, "end": -1, "location": "/media/pi/TIM1/samplerloop3s3.mp4", "name": "samplerloop3s3.mp4"}, {"start": -1, "length": 3, "end": -1, "location": "/media/pi/TIM1/samplerloop3s3.mp4", "name": "samplerloop3s3.mp4"}, {"start": -1, "length": 26, "end": -1, "location": "/media/pi/TIM1/TRASHPALACEVIDEOS/01_trashpalaceintro.mp4", "name": "01_trashpalaceintro.mp4"}, {"start": -1, "length": 97, "end": -1, "location": "/media/pi/TIM1/TRASHPALACEVIDEOS/04_THEORY_OF_OBSCURITY.mp4", "name": "04_THEORY_OF_OBSCURITY.mp4"}, {"start": -1, "length": -1, "end": -1, "location": "", "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "name": ""}] - +[{"start": -1, "length": 60, "end": -1, "location": "/media/pi/TIM1/TRASHPALACEVIDEOS/07_The_Apple.mkv", "name": "07_The_Apple.mkv"}, {"start": -1, "length": 304, "end": -1, "location": "/media/pi/TIM1/TRASHPALACEVIDEOS/06_Getting_Out_of_Bed.mp4", "name": "06_Getting_Out_of_Bed.mp4"}, {"start": -1, "length": -1, "end": -1, "location": "", "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "name": ""}] diff --git a/next_bank_number.json b/next_bank_number.json index 573541a..56a6051 100644 --- a/next_bank_number.json +++ b/next_bank_number.json @@ -1 +1 @@ -0 +1 \ No newline at end of file diff --git a/omxdriver.py b/omxdriver.py index e78d8e7..afe0a3f 100644 --- a/omxdriver.py +++ b/omxdriver.py @@ -409,7 +409,8 @@ class OMXDriver(object): logger.info('warn'+'Failed to toggle pause - process not running') return - + def run_action(self, num): + self.__iface_player.Action(num) def stop(self): logger.info('log'+'>stop received and quit sent to omxplayer {} '.format(self.pid)) diff --git a/video_centre.py b/video_centre.py index 7ad6da9..d006f49 100644 --- a/video_centre.py +++ b/video_centre.py @@ -187,11 +187,11 @@ class video_player(object): return print 'failed to toggle pause (this needs to be in message)' - def seek_video_to(self, amount_in_seconds): - if self.omx.seek(amount_in_seconds*1000000) == None: - print 'failed to seek {}'.format(amount_in_seconds) - else: - print 'successfully seeked {} '.format(amount_in_seconds) + def jump_video_forward(self): + self.omx.run_action(20) + + def jump_video_back(self): + self.omx.run_action(19) # tk = Tk()