|
@@ -82,32 +82,12 @@ def descargar_media(box, station, media):
|
|
return None
|
|
return None
|
|
|
|
|
|
|
|
|
|
-def obt_calibracion(calibracion):
|
|
|
|
- default = {
|
|
|
|
- 'threshold': 12,
|
|
|
|
- 'tolerance': 0.8,
|
|
|
|
- 'fallTolerance': 1,
|
|
|
|
- 'segmentSize': 5,
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if 'threshold' in calibracion:
|
|
|
|
- default['threshold'] = calibracion['threshold']
|
|
|
|
- if 'tolerance' in calibracion:
|
|
|
|
- default['tolerance'] = calibracion['tolerance']
|
|
|
|
- if 'segmentSize' in calibracion:
|
|
|
|
- default['segmentSize'] = calibracion['segmentSize']
|
|
|
|
- if 'fallTolerance' in calibracion:
|
|
|
|
- default['fallTolerance'] = calibracion['fallTolerance']
|
|
|
|
-
|
|
|
|
- return default
|
|
|
|
-
|
|
|
|
-
|
|
|
|
def enviar_resultados(trabajo):
|
|
def enviar_resultados(trabajo):
|
|
log.info('[Pendiente] %s' % (json.dumps(trabajo),))
|
|
log.info('[Pendiente] %s' % (json.dumps(trabajo),))
|
|
url = 'https://api.fourier.audio/v1/calendario/resultado'
|
|
url = 'https://api.fourier.audio/v1/calendario/resultado'
|
|
- response = requests.post(url, json=trabajo)
|
|
|
|
- log.info('[Response] %s' % (response.text))
|
|
|
|
- return response
|
|
|
|
|
|
+ # response = requests.post(url, json=trabajo)
|
|
|
|
+ # log.info('[Response] %s' % (response.text))
|
|
|
|
+ # return response
|
|
|
|
|
|
|
|
|
|
def llenar_pila():
|
|
def llenar_pila():
|
|
@@ -169,7 +149,7 @@ def procesar_trabajo(pendiente):
|
|
log.info('[process_segment] [{}] {}'.format(estacion, err))
|
|
log.info('[process_segment] [{}] {}'.format(estacion, err))
|
|
|
|
|
|
# Descarga de media
|
|
# Descarga de media
|
|
- log.info("Descargando anuncios")
|
|
|
|
|
|
+ log.info("Descargando media")
|
|
try:
|
|
try:
|
|
media = []
|
|
media = []
|
|
for i in pendiente["media"]:
|
|
for i in pendiente["media"]:
|
|
@@ -199,11 +179,11 @@ def procesar_trabajo(pendiente):
|
|
|
|
|
|
for anuncio in anuncios:
|
|
for anuncio in anuncios:
|
|
log.info("Buscando anuncio %s" % (anuncio,))
|
|
log.info("Buscando anuncio %s" % (anuncio,))
|
|
- for i in dejavu.recognize(recognizer, anuncio, 5):
|
|
|
|
|
|
+ for i in dejavu.recognize(recognizer, anuncio, 10):
|
|
if not "id" in i:
|
|
if not "id" in i:
|
|
continue
|
|
continue
|
|
|
|
|
|
- if i["confidence"] < 50:
|
|
|
|
|
|
+ if i["confidence"] < 35:
|
|
continue
|
|
continue
|
|
|
|
|
|
obj = i
|
|
obj = i
|
|
@@ -220,12 +200,12 @@ def procesar_trabajo(pendiente):
|
|
"desfase_segundos": obj["offset_seconds"]
|
|
"desfase_segundos": obj["offset_seconds"]
|
|
}
|
|
}
|
|
|
|
|
|
- if i["id"] in resultados.keys():
|
|
|
|
- resultados[i["id"]]["longitud"] = resultados[i["id"]]["longitud"] + dict["longitud"]
|
|
|
|
- resultados[i["id"]]["confianza"] = resultados[i["id"]]["confianza"] + dict["confianza"]
|
|
|
|
|
|
+ if id in resultados.keys():
|
|
|
|
+ resultados[id]["longitud"] += dict["longitud"]
|
|
|
|
+ resultados[id]["confianza"] += dict["confianza"]
|
|
continue
|
|
continue
|
|
|
|
|
|
- resultados[i["id"]] = dict
|
|
|
|
|
|
+ resultados[id] = dict
|
|
|
|
|
|
for id in resultados:
|
|
for id in resultados:
|
|
e = resultados[id]
|
|
e = resultados[id]
|