Gamaliel Espinoza Macedo 6 years ago
parent
commit
ee587a93e1
1 changed files with 7 additions and 11 deletions
  1. 7 11
      ondemand/service.py

+ 7 - 11
ondemand/service.py

@@ -217,18 +217,14 @@ def process_segment(item, audios=None):
                 values.append(str(match['confidence']))
 
             except KeyError as ex:
-                the_key = str(ex)
-                if the_key == 'confidence':
-                    if should_index_empty:
-                        results.append({
-                            'confidence': 0,
-                            'timestamp': ts,
-                            'offset': match['offset']
-                        })
-                    else:
-                        log.warning('Invalid confidence')
+                if should_index_empty:
+                    results.append({
+                        'confidence': 0,
+                        'timestamp': ts,
+                        'offset': match['offset']
+                    })
                 else:
-                    log.warning(the_key)
+                    log.warning('Invalid confidence')
 
             ts += match['length'] / 1000