Parcourir la source

empty indexing

Gamaliel Espinoza Macedo il y a 6 ans
Parent
commit
8be45e283f
1 fichiers modifiés avec 10 ajouts et 2 suppressions
  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)