Merge pull request #4 from langolierz/from-pi

From pi
This commit is contained in:
langolierz
2017-11-16 18:02:26 +13:00
committed by GitHub
6 changed files with 17 additions and 7 deletions

View File

@@ -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) add_folder_to_browser_list(next_path, next_level,open_folder_list)
for f in files: 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)) #print('{}{}'.format(indent, f))
results.append(dict(name='{}{}'.format(indent, f), bank='-')) results.append(dict(name='{}{}'.format(indent, f), bank='-'))

View File

@@ -236,6 +236,10 @@ def key(event):
## 'l' pauses/unpauses the video ## 'l' pauses/unpauses the video
elif(event.char in ['l']): elif(event.char in ['l']):
video_driver.current_player.toggle_pause() video_driver.current_player.toggle_pause()
elif(event.char in ['j']):
video_driver.current_player.jump_video_back()
elif(event.char in ['k']):
video_driver.current_player.jump_video_forward()
def up_key(event): def up_key(event):

View File

@@ -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": ""}]

View File

@@ -1 +1 @@
0 1

View File

@@ -409,7 +409,8 @@ class OMXDriver(object):
logger.info('warn'+'Failed to toggle pause - process not running') logger.info('warn'+'Failed to toggle pause - process not running')
return return
def run_action(self, num):
self.__iface_player.Action(num)
def stop(self): def stop(self):
logger.info('log'+'>stop received and quit sent to omxplayer {} '.format(self.pid)) logger.info('log'+'>stop received and quit sent to omxplayer {} '.format(self.pid))

View File

@@ -177,16 +177,22 @@ class video_player(object):
def toggle_pause(self): def toggle_pause(self):
is_paused = self.omx.omxplayer_is_paused() is_paused = self.omx.omxplayer_is_paused()
print is_paused print is_paused
if is_paused == 'RUNNING': if is_paused == 'Playing':
if self.omx.send_pause(): if self.omx.send_pause():
self.status = 'PAUSED' self.status = 'PAUSED'
return return
elif is_paused == 'PAUSED': elif is_paused == 'Paused':
if self.omx.send_unpause(): if self.omx.send_unpause():
self.status = 'PLAYING' self.status = 'PLAYING'
return return
print 'failed to toggle pause (this needs to be in message)' print 'failed to toggle pause (this needs to be in message)'
def jump_video_forward(self):
self.omx.run_action(20)
def jump_video_back(self):
self.omx.run_action(19)
# tk = Tk() # tk = Tk()