Esempio n. 1
0
    def write_dr( self , drm , tm ):
        txt = ""
        
        ( head , album_dir ) = os.path.split( drm.dir_name )
        
        txt = tm.new_table(txt)
        
        txt = tm.new_head( txt )
        
        txt = tm.append_separator_line( txt )
        txt = tm.add_title( txt , " Analyzed folder:  " + album_dir )
        
        txt = tm.end_head( txt )
        
        txt = tm.new_tbody( txt )
        
        txt = tm.append_separator_line( txt )
        txt = tm.append_row( txt , [ " DR", "Peak", "RMS", "Duration" , "File name" ] , 'h' )
        txt = tm.append_separator_line( txt )
        
        for i in range( len( drm.res_list ) ) :
            
            if drm.res_list[i]['dr14'] > dr14.min_dr() :
                row = []
                row.append( " DR%d" % drm.res_list[i]['dr14'] )
                row.append( " %.2f" % drm.res_list[i]['dB_peak'] + ' dB' )
                row.append( " %.2f" % drm.res_list[i]['dB_rms'] + ' dB' )
                row.append( " %s" % drm.res_list[i]['duration'] )
                row.append( " %s" % drm.res_list[i]['file_name'] )
            
                txt = tm.append_row( txt , row )

        txt = tm.end_tbody( txt )
        
        txt = tm.new_foot( txt )
        txt = tm.append_separator_line( txt )
               
        txt = tm.add_title( txt , "Number of files:    " + str(len( drm.res_list )) )
        txt = tm.add_title( txt , "Official DR value:  DR%d" % int(drm.dr14) )
        
        txt = tm.append_empty_line( txt )
        txt = tm.add_title( txt , "Dr14 T.meter %s " % dr14.dr14_version() )
        
        txt = tm.append_closing_line( txt )
        txt = tm.end_foot( txt )
        
        txt = tm.end_table(txt)
        
        return txt 
Esempio n. 2
0
    def write_dr(self, drm, tm):

        (head, album_dir) = os.path.split(drm.dir_name)

        tm.new_table()

        tm.new_head()

        tm.append_separator_line()
        tm.add_title(" Analyzed folder:  " + album_dir)

        tm.end_head()

        tm.new_tbody()

        tm.append_separator_line()
        tm.append_row([" DR", "Peak", "RMS", "Duration", "File name"], 'h')
        tm.append_separator_line()

        for i in range(len(drm.res_list)):

            if drm.res_list[i]['dr14'] > dr14.min_dr():
                row = []
                row.append(" DR%d" % drm.res_list[i]['dr14'])
                row.append(" %.2f" % drm.res_list[i]['dB_peak'] + ' dB')
                row.append(" %.2f" % drm.res_list[i]['dB_rms'] + ' dB')
                row.append(" %s" % drm.res_list[i]['duration'])
                row.append(" %s" % drm.res_list[i]['file_name'])

                tm.append_row(row)

        tm.end_tbody()

        tm.new_foot()
        tm.append_separator_line()

        tm.add_title("Number of files:    " + str(len(drm.res_list)))
        tm.add_title("Official DR value:  DR%d" % int(drm.dr14))

        tm.append_empty_line()
        tm.add_title("Dr14 T.meter %s " % dr14.dr14_version())

        tm.append_closing_line()
        tm.end_foot()

        tm.end_table()

        return tm.write_table()
