|
@@ -164,55 +164,57 @@ def procesar_trabajo(pendiente):
|
|
|
except Exception as err:
|
|
|
log.info(err)
|
|
|
|
|
|
- if len(media) == 0 or len(anuncio) == 0:
|
|
|
- log.info("No hay media o anuncios para comparar")
|
|
|
- return
|
|
|
-
|
|
|
- dejavu = None
|
|
|
- resultados = {}
|
|
|
try:
|
|
|
- dejavu = Dejavu({"database_type": "mem"})
|
|
|
- try:
|
|
|
- x = 0
|
|
|
- for ruta, fecha, ts in media:
|
|
|
- log.info("Huellando %s" % (ruta,))
|
|
|
- dejavu.fingerprint_file(ruta, ts)
|
|
|
- except Exception as ex:
|
|
|
- log.info(ex)
|
|
|
-
|
|
|
- for anuncio in anuncios:
|
|
|
- log.info("Buscando anuncio %s" % (anuncio,))
|
|
|
- for i in dejavu.recognize(recognizer, anuncio, segmento):
|
|
|
- if not "id" in i:
|
|
|
- continue
|
|
|
-
|
|
|
- if i["confidence"] < 35:
|
|
|
- continue
|
|
|
-
|
|
|
- obj = i
|
|
|
- obj["match_time"] = None
|
|
|
- nombre_anuncio = os.path.split(anuncio)[-1]
|
|
|
- id = id_by_ad[nombre_anuncio]
|
|
|
- dict = {
|
|
|
- "id": id,
|
|
|
- "anuncio": anuncio,
|
|
|
- "fecha": obj["name"],
|
|
|
- "timestamp": obj["name"] + int(obj['offset_seconds']),
|
|
|
- "confianza": obj["confidence"],
|
|
|
- "longitud": obj["length"],
|
|
|
- "desfase_segundos": obj["offset_seconds"]
|
|
|
- }
|
|
|
-
|
|
|
- if id in resultados.keys():
|
|
|
- resultados[id]["longitud"] += dict["longitud"]
|
|
|
- resultados[id]["confianza"] += dict["confianza"]
|
|
|
- continue
|
|
|
-
|
|
|
- resultados[id] = dict
|
|
|
+
|
|
|
+ dejavu = None
|
|
|
+ resultados = {}
|
|
|
+ if len(media) > 0 or len(anuncio) > 0:
|
|
|
+ dejavu = Dejavu({"database_type": "mem"})
|
|
|
+ try:
|
|
|
+ x = 0
|
|
|
+ for ruta, fecha, ts in media:
|
|
|
+ log.info("Huellando %s" % (ruta,))
|
|
|
+ dejavu.fingerprint_file(ruta, ts)
|
|
|
+ except Exception as ex:
|
|
|
+ log.info(ex)
|
|
|
+
|
|
|
+ for anuncio in anuncios:
|
|
|
+ log.info("Buscando anuncio %s" % (anuncio,))
|
|
|
+ for i in dejavu.recognize(recognizer, anuncio, segmento):
|
|
|
+ if not "id" in i:
|
|
|
+ continue
|
|
|
+
|
|
|
+ if i["confidence"] < 35:
|
|
|
+ continue
|
|
|
+
|
|
|
+ obj = i
|
|
|
+ obj["match_time"] = None
|
|
|
+ nombre_anuncio = os.path.split(anuncio)[-1]
|
|
|
+ id = id_by_ad[nombre_anuncio]
|
|
|
+ dict = {
|
|
|
+ "id": id,
|
|
|
+ "anuncio": anuncio,
|
|
|
+ "fecha": obj["name"],
|
|
|
+ "timestamp": obj["name"] + int(obj['offset_seconds']),
|
|
|
+ "confianza": obj["confidence"],
|
|
|
+ "longitud": obj["length"],
|
|
|
+ "desfase_segundos": obj["offset_seconds"]
|
|
|
+ }
|
|
|
+
|
|
|
+ if id in resultados.keys():
|
|
|
+ resultados[id]["longitud"] += dict["longitud"]
|
|
|
+ resultados[id]["confianza"] += dict["confianza"]
|
|
|
+ continue
|
|
|
+
|
|
|
+ resultados[id] = dict
|
|
|
+ else:
|
|
|
+ for i in pendiente['elementos']:
|
|
|
+ i['comentario'] = 'Problemas técnicos'
|
|
|
|
|
|
for id in resultados:
|
|
|
e = resultados[id]
|
|
|
for i in pendiente['elementos']:
|
|
|
+ i['comentario'] = ''
|
|
|
anuncio = e['anuncio'].replace('/tmp/ads/', '')
|
|
|
if i['id'] == e['id'] and i['anuncio'] == anuncio:
|
|
|
if 'encontrados' not in i:
|