Gamaliel Espinoza Macedo 6 年之前
父節點
當前提交
962f99254d
共有 1 個文件被更改,包括 4 次插入8 次删除
  1. 4 8
      ondemand/service.py

+ 4 - 8
ondemand/service.py

@@ -70,7 +70,6 @@ recognizer = FilePerSecondRecognizer
 # settings
 # settings
 queue_mode = QUEUE_THREAD
 queue_mode = QUEUE_THREAD
 threshold_mode = THRESHOLD_FIXED
 threshold_mode = THRESHOLD_FIXED
-should_index_empty = True
 
 
 db_path = config.get('localDatabase', os.path.join(device_path, 'files.db'))
 db_path = config.get('localDatabase', os.path.join(device_path, 'files.db'))
 db = sqlite3.connect(db_path)
 db = sqlite3.connect(db_path)
@@ -217,14 +216,11 @@ def process_segment(item, audios=None):
                 values.append(str(match['confidence']))
                 values.append(str(match['confidence']))
 
 
             except KeyError as ex:
             except KeyError as ex:
-                if should_index_empty:
-                    results.append({
-                        'confidence': 0,
-                        'timestamp': ts,
-                        'offset': match['offset']
-                    })
-                else:
+                the_key = str(ex)
+                if the_key == 'confidence':
                     log.warning('Invalid confidence')
                     log.warning('Invalid confidence')
+                else:
+                    log.warning(the_key)
 
 
             ts += match['length'] / 1000
             ts += match['length'] / 1000