Esempio n. 3
0
 def write_dr( self , drm , tm ):
      
     ( head , album_dir ) = os.path.split( drm.dir_name )
     
     tm.new_table()
     
     tm.new_head()
     tm.append_separator_line()
     
     album_t = drm.meta_data.get_album_title()
     artist = drm.meta_data.get_album_artist()[0]
     
     if not isinstance( tm , table.TextTable ) :
         self.set_loudness_war_db_compatible( False )
     
     if self.get_loudness_war_db_compatible() :
     
         title = "" 
         
         if album_t == None :
             title = " Analyzed folder:  " + album_dir 
         else:
             title = " Analyzed: " + album_t 
             if artist != None :
                 title = title + " /  Artist: " + artist
         tm.add_title( title )
     
     else:
     
         if album_t == None :
             tm.add_title( " Analyzed folder:  " + album_dir )
         else:
             tm.add_title( " Album: " + album_t )
             if artist != None :
                 tm.add_title( " Artist: " + artist )
         
     
     tm.end_head()
     
     tm.new_tbody()
     
     tm.append_separator_line()
     tm.append_row( [ "DR", "Peak", "RMS", "Duration" , "Title [codec]" ] , 'h' )
     tm.append_separator_line()
     
     list_bit = []
     
     sum_kbs = 0
     cnt = 0
     
     sampl_rate = []
     
     d_nr = 0 ;        
     
     
     for i in range( len( drm.res_list ) ) :
         
         if drm.res_list[i]['dr14'] > dr14.min_dr() :
             row = []
             row.append( " DR%d" % drm.res_list[i]['dr14'] )
             row.append( " %.2f" % drm.res_list[i]['dB_peak'] + ' dB' )
             row.append( " %.2f" % drm.res_list[i]['dB_rms'] + ' dB' )
             row.append( drm.res_list[i]['duration'] )
             
             #print( "> " + drm.res_list[i]['file_name'] )
             
             curr_file_name = drm.res_list[i]['file_name']
             
             tr_title = drm.meta_data.get_value( curr_file_name , 'title' )
             #print( "> " + tr_title )
             if tr_title == None :
                 row.append( drm.res_list[i]['file_name'] )
             else:
                 nr = drm.meta_data.get_value( curr_file_name , 'track_nr' )
                 codec = drm.meta_data.get_value( curr_file_name , 'codec' )
                 
                 if nr == None :
                     nr = i + 1
                 
                 row.append( "%02d - %s \t [%s]" % ( nr , tr_title , codec ) )
                 
             bitrate = drm.meta_data.get_value( curr_file_name , 'bitrate' )
             bit = drm.meta_data.get_value( curr_file_name , 'bit' )
             s_rate = drm.meta_data.get_value( curr_file_name , 'sampling_rate' )
             
             kbs = drm.meta_data.get_value( curr_file_name , 'bitrate' )
             
             if kbs != None :
                 sum_kbs += int( kbs )
                 cnt = cnt + 1
                 
             if bit not in list_bit :
                 list_bit.append( bit )    
                     
             if s_rate not in sampl_rate :
                 sampl_rate.append( s_rate )
                 
             tm.append_row( row )
     
     tm.end_tbody()
     
     tm.new_foot()
     tm.append_separator_line()
            
     tm.add_title( " Number of files:    " + str(len( drm.res_list )) )
     tm.add_title( " Official DR value:  DR%d" % int(drm.dr14) )
     
     tm.append_empty_line()
     
     tm.add_title( " Sampling rate: \t\t %s Hz" % sampl_rate[0] )
     
     if cnt > 0:
         tm.add_title( " Average bitrate: \t\t %d kbs " % ( ( sum_kbs / 1000 ) / cnt )  )
     
     mf_bit = max( set( list_bit ) , key=list_bit.count )
     tm.add_title( " Bits per sample: \t\t %s bit" % ( mf_bit ) )
     
     tm.append_empty_line()
     tm.add_title( "Dr14 T.meter %s " % dr14.dr14_version() )
     
     tm.append_closing_line()
     tm.end_foot()
     
     tm.end_table()
     
     return tm.write_table()
