Explorar el Código

Missing files

Gamaliel Espinoza hace 6 años
padre
commit
767b28ae16
Se han modificado 1 ficheros con 4 adiciones y 0 borrados
  1. 4 0
      ondemand/service.py

+ 4 - 0
ondemand/service.py

@@ -98,9 +98,11 @@ def process_segment(item):
         print('cannot fingerprint: {}'.format(ex))
 
     # 2. Read the list of files from local database
+    audios_counter = 0
     results = []
     for path, name, ts in iterate_audios(date, station):
         print(path)
+        audios_counter += os.path.isfile(path)
         for match in dejavu.recognize(recognizer, path, 5,
                                       ads_filter=[md5hash]):
             try:
@@ -121,6 +123,8 @@ def process_segment(item):
             item['id'],
             None, # TODO: send results again
             found=find_repetitions(results),
+            missing_files=(12 - audios_counter) \
+                          if audios_counter < 12 else 0
         )
 
         print("api response: {}".format(response))