changeset 60:c75a79b86c98

Merge branch 'master' of https://github.com/amsehili/auditok
author Amine SEHILI <amine.sehili@gmail.com>
date Fri, 13 May 2016 23:01:29 +0200
parents fec5a439eb66 (diff) ccff9ac72d27 (current diff)
children 9e9c6b1a25b1 4a7a0cada270 384e2d9b43ba d276343fe86d
files
diffstat 2 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/auditok/__init__.py	Fri Apr 15 12:03:23 2016 +0200
+++ b/auditok/__init__.py	Fri May 13 23:01:29 2016 +0200
@@ -16,6 +16,6 @@
 from . import dataset
 from .exceptions import *
 
-__version__ = "0.1.5"
+__version__ = "0.1.6"
 
 
--- a/auditok/cmdline.py	Fri Apr 15 12:03:23 2016 +0200
+++ b/auditok/cmdline.py	Fri May 13 23:01:29 2016 +0200
@@ -9,12 +9,12 @@
 
 @author:     Mohamed El Amine SEHILI
 
-@copyright:  2015 Mohamed El Amine SEHILI
+@copyright:  2015-2016 Mohamed El Amine SEHILI
 
 @license:    GPL v3
 
 @contact:    amine.sehili@gmail.com
-@deffield    updated: 02 Dec 2015
+@deffield    updated: 13 May 2016
 '''
 
 import sys
@@ -52,7 +52,7 @@
 __all__ = []
 __version__ = version
 __date__ = '2015-11-23'
-__updated__ = '2015-03-11'
+__updated__ = '2016-05-13'
 
 DEBUG = 0
 TESTRUN = 1
@@ -511,6 +511,7 @@
                 end = message.pop("end", None)
                 start_time = message.pop("start_time", None)
                 end_time = message.pop("end_time", None)
+                duration = message.pop("duration", None)
                 if audio_data is not None and len(audio_data) > 0:
                     
                     if self.debug:
@@ -521,7 +522,7 @@
                     if self.print_detections:
                         print(self.output_format.format(id = _id,
                             start = self.time_formatter(start_time),
-                            end = self.time_formatter(end_time)))
+                            end = self.time_formatter(end_time), duration = self.time_formatter(duration)))
                         
                     self.detections.append((_id, start, end, start_time, end_time))
                    
@@ -582,7 +583,7 @@
         group.add_option("-E", "--echo", dest="echo", help="Play back each detection immediately using pyaudio [default: do not play]",  action="store_true", default=False)
         group.add_option("-p", "--plot", dest="plot", help="Plot and show audio signal and detections (requires matplotlib)",  action="store_true", default=False)
         group.add_option("", "--save-image", dest="save_image", help="Save plotted audio signal and detections as a picture or a PDF file (requires matplotlib)",  type=str, default=None, metavar="FILE")
-        group.add_option("", "--printf", dest="printf", help="print detections one per line using a user supplied format (e.g. '[{id}]: {start} -- {end}'). Available keywords {id}, {start} and {end}",  type=str, default="{id} {start} {end}", metavar="STRING")
+        group.add_option("", "--printf", dest="printf", help="print detections, one per line, using a user supplied format (e.g. '[{id}]: {start} -- {end}'). Available keywords {id}, {start}, {end} and {duration}",  type=str, default="{id} {start} {end}", metavar="STRING")
         group.add_option("", "--time-format", dest="time_format", help="format used to print {start} and {end}. [Default= %default]. %S: absolute time in sec. %I: absolute time in ms. If at least one of (%h, %m, %s, %i) is used, convert time into hours, minutes, seconds and millis (e.g. %h:%m:%s.%i). Only required fields are printed",  type=str, default="%S", metavar="STRING")
         parser.add_option_group(group)