Esempio n. 4
0
    def write_dr(self, drm, tm):

        (head, album_dir) = os.path.split(drm.dir_name)

        tm.new_table()

        tm.new_head()
        tm.append_separator_line()

        album_t = drm.meta_data.get_album_title()
        artist = drm.meta_data.get_album_artist()[0]

        if not isinstance(tm, table.TextTable):
            self.set_loudness_war_db_compatible(False)

        if self.get_loudness_war_db_compatible():

            title = ""

            if album_t == None:
                title = " Analyzed folder:  " + album_dir
            else:
                title = " Analyzed: " + album_t
                if artist != None:
                    title = title + " /  Artist: " + artist
            tm.add_title(title)

        else:

            if album_t == None:
                tm.add_title(" Analyzed folder:  " + album_dir)
            else:
                tm.add_title(" Album: " + album_t)
                if artist != None:
                    tm.add_title(" Artist: " + artist)

        tm.end_head()

        tm.new_tbody()

        tm.append_separator_line()
        tm.append_row(["DR", "Peak", "RMS", "Duration", "Title [codec]"], 'h')
        tm.append_separator_line()

        list_bit = []

        sum_kbs = 0
        cnt = 0

        sampl_rate = []

        d_nr = 0

        for i in range(len(drm.res_list)):

            if drm.res_list[i]['dr14'] > dr14.min_dr():
                row = []
                row.append(" DR%d" % drm.res_list[i]['dr14'])
                row.append(" %.2f" % drm.res_list[i]['dB_peak'] + ' dB')
                row.append(" %.2f" % drm.res_list[i]['dB_rms'] + ' dB')
                row.append(drm.res_list[i]['duration'])

                #print( "> " + drm.res_list[i]['file_name'] )

                curr_file_name = drm.res_list[i]['file_name']

                tr_title = drm.meta_data.get_value(curr_file_name, 'title')
                #print( "> " + tr_title )
                if tr_title == None:
                    row.append(drm.res_list[i]['file_name'])
                else:
                    nr = drm.meta_data.get_value(curr_file_name, 'track_nr')
                    codec = drm.meta_data.get_value(curr_file_name, 'codec')

                    if nr == None:
                        nr = i + 1

                    row.append("%02d - %s \t [%s]" % (nr, tr_title, codec))

                bitrate = drm.meta_data.get_value(curr_file_name, 'bitrate')
                bit = drm.meta_data.get_value(curr_file_name, 'bit')
                s_rate = drm.meta_data.get_value(curr_file_name,
                                                 'sampling_rate')

                kbs = drm.meta_data.get_value(curr_file_name, 'bitrate')

                if kbs != None:
                    sum_kbs += int(kbs)
                    cnt = cnt + 1

                if bit not in list_bit:
                    list_bit.append(bit)

                if s_rate not in sampl_rate:
                    sampl_rate.append(s_rate)

                tm.append_row(row)

        tm.end_tbody()

        tm.new_foot()
        tm.append_separator_line()

        tm.add_title(" Number of files:    " + str(len(drm.res_list)))
        tm.add_title(" Official DR value:  DR%d" % int(drm.dr14))

        tm.append_empty_line()

        tm.add_title(" Sampling rate: \t\t %s Hz" % sampl_rate[0])

        if cnt > 0:
            tm.add_title(" Average bitrate: \t\t %d kbs " %
                         ((sum_kbs / 1000) / cnt))

        mf_bit = max(set(list_bit), key=list_bit.count)
        tm.add_title(" Bits per sample: \t\t %s bit" % (mf_bit))

        tm.append_empty_line()
        tm.add_title("Dr14 T.meter %s " % dr14.dr14_version())

        tm.append_closing_line()
        tm.end_foot()

        tm.end_table()

        return tm.write_table()
Esempio n. 5
0
        #print ( "root:   " + self.root )
        #print ( "prefix: " + self.prefix )

        prefix = re.sub( r'^/' , '' , self.prefix )

        output = subprocess.Popen([os.path.join(man_dir, "install.sh")],
                stdout=subprocess.PIPE,
                cwd=man_dir,
                env=dict({"PREFIX": os.path.join( self.root , prefix ) }, **dict(os.environ))).communicate()[0]
        print( output )




