def __init__(self,g_pool,session_name = get_auto_name(),rec_dir=None, user_info={'name':'','additional_field':'change_me'},info_menu_conf={},show_info_menu=False, record_eye = False, audio_src = 'No Audio',raw_jpeg=False): super(Recorder, self).__init__(g_pool) #update name if it was autogenerated. if session_name.startswith('20') and len(session_name)==10: session_name = get_auto_name() if rec_dir: self.set_rec_dir(rec_dir) else: #lets make a rec dir next to the user dir base_dir = self.g_pool.user_dir.rsplit(os.path.sep,1)[0] self.rec_dir = os.path.join(base_dir,'recordings') if not os.path.isdir(self.rec_dir): os.mkdir(self.rec_dir) self.raw_jpeg = raw_jpeg self.order = .9 self.record_eye = record_eye self.session_name = session_name self.audio_devices_dict = Audio_Input_Dict() if audio_src in self.audio_devices_dict.keys(): self.audio_src = audio_src else: self.audio_src = 'No Audio' self.running = False self.menu = None self.button = None self.user_info = user_info self.show_info_menu = show_info_menu self.info_menu = None self.info_menu_conf = info_menu_conf self.height, self.width = self.g_pool.capture.frame_size
def __init__(self, g_pool, session_name=get_auto_name(), rec_dir=None, user_info={ 'name': '', 'additional_field': 'change_me' }, info_menu_conf={}, show_info_menu=False, record_eye=False, audio_src='No Audio', raw_jpeg=True): super(Recorder, self).__init__(g_pool) #update name if it was autogenerated. if session_name.startswith('20') and len(session_name) == 10: session_name = get_auto_name() base_dir = self.g_pool.user_dir.rsplit(os.path.sep, 1)[0] default_rec_dir = os.path.join(base_dir, 'recordings') if rec_dir and rec_dir != default_rec_dir and self.verify_path( rec_dir): self.rec_dir = rec_dir else: try: os.makedirs(default_rec_dir) except OSError as e: if e.errno != errno.EEXIST: logger.error("Could not create Rec dir") raise e else: logger.info('Created standard Rec dir at "%s"' % default_rec_dir) self.rec_dir = default_rec_dir self.raw_jpeg = raw_jpeg self.order = .9 self.record_eye = record_eye self.session_name = session_name self.audio_devices_dict = Audio_Input_Dict() if audio_src in self.audio_devices_dict.keys(): self.audio_src = audio_src else: self.audio_src = 'No Audio' self.running = False self.menu = None self.button = None self.user_info = user_info self.show_info_menu = show_info_menu self.info_menu = None self.info_menu_conf = info_menu_conf
def audio_dev_getter(): # fetch list of currently available audio_src_val = None if self.audio_devices_dict is not None: if self.audio_src in self.audio_devices_dict.keys(): audio_src_val = self.audio_devices_dict[self.audio_src] self.audio_devices_dict = Audio_Input_Dict() if audio_src_val is not None: self.audio_devices_dict[self.audio_src] = audio_src_val devices = list(self.audio_devices_dict.keys()) return devices, devices
def __init__(self, g_pool, audio_src='No Audio'): super().__init__(g_pool) self.audio_devices_dict = Audio_Input_Dict() if audio_src in list(self.audio_devices_dict.keys()): self.audio_src = audio_src else: self.audio_src = 'No Audio' self.thread = None self.running = Event() self.audio_container = None self.audio_out_stream = None self.queue = queue.Queue() self.start_capture(self.audio_src)
def audio_dev_getter(): # fetch list of currently available self.audio_devices_dict = Audio_Input_Dict() devices = list(self.audio_devices_dict.keys()) return devices, devices
def __init__(self, g_pool, session_name=get_auto_name(), rec_dir=None, user_info={ 'name': '', 'additional_field': 'change_me' }, info_menu_conf={}, show_info_menu=False, record_eye=False, audio_src='No Audio', raw_jpeg=False): super(Recorder, self).__init__(g_pool) self.states = ['start', 'want', 'pick'] self.all_qr = { 'termo1': 75, 'light1': False, 'light2': False, 'light3': False } self.this_state = 'start' self.start_state = time() self.qr_codes = {} self.gaze_x = -1 self.gaze_y = -1 self.avg_col = 0 self.choice = "" #update name if it was autogenerated. if session_name.startswith('20') and len(session_name) == 10: session_name = get_auto_name() base_dir = self.g_pool.user_dir.rsplit(os.path.sep, 1)[0] default_rec_dir = os.path.join(base_dir, 'recordings') if rec_dir and rec_dir != default_rec_dir and self.verify_path( rec_dir): self.rec_dir = rec_dir else: try: os.makedirs(default_rec_dir) except OSError as e: if 'File exists' in '%s' % e: pass else: logger.error("Could not create Rec dir") raise e else: logger.info('Created standard Rec dir at "%s"' % default_rec_dir) self.rec_dir = default_rec_dir # if rec_dir and rec_dir != default_rec_dir and self.verify_path(rec_dir): # self.rec_dir = rec_dir # else: # #lets make a rec dir next to the user dir # base_dir = self.g_pool.user_dir.rsplit(os.path.sep,1)[0] # self.rec_dir = os.path.join(base_dir,'recordings') # if not os.path.isdir(self.rec_dir): # os.mkdir(self.rec_dir) self.raw_jpeg = raw_jpeg self.order = .9 self.record_eye = record_eye self.session_name = session_name self.audio_devices_dict = Audio_Input_Dict() if audio_src in self.audio_devices_dict.keys(): self.audio_src = audio_src else: self.audio_src = 'No Audio' self.running = False self.menu = None self.button = None self.user_info = user_info self.show_info_menu = show_info_menu self.info_menu = None self.info_menu_conf = info_menu_conf self.height, self.width = self.g_pool.capture.frame_size