Kaynağa Gözat

more logging

Gamaliel Espinoza Macedo 6 yıl önce
ebeveyn
işleme
edc101f9b7
1 değiştirilmiş dosya ile 7 ekleme ve 5 silme
  1. 7 5
      ondemand/service.py

+ 7 - 5
ondemand/service.py

@@ -56,8 +56,8 @@ def feed_queue():
             queue.put(item)
 
         if downloaded_counter:
-            log.info('[feed_queue] {} new '
-                    + 'pending schedule items.'\
+            log.info(('[feed_queue] {} new '
+                    + 'pending schedule items.')\
                     .format(downloaded_counter)
                     )
 
@@ -95,6 +95,8 @@ def process_segment(item):
     station = item['station']
     date = dateutil.parser.parse(item['date'])
 
+    log.info('processing segment: {}'.format(item))
+
     # 1. obtener el audio desde firebase
     #    y calcular su fingerprint.
     filename, md5hash = cloud_download(ad_key=item['ad'])
@@ -121,7 +123,7 @@ def process_segment(item):
     audios_counter = 0
     results = []
     for path, name, ts in iterate_audios(date, station):
-        print(path)
+        log.info('file: {}'.format(path))
         audios_counter += os.path.isfile(path)
         for match in dejavu.recognize(recognizer, path, 5,
                                       ads_filter=[md5hash]):
@@ -148,7 +150,7 @@ def process_segment(item):
             missing_files=(12 - audios_counter) \
                           if audios_counter < 12 else 0
         )
-        log.info('api response: {}'.format(response))
+        log.info('API response: {}'.format(response))
     except ConnectionError as ex:
         log.error(str(ex))
     except UserWarning as warn:
@@ -194,7 +196,7 @@ def iterate_audios(dt, station):
               - AHEAD_TIME_AUDIO_TOLERANCE
     to_time = from_time + 3599 + AHEAD_TIME_AUDIO_TOLERANCE
 
-    log.info('from {} to {}'.format(from_time, to_time))
+    log.info('from {} to {}'.format(int(from_time), int(to_time)))
 
     cursor = db.cursor()
     cursor.execute((