setup(name = "dr14_tmeter",
    version = "%s" % dr14_version() ,
    description = "Compute the DR14 value of the given audio files",
    author = "Simone Riva",
    author_email = "simone.rva [at] gmail.com",
    url = "http://simon-r.github.com/dr14_t.meter",
    packages = ['dr14tmeter'],
    scripts = ["dr14_tmeter"],
    long_description = "Compute the DR14 value of the given audio files according to the algorithm decribed by the Pleasurize Music Foundation" ,
    classifiers=[
        'Development Status :: %s Stable' % dr14_version() ,
        'Environment :: Console',
        'Intended Audience :: Users',
        'License :: OSI Approved :: GPL-3.0+',
        'Operating System :: Linux',
        'Programming Language :: Python',
        'Topic :: Multimedia'] ,
Esempio n. 6
0
        #print ( "root:   " + self.root )
        #print ( "prefix: " + self.prefix )

        prefix = re.sub( r'^/' , '' , self.prefix )

        output = subprocess.Popen([os.path.join(man_dir, "install.sh")],
                stdout=subprocess.PIPE,
                cwd=man_dir,
                env=dict({"PREFIX": os.path.join( self.root , prefix ) }, **dict(os.environ))).communicate()[0]
        print( output )




setup(name = "dr14_tmeter",
    version = "%s" % dr14_version() ,
    description = "Compute the DR14 value of the given audio files",
    author = "Simone Riva",
    author_email = "simone.rva [at] gmail.com",
    url = "http://simon-r.github.com/dr14_t.meter",
    packages = ['dr14tmeter'],
    scripts = ["dr14_tmeter"],
    long_description = "Compute the DR14 value of the given audio files according to the algorithm decribed by the Pleasurize Music Foundation" ,
    classifiers=[
        'Development Status :: %s Stable' % dr14_version() ,
        'Environment :: Console',
        'Intended Audience :: Users',
        'License :: OSI Approved :: GPL-3.0+',
        'Operating System :: Linux',
        'Programming Language :: Python',
        'Topic :: Multimedia'] ,
Esempio n. 7
0
def parse_args():
    desc = "Compute the DR14 value of the audio files according to the algorithm " 
    desc =  desc + "described by the Pleasurize Music Foundation "
    desc =  desc + "Visit: http://www.dynamicrange.de/"

    parser = argparse.ArgumentParser( description=desc , version="%(prog)s " + dr14_version()  )


    parser.add_argument("-1", "--disable_multithread",
        action="store_true",
        dest="disable_multithread",
        help="Disable the multi-Core mode")
    
    parser.add_argument("-r", "--recursive",
        action="store_true",
        dest="recursive",
        help="Scan recursively the subdirectories")

    parser.add_argument("-a", "--append",
        action="store_true",
        dest="append",
        help="Append all results in a single file; it should be used in couple with -r")

    parser.add_argument("-b", "--basic_table",
        action="store_true",
        dest="basic_table",
        help="Write the resulting tables in the basic format")

    parser.add_argument("-n", "--turn_off_out",
        action="store_true",
        dest="turn_off_out",
        help="do not writes the output files")

    parser.add_argument("-p", "--print_std_out",
        action="store_true",
        dest="print_std_out",
        help="writes the full result on the std_out")

    parser.add_argument("-o", "--outdir",
        action="store",
        dest="out_dir",
        type=str,
        help="Write the resultings files into the given directory")
    
    parser.add_argument("-t", "--tables",
        action="store",
        choices = 'htbwa',
        dest="out_tables",
        default="t" ,
        help="Select the output files to be written. h=html t=text b=bbcode w=mediawiki a=all_formats")

    parser.add_argument("-d", "--dr_database",
        action="store_false",
        dest="dr_database",
        help="Output file compatible with the DR database at http:///www.dr.loudness-war.info" )

    parser.add_argument( "--hist" ,
        action="store_true",
        dest="histogram" ,
        help="Plot the histogram of dynamic of a single file and exit (beta)" )
    
    parser.add_argument("-f", "--file",
        action='store_true',
        dest="scan_file",
        help="Compute the DR14 of a single file and exit")

    parser.add_argument(
        dest="path_name",
        nargs='?',
        default='.'
        )
    
    return parser.parse_args()
Esempio n. 8
0
def main():

    options = parse_args()

    if options.version:
        print_msg(dr14_version())
        return

    init_log(logging.DEBUG)
    logging.disable(logging.INFO)

    numpy.seterr(all='ignore')

    #print( options )

    if options.enable_database:
        enable_database()
        return

    if options.disable_database:
        enable_db(False)
        print_msg("The local DR database is disabled! ")
        return

    if options.dump_database:
        db = dr_database_singletone().get()
        db.dump()
        return

    if db_is_enabled():
        db = dr_database_singletone().get()
        f = db.is_db_valid()

        if not f:
            print_err("It seems that there is some problem with the db ... ")
            fix_problematic_database()
            return

    if options.query != None:

        if not database_exists():
            print_err("Error: The database does not exists")
            print_err("Error: type dr14_tmeter -q for more info.")
            return

        if len(options.query) == 0:
            query_helper()
            return

        if options.query[0] not in [
                "help", "top", "top_alb", "worst", "worst_alb", "top_art",
                "hist", "evol", "codec"
        ]:

            print_err("Error: -q invalid parameter .")
            print_err("Error: type dr14_tmeter -q for more info.")
            return

        table_code = database_exec_query(options)

        if table_code is not None:
            print_out(table_code)

        return

    if options.path_name != None:
        path_name = os.path.abspath(options.path_name)
    else:
        path_name = os.path.abspath('.')

    if not (os.path.exists(path_name)):
        print_msg("Error: The input directory \"%s\"  does not exists!" %
                  path_name)
        return

    if options.out_dir and not (os.path.exists(options.out_dir)):
        print_msg(
            "Error (-o): The target directory \"%s\"  does not exists! " %
            options.out_dir)
        return

    if options.quiet:
        set_quiet_msg()

    if not options.quiet and not options.skip_version_check:
        l_ver = TestVer()
        l_ver.start()

    print_msg(path_name)
    print_msg("")

    if options.recursive:
        subdirlist = list_rec_dirs(path_name)
    else:
        subdirlist = []
        subdirlist.append(path_name)

    if run_analysis_opt(options, path_name):
        return 1

    if options.scan_file:

        dr = DynamicRangeMeter()

        dr.write_to_local_db(db_is_enabled())

        r = dr.scan_file(path_name)

        if r == 1:
            print_out("")
            print_out(dr.res_list[0]['file_name'] + " :")
            print_out("DR      = %d" % dr.res_list[0]['dr14'])
            print_out("Peak dB = %.2f" % dr.res_list[0]['dB_peak'])
            print_out("Rms dB  = %.2f" % dr.res_list[0]['dB_rms'])
            return 1
        else:
            print_msg("Error: invalid audio file")
            return 0

    if options.out_dir == "":
        out_dir = None
    else:
        out_dir = options.out_dir

    if options.append and out_dir == None:
        out_dir = path_name

    if options.files_list:
        (success, clock, r) = scan_files_list(options.path_name, options,
                                              out_dir)
    else:
        (success, clock, r) = scan_dir_list(subdirlist, options, out_dir)

    if success:
        print_msg("Success! ")
        print_msg("Elapsed time: %2.2f sec" % clock)
    else:
        print_msg("No audio files found\n")
        print_msg(
            " Usage: %s [options] path_name \n\nfor more details type \n%s --help\n"
            % (get_exe_name(), get_exe_name()))

    if sys.platform.startswith('linux') or sys.platform.startswith('darwin'):
        subprocess.call("stty sane", shell=True)

    if test_new_version():
        print_msg(
            "\n----------------------------------------------------------------------"
        )
        print_msg(
            " A new version of dr14_t.meter [ %s ] is available for download"
            " \n please visit: %s" % (get_new_version(), get_home_url()))

        print_msg(
            "----------------------------------------------------------------------\n"
        )

    if not database_exists():
        print_msg(" ")
        print_msg(" News ... News ... News ... News ... News  !!! ")
        print_msg(
            " With the version 2.0.0 there is the possibility to store all results in a database"
        )
        print_msg(" If you want to enable this database execute the command:")
        print_msg("  > %s --enable_database " % get_exe_name())
        print_msg("")
        print_msg(
            " for more details visit: http://dr14tmeter.sourceforge.net/index.php/DR_Database "
        )

    return r
Esempio n. 9
0
def main():
                
    options = parse_args()

    if options.version :
        print_msg( dr14_version() )
        return

    init_log( logging.DEBUG )
    logging.disable( logging.INFO )
    
    numpy.seterr(all='ignore')
    
    #print( options )

    if options.enable_database :
        enable_database()
        return 
    
    if options.disable_database :
        enable_db( False )
        print_msg( "The local DR database is disabled! " )
        return

    if options.dump_database :
        db = dr_database_singletone().get()
        db.dump() 
        return 
    
    if db_is_enabled() :
        db = dr_database_singletone().get()
        f = db.is_db_valid()
        
        if not f :
            print_err( "It seems that there is some problem with the db ... " )
            fix_problematic_database()
            return 
         

    if options.query != None :
        
        if not database_exists() :
            print_err( "Error: The database does not exists" )
            print_err( "Error: type dr14_tmeter -q for more info." )
            return 
        
        if len( options.query ) == 0 :
            query_helper()
            return 
        
        if options.query[0] not in [ "help" , "top" , "top_alb" , 
                                    "worst" , "worst_alb" , "top_art" ,
                                    "hist" , "evol" , "codec" ] :
            
            print_err( "Error: -q invalid parameter ." )
            print_err( "Error: type dr14_tmeter -q for more info." )
            return 
        
        table_code = database_exec_query( options )
        
        if table_code is not None:
            print_out( table_code )
        
        return  
    
    
    if options.path_name != None:
        path_name = os.path.abspath( options.path_name )
    else:
        path_name = os.path.abspath( '.' )
        
    if not( os.path.exists( path_name ) ) :
        print_msg( "Error: The input directory \"%s\"  does not exists!" % path_name )
        return 

    if options.out_dir and not( os.path.exists( options.out_dir ) ) :
        print_msg( "Error (-o): The target directory \"%s\"  does not exists! " % options.out_dir )
        return 

    if options.quiet :
        set_quiet_msg()

    l_ver = TestVer()
    l_ver.start()
    
    print_msg( path_name )
    print_msg( "" )

    if options.recursive :
        subdirlist = list_rec_dirs( path_name )
    else :
        subdirlist = [] 
        subdirlist.append( path_name )

    if run_analysis_opt( options , path_name ) :
        return 1

     
    if options.scan_file:
                
        dr = DynamicRangeMeter()
        
        dr.write_to_local_db( db_is_enabled() )
        
        r = dr.scan_file( path_name )
        
        if r == 1:
            print_out( "" )
            print_out( dr.res_list[0]['file_name'] + " :" )
            print_out( "DR      = %d" % dr.res_list[0]['dr14'] )
            print_out( "Peak dB = %.2f" % dr.res_list[0]['dB_peak'] )
            print_out( "Rms dB  = %.2f" % dr.res_list[0]['dB_rms'] )
            return 1 
        else:
            print_msg( "Error: invalid audio file" )
            return 0


    if options.out_dir == "" :
        out_dir = None
    else :
        out_dir = options.out_dir

    if options.append and out_dir == None:
        out_dir = path_name
    
    if options.files_list:
        (success,clock,r) = scan_files_list(options.path_name,options,out_dir)
    else:    
        (success,clock,r) = scan_dir_list(subdirlist,options,out_dir)
            
    if success :
        print_msg( "Success! " )
        print_msg( "Elapsed time: %2.2f sec" % clock )
    else:
        print_msg("No audio files found\n")
        print_msg(" Usage: %s [options] path_name \n\nfor more details type \n%s --help\n" % ( get_exe_name() , get_exe_name() ) )

    if sys.platform.startswith('linux'):
        subprocess.call( "stty sane" , shell=True ) 

    if test_new_version() :
        print_msg( "\n----------------------------------------------------------------------" )
        print_msg( " A new version of dr14_t.meter [ %s ] is available for download \n please visit: %s" % ( get_new_version() , get_home_url() ) )
        print_msg( "----------------------------------------------------------------------\n" )
    
    if not database_exists() :
        print_msg( " " )
        print_msg( " News ... News ... News ... News ... News  !!! " )
        print_msg( " With the version 2.0.0 there is the possibility to store all results in a database" )
        print_msg( " If you want to enable this database execute the command:" )
        print_msg( "  > %s --enable_database " % get_exe_name() )
        print_msg( "" )
        print_msg( " for more details visit: http://dr14tmeter.sourceforge.net/index.php/DR_Database " )                
        
    
    return r
Esempio n. 10
0
def main():
        
    
    
    options = parse_args()

    if options.version :
        print_msg( dr14_version() )
        return

    init_log( logging.DEBUG )
    logging.disable( logging.INFO )
    
    numpy.seterr(all='ignore')
    
    #print( options )

    if options.path_name != None:
        path_name = os.path.abspath( options.path_name )
    else:
        path_name = os.path.abspath( '.' )
        
    if not( os.path.exists( path_name ) ) :
        print_msg( "Error: The input directory \"%s\" don't exixst! " % path_name )
        return 

    if options.out_dir and not( os.path.exists( options.out_dir ) ) :
        print_msg( "Error (-o): The target directory \"%s\" don't exixst! " % options.out_dir )
        return 

    if options.quiet :
        set_quiet_msg()

    l_ver = TestVer()
    l_ver.start()
    
    print_msg( path_name )
    print_msg( "" )

    if options.recursive :
        subdirlist = list_rec_dirs( path_name )
    else :
        subdirlist = [] 
        subdirlist.append( path_name )
    
          
    #print ( subdirlist )

    if run_analysis_opt( options , path_name ) :
        return 1

     
    if options.scan_file:
                
        dr = DynamicRangeMeter()
        r = dr.scan_file( path_name )
        
        if r == 1:
            print_out( "" )
            print_out( dr.res_list[0]['file_name'] + " :" )
            print_out( "DR      = %d" % dr.res_list[0]['dr14'] )
            print_out( "Peak dB = %.2f" % dr.res_list[0]['dB_peak'] )
            print_out( "Rms dB  = %.2f" % dr.res_list[0]['dB_rms'] )
            return 1 
        else:
            print_msg( "Error: invalid audio file" )
            return 0


    if options.out_dir == "" :
        out_dir = None
    else :
        out_dir = options.out_dir

    if options.append and out_dir == None:
        out_dir = path_name
    
    if options.files_list:
        (success,clock,r) = scan_files_list(options.path_name,options,out_dir)
    else:    
        (success,clock,r) = scan_dir_list(subdirlist,options,out_dir)
            
    if success :
        print_msg( "Success! " )
        print_msg( "Elapsed time: %2.2f sec" % clock )
    else:
        print_msg("No audio files found\n")
        print_msg(" Usage: %s [options] path_name \n\nfor more details type \n%s --help\n" % ( get_exe_name() , get_exe_name() ) )

    if sys.platform.startswith('linux'):
        subprocess.call( "stty sane" , shell=True ) 

    if test_new_version() :
        print_msg( "\n----------------------------------------------------------------------" )
        print_msg( " A new version of dr14_t.meter [ %s ] is available for download \n please visit: %s" % ( get_new_version() , get_home_url() ) )
        print_msg( "----------------------------------------------------------------------\n" )
    
    return r