浏览代码

empty indexing

Gamaliel Espinoza Macedo 6 年之前
父节点
当前提交
8be45e283f
共有 1 个文件被更改,包括 10 次插入2 次删除
  1. 10 2
      ondemand/service.py

+ 10 - 2
ondemand/service.py

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