mirror of
https://github.com/cyberboy666/r_e_c_u_r.git
synced 2025-12-12 19:30:11 +01:00
Merge branch 'master' into pi-work
This commit is contained in:
@@ -167,6 +167,7 @@ def create_new_bank_mapping(bank_number,file_name,memory_bank=[]):
|
|||||||
|
|
||||||
def get_length_for_file(location):
|
def get_length_for_file(location):
|
||||||
video_length = FFProbe(location).streams[0].duration
|
video_length = FFProbe(location).streams[0].duration
|
||||||
|
print video_length
|
||||||
return int(round(float(video_length)))
|
return int(round(float(video_length)))
|
||||||
|
|
||||||
def get_path_for_file(file_name):
|
def get_path_for_file(file_name):
|
||||||
|
|||||||
@@ -24,12 +24,10 @@ browser_index = 0
|
|||||||
|
|
||||||
tk = Tk()
|
tk = Tk()
|
||||||
|
|
||||||
|
|
||||||
frame = Frame(tk, width=500, height=400)
|
frame = Frame(tk, width=500, height=400)
|
||||||
|
|
||||||
video_driver = video_centre.video_driver(frame)
|
video_driver = video_centre.video_driver(frame)
|
||||||
|
|
||||||
|
|
||||||
# our data store
|
# our data store
|
||||||
data_object = data_centre.data()
|
data_object = data_centre.data()
|
||||||
|
|
||||||
@@ -37,6 +35,7 @@ browser_list = data_object.get_browser_data_for_display()
|
|||||||
|
|
||||||
bank_info = data_centre.get_all_looper_data_for_display()
|
bank_info = data_centre.get_all_looper_data_for_display()
|
||||||
|
|
||||||
|
current_message = None
|
||||||
# terminal_font = Font(family="Terminal", size=12)
|
# terminal_font = Font(family="Terminal", size=12)
|
||||||
# terminal_font_bold = Font(family="Terminal", size=12, weight='bold')
|
# terminal_font_bold = Font(family="Terminal", size=12, weight='bold')
|
||||||
# titles.configure(font=terminal_font_bold)
|
# titles.configure(font=terminal_font_bold)
|
||||||
@@ -55,6 +54,7 @@ def load_display(display):
|
|||||||
else:
|
else:
|
||||||
load_looper(display)
|
load_looper(display)
|
||||||
#load_divider(display)
|
#load_divider(display)
|
||||||
|
|
||||||
display.pack()
|
display.pack()
|
||||||
|
|
||||||
|
|
||||||
@@ -88,6 +88,14 @@ def load_looper(display):
|
|||||||
display.insert(END, '{:>3} {:>10} {:>3} {:>3} {:>3} \n'.format(
|
display.insert(END, '{:>3} {:>10} {:>3} {:>3} {:>3} \n'.format(
|
||||||
bank[0], bank[1], bank[2], bank[3], bank[4]))
|
bank[0], bank[1], bank[2], bank[3], bank[4]))
|
||||||
|
|
||||||
|
def load_message(display):
|
||||||
|
display.insert(END, 'INFO: {}'.format(current_message))
|
||||||
|
display.tag_add("ERROR_MESSAGE", 14.0, 15.0)
|
||||||
|
tk.after(4000,clear_message)
|
||||||
|
|
||||||
|
def clear_message():
|
||||||
|
global current_message
|
||||||
|
current_message = None
|
||||||
|
|
||||||
def get_text_for_video_display():
|
def get_text_for_video_display():
|
||||||
now_bank, now_status, next_bank, next_status, duration, video_length = video_driver.get_info_for_video_display()
|
now_bank, now_status, next_bank, next_status, duration, video_length = video_driver.get_info_for_video_display()
|
||||||
@@ -182,32 +190,52 @@ def refresh_display():
|
|||||||
display = Text(tk, bg="black", fg="white", font=('courier', 14))
|
display = Text(tk, bg="black", fg="white", font=('courier', 14))
|
||||||
display.tag_configure("SELECT", background="white", foreground="black")
|
display.tag_configure("SELECT", background="white", foreground="black")
|
||||||
display.tag_configure("TITLE", background="black", foreground="red")
|
display.tag_configure("TITLE", background="black", foreground="red")
|
||||||
|
display.tag_configure("ERROR_MESSAGE", background="red", foreground="black")
|
||||||
|
display.tag_configure("INFO_MESSAGE", background="blue", foreground="black")
|
||||||
display.tag_configure("PLAYER_INFO", background="black", foreground="yellow")
|
display.tag_configure("PLAYER_INFO", background="black", foreground="yellow")
|
||||||
|
|
||||||
load_display(display)
|
load_display(display)
|
||||||
|
|
||||||
select_current_browser_index()
|
select_current_browser_index()
|
||||||
|
|
||||||
|
def num_lock_key(event):
|
||||||
|
global display_mode
|
||||||
|
if display_mode == "BROWSER":
|
||||||
|
display_mode = "LOOPER"
|
||||||
|
else:
|
||||||
|
display_mode = "BROWSER"
|
||||||
|
refresh_display()
|
||||||
|
|
||||||
def key(event):
|
def key(event):
|
||||||
print event.char
|
print event.char
|
||||||
|
## '/' clear all banks
|
||||||
if event.char == '/':
|
if event.char == '/':
|
||||||
print 'it\'s cleared!'
|
print 'it\'s cleared!'
|
||||||
data_centre.clear_all_banks()
|
data_centre.clear_all_banks()
|
||||||
refresh_display()
|
refresh_display()
|
||||||
|
## '.' quits r_e_c_u_r
|
||||||
if event.char == '.':
|
elif event.char == '.':
|
||||||
if video_centre.has_omx:
|
if video_centre.has_omx:
|
||||||
video_driver.exit_all_players()
|
video_driver.exit_all_players()
|
||||||
tk.destroy()
|
tk.destroy()
|
||||||
|
## 'num' sets current selection to bank number num
|
||||||
if event.char in ['0', '1', '2', '3', '4', '5', '6', '7']:
|
elif event.char in ['0', '1', '2', '3', '4', '5', '6', '7']:
|
||||||
data_centre.update_next_bank_number(int(event.char))
|
data_centre.update_next_bank_number(int(event.char))
|
||||||
# video_driver.next_player.reload_content()
|
# video_driver.next_player.reload_content()
|
||||||
|
## 'enter' sets manual next flag
|
||||||
elif event.char in ['\r']:
|
elif event.char in ['\r']:
|
||||||
video_driver.manual_next = True
|
video_driver.manual_next = True
|
||||||
elif(event.char in ['.']):
|
## 'm' switches display mode
|
||||||
# code for killswitch
|
elif(event.char in ['m']):
|
||||||
sys.exit()
|
global display_mode
|
||||||
|
if display_mode == "BROWSER":
|
||||||
|
display_mode = "LOOPER"
|
||||||
|
else:
|
||||||
|
display_mode = "BROWSER"
|
||||||
|
refresh_display()
|
||||||
|
## 'l' pauses/unpauses the video
|
||||||
|
elif(event.char in ['l']):
|
||||||
|
video_driver.current_player.toggle_pause()
|
||||||
|
|
||||||
|
|
||||||
def up_key(event):
|
def up_key(event):
|
||||||
@@ -222,29 +250,28 @@ def down_key(event):
|
|||||||
global browser_index
|
global browser_index
|
||||||
global browser_start_index
|
global browser_start_index
|
||||||
|
|
||||||
def num_lock_key(event):
|
|
||||||
global display_mode
|
|
||||||
if display_mode == "BROWSER":
|
|
||||||
display_mode = "LOOPER"
|
|
||||||
else:
|
|
||||||
display_mode = "BROWSER"
|
|
||||||
refresh_display()
|
|
||||||
|
|
||||||
def backspace_key(event):
|
def backspace_key(event):
|
||||||
global browser_index
|
try:
|
||||||
global data_object
|
global browser_index
|
||||||
global browser_start_index
|
global data_object
|
||||||
global browser_list
|
global browser_start_index
|
||||||
if display_mode == "BROWSER":
|
global browser_list
|
||||||
is_file, name = data_centre.extract_file_type_and_name_from_browser_format(
|
global current_message
|
||||||
browser_list[browser_index + browser_start_index][0])
|
if display_mode == "BROWSER":
|
||||||
if is_file:
|
is_file, name = data_centre.extract_file_type_and_name_from_browser_format(
|
||||||
data_centre.create_new_bank_mapping_in_first_open(name)
|
browser_list[browser_index + browser_start_index][0])
|
||||||
else:
|
if is_file:
|
||||||
data_object.update_open_folders(name)
|
data_centre.create_new_bank_mapping_in_first_open(name)
|
||||||
data_object.rewrite_browser_list()
|
else:
|
||||||
browser_list = data_object.get_browser_data_for_display()
|
data_object.update_open_folders(name)
|
||||||
refresh_display()
|
data_object.rewrite_browser_list()
|
||||||
|
browser_list = data_object.get_browser_data_for_display()
|
||||||
|
refresh_display()
|
||||||
|
except Exception as e:
|
||||||
|
print 'the current message is: {}'.format(e.message)
|
||||||
|
current_message = e.message
|
||||||
|
|
||||||
|
|
||||||
def update_screen():
|
def update_screen():
|
||||||
@@ -263,8 +290,13 @@ display.bind("<BackSpace>", backspace_key)
|
|||||||
display.bind("<Num_Lock>", num_lock_key)
|
display.bind("<Num_Lock>", num_lock_key)
|
||||||
display.bind("<Button-1>", callback)
|
display.bind("<Button-1>", callback)
|
||||||
|
|
||||||
|
|
||||||
frame.pack()
|
frame.pack()
|
||||||
|
|
||||||
tk.attributes("-fullscreen", True)
|
tk.attributes("-fullscreen", True)
|
||||||
tk.after(1000, update_screen)
|
tk.after(1000, update_screen)
|
||||||
tk.mainloop()
|
|
||||||
|
try:
|
||||||
|
tk.mainloop()
|
||||||
|
except:
|
||||||
|
current_message = traceback.print_tb(exc_traceback, limit=1, file=sys.stdout)
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
[{"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": 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": ""}]
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
6
|
0
|
||||||
|
|||||||
@@ -174,8 +174,19 @@ class video_player(object):
|
|||||||
self.omx.stop()
|
self.omx.stop()
|
||||||
self.omx = OMXDriver(self.widget, '')
|
self.omx = OMXDriver(self.widget, '')
|
||||||
|
|
||||||
def pause_content(self):
|
def toggle_pause(self):
|
||||||
self.status = 'PAUSED'
|
is_paused = self.omx.omxplayer_is_paused()
|
||||||
|
print is_paused
|
||||||
|
if is_paused == 'RUNNING':
|
||||||
|
if self.omx.send_pause():
|
||||||
|
self.status = 'PAUSED'
|
||||||
|
return
|
||||||
|
elif is_paused == 'PAUSED':
|
||||||
|
if self.omx.send_unpause():
|
||||||
|
self.status = 'PLAYING'
|
||||||
|
return
|
||||||
|
print 'failed to toggle pause (this needs to be in message)'
|
||||||
|
|
||||||
|
|
||||||
# tk = Tk()
|
# tk = Tk()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user