updated the function key to switch off after use

This commit is contained in:
langolierz
2018-04-20 03:53:00 +00:00
parent d41647d417
commit 9bc4369cf2
6 changed files with 26 additions and 3 deletions

View File

@@ -20,7 +20,6 @@ class Actions(object):
is_file, name = self.data.browser_data.extract_file_type_and_name_from_browser_format(
self.data.return_browser_list()[self.display.selected_list_index]['name'])
if is_file:
print('name: {}'.format(name))
is_successful = self.data.create_new_slot_mapping_in_first_open(name, self.display.bank_number)
if not is_successful:
self.message_handler.set_message('INFO', 'current bank is full')

View File

@@ -195,6 +195,11 @@ class Data(object):
return True, '{}/{}'.format(root, file_name)
return False, ''
@staticmethod
def _get_mb_free_diskspace(path):
st = os.statvfs(path)
return st.f_bavail * st.f_frsize / 1024 / 1024
@staticmethod
def _update_a_slots_data(bank_number, slot_number, slot_info):
######## overwrite a given slots info with new data ########

View File

@@ -1 +1 @@
[[{"length": 52.757, "rate": 1, "name": "colour_pixal_03.mp4", "end": -1, "start": 23.878, "location": "/home/pi/Videos/internal_storage/colour_pixal_03.mp4"}, {"length": -1, "rate": 1, "name": "", "end": -1, "start": -1, "location": ""}, {"length": -1, "rate": 1, "name": "", "end": -1, "start": -1, "location": ""}, {"length": -1, "rate": 1, "name": "", "end": -1, "start": -1, "location": ""}, {"length": -1, "rate": 1, "name": "", "end": -1, "start": -1, "location": ""}, {"length": -1, "rate": 1, "name": "", "end": -1, "start": -1, "location": ""}, {"length": -1, "rate": 1, "name": "", "end": -1, "start": -1, "location": ""}, {"length": -1, "rate": 1, "name": "", "end": -1, "start": -1, "location": ""}, {"length": -1, "rate": 1, "name": "", "end": -1, "start": -1, "location": ""}, {"length": -1, "rate": 1, "name": "", "end": -1, "start": -1, "location": ""}], [{"length": -1, "rate": 1, "name": "", "end": -1, "start": -1, "location": ""}, {"length": -1, "rate": 1, "name": "", "end": -1, "start": -1, "location": ""}, {"length": -1, "rate": 1, "name": "", "end": -1, "start": -1, "location": ""}, {"length": -1, "rate": 1, "name": "", "end": -1, "start": -1, "location": ""}, {"length": -1, "rate": 1, "name": "", "end": -1, "start": -1, "location": ""}, {"length": -1, "rate": 1, "name": "", "end": -1, "start": -1, "location": ""}, {"length": -1, "rate": 1, "name": "", "end": -1, "start": -1, "location": ""}, {"length": -1, "rate": 1, "name": "", "end": -1, "start": -1, "location": ""}, {"length": -1, "rate": 1, "name": "", "end": -1, "start": -1, "location": ""}, {"length": -1, "rate": 1, "name": "", "end": -1, "start": -1, "location": ""}]]
[[{"start": -1, "length": 52.757, "end": -1, "location": "/home/pi/Videos/internal_storage/colour_pixal_03.mp4", "rate": 1, "name": "colour_pixal_03.mp4"}, {"start": -1, "length": 41.28, "end": -1, "location": "/home/pi/Videos/recordings/rec-2018-04-20-0.mp4", "rate": 1, "name": "rec-2018-04-20-0.mp4"}, {"start": -1, "length": 16.96, "end": -1, "location": "/home/pi/Videos/recordings/rec-2018-04-20-1.mp4", "rate": 1, "name": "rec-2018-04-20-1.mp4"}, {"start": -1, "length": -1, "end": -1, "location": "", "rate": 1, "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "rate": 1, "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "rate": 1, "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "rate": 1, "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "rate": 1, "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "rate": 1, "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "rate": 1, "name": ""}], [{"start": -1, "length": -1, "end": -1, "location": "", "rate": 1, "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "rate": 1, "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "rate": 1, "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "rate": 1, "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "rate": 1, "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "rate": 1, "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "rate": 1, "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "rate": 1, "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "rate": 1, "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "rate": 1, "name": ""}]]

View File

@@ -60,6 +60,7 @@ class MidiInput(object):
if self.message_handler.function_on and len(this_mapping[mode]) > 1:
method_name = this_mapping[mode][1]
self.message_handler.function_on = False
else:
method_name = this_mapping[mode][0]

View File

@@ -37,6 +37,7 @@ class NumpadInput(object):
if self.message_handler.function_on and len(this_mapping[mode]) > 1:
print('the action being called is {}'.format(this_mapping[mode][1]))
getattr(self.actions, this_mapping[mode][1])()
self.message_handler.function_on = False
else:
print('the action being called is {}'.format(this_mapping[mode][0]))
getattr(self.actions, this_mapping[mode][0])()

View File

@@ -52,14 +52,31 @@ class Capture(object):
if self.use_capture == False:
self.message_handler.set_message('INFO', 'capture not enabled')
return
if not self.check_available_disk_space():
return
if self.device.closed:
self.create_capture_device()
# need to check the space in destination (or check in a main loop somewhere ?)
if not os.path.exists(self.video_dir):
os.makedirs(self.video_dir)
self.is_recording = True
self.device.start_recording(self.video_dir + '/raw.h264')
self.monitor_disk_space()
def monitor_disk_space(self):
if self.is_recording:
if self.check_available_disk_space():
self.root.after(10000, self.monitor_disk_space)
else:
self.stop_recording()
def check_available_disk_space(self):
mb_free = self.data._get_mb_free_diskspace(self.video_dir)
if mb_free < 10:
self.message_handler.set_message('INFO', 'insufficient space on disk')
return False
else:
return True
def stop_recording(self):
self.device.stop_recording()