mirror of
https://github.com/cyberboy666/r_e_c_u_r.git
synced 2026-01-05 23:15:30 +01:00
fixed tab issue
This commit is contained in:
53
omxdriver.py
53
omxdriver.py
@@ -2,30 +2,30 @@ from omxplayer.player import OMXPlayer
|
||||
from time import sleep
|
||||
|
||||
class omx_driver:
|
||||
def __init__(self, root):
|
||||
self.root = root
|
||||
self.path = ''
|
||||
self.player = None
|
||||
def __init__(self, root):
|
||||
self.root = root
|
||||
self.path = ''
|
||||
self.player = None
|
||||
self.status = 'UNASSIGNED'
|
||||
self.duration = ''
|
||||
self.duration = 0
|
||||
|
||||
|
||||
def load(self, location, arguments):
|
||||
def load(self, location, arguments):
|
||||
self.status = 'LOADING'
|
||||
self.player = OMXPlayer(location, arguments)
|
||||
self.player = OMXPlayer(location, arguments)
|
||||
self.duration = self.player.duration()
|
||||
print('the duration is {}'.format(self.duration))
|
||||
self.pause_at_start()
|
||||
self.pause_at_start()
|
||||
|
||||
def pause_at_start(self):
|
||||
position = self.get_position()
|
||||
print('the position is {}'.format(position))
|
||||
if(position > 0):
|
||||
def pause_at_start(self):
|
||||
position = self.get_position()
|
||||
print('the position is {}'.format(position))
|
||||
if(position > 0):
|
||||
self.status = 'LOADED'
|
||||
self.player.pause()
|
||||
print('its paused')
|
||||
else:
|
||||
self.root.after(5,self.pause_at_start)
|
||||
self.player.pause()
|
||||
print('its paused')
|
||||
else:
|
||||
self.root.after(5,self.pause_at_start)
|
||||
|
||||
def play(self):
|
||||
self.status = 'PLAYING'
|
||||
@@ -34,25 +34,26 @@ class omx_driver:
|
||||
|
||||
def pause_at_end(self):
|
||||
position = self.get_position()
|
||||
print('the position is {}'.format(position))
|
||||
if(position > (self.duration - 0.05 )):
|
||||
print('the position is {}'.format(position))
|
||||
if(position > (self.duration - 0.05 )):
|
||||
self.status = 'FINISHED'
|
||||
print('time to end is {}'.format(self.duration - position))
|
||||
self.player.pause()
|
||||
print('its finished')
|
||||
else:
|
||||
self.root.after(5,self.pause_at_end)
|
||||
self.player.pause()
|
||||
print('its finished')
|
||||
else:
|
||||
self.root.after(5,self.pause_at_end)
|
||||
|
||||
def get_position(self):
|
||||
return self.player.position()
|
||||
def get_position(self):
|
||||
return self.player.position()
|
||||
|
||||
def toggle_pause(self):
|
||||
self.player.play_pause()
|
||||
|
||||
self.status = self.player.playback_status().upper()
|
||||
|
||||
def seek(self, amount):
|
||||
self.player.seek(amount)
|
||||
|
||||
def quit(self):
|
||||
def quit(self):
|
||||
self.player.quit()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user