|
@@ -210,10 +210,12 @@ def process_segment(item, audios=None, calibration=None):
|
|
|
# y calcular su fingerprint.
|
|
|
try:
|
|
|
filenames = []
|
|
|
+ id_by_ad = {}
|
|
|
x = 0
|
|
|
for i in item["elementos"]:
|
|
|
x = x + 1
|
|
|
log.info('[process_segment] {} downloading ad {}'.format(x, i["anuncio"]))
|
|
|
+ id_by_ad[i['anuncio']] = i['id']
|
|
|
filename, md5hash = cloud_download(ad_key=i["anuncio"])
|
|
|
if filename:
|
|
|
filenames.append((filename, md5hash))
|
|
@@ -282,7 +284,11 @@ def process_segment(item, audios=None, calibration=None):
|
|
|
for match in dejavu.recognize(recognizer, path, segment_size):
|
|
|
name = None
|
|
|
try:
|
|
|
- name = match['name']
|
|
|
+ if match['name'] in id_by_ad.keys():
|
|
|
+ name = id_by_ad[match['name']]
|
|
|
+ else:
|
|
|
+ name = match['name']
|
|
|
+
|
|
|
except KeyError:
|
|
|
pass
|
|
|
|
|
@@ -308,7 +314,7 @@ def process_segment(item, audios=None, calibration=None):
|
|
|
|
|
|
try:
|
|
|
for i in item["elementos"]:
|
|
|
- r = [result for result in results if result["name"] == i["anuncio"]]
|
|
|
+ r = [result for result in results if result["name"] == i["id"]]
|
|
|
i['encontrados'] = find_repetitions(r, segments_needed=segments_needed, calibration=calibration,)
|
|
|
|
|
|
item["archivos_perdidos"] = (12 - audios_counter) if audios_counter < 12 else 0
|