Changeset d45520a for python/aubio


Ignore:
Timestamp:
Nov 6, 2005, 12:29:14 PM (19 years ago)
Author:
Paul Brossier <piem@altern.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
Children:
733c2f8
Parents:
102b732
Message:

do not sys.exit, add keywords to act_on_data
do not sys.exit, add keywords to act_on_data

Location:
python/aubio/bench
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/aubio/bench/config.py

    r102b732 rd45520a  
    1414        filefound = 1
    1515except IOError:
    16         print "no user configuration file found in", filename
     16        #print "no user configuration file found in", filename
     17        pass
    1718
    1819if filefound == 0:
  • python/aubio/bench/node.py

    r102b732 rd45520a  
    1515                print 'error:',status,output
    1616                print 'command returning error was',cmd
    17                 sys.exit(1)
     17                #sys.exit(1)
    1818        return output
    1919
     
    2222        return runcommand(cmd)
    2323
     24def list_wav_files(datapath,maxdepth=1):
     25        return list_files(datapath, filter="f -name '*.wav' -maxdepth %d"%maxdepth)
     26
     27def list_dirs(datapath):
     28        return list_files(datapath, filter="d")
     29
    2430def mkdir(path):
    2531        cmd = '%s%s' % ('mkdir -p ',path)
    2632        return runcommand(cmd)
    2733
    28 def act_on_data (action,datapath,respath,suffix='.txt',filter='f'):
     34def act_on_data (action,datapath,respath,suffix='.txt',filter='f',sub='\.wav$',**keywords):
    2935        """ execute action(datafile,resfile) on all files in datapath """
    3036        dirlist = list_files(datapath,filter=filter)
     37        if dirlist == ['']: dirlist = []
    3138        respath_in_datapath = re.split(datapath, respath,maxsplit=1)[1:]
    3239        if(respath_in_datapath and suffix == ''):
    3340                print 'error: respath in datapath and no suffix used'
    34                 sys.exit(1)
     41                #sys.exit(1)
    3542        for i in dirlist:
    36                 s = re.split(datapath, i,maxsplit=1)[1]
    37                 j = "%s%s%s%s"%(respath,'/',s,suffix)
    38                 action(i,j)
     43                j = re.split(datapath, i,maxsplit=1)[1]
     44                j = re.sub(sub,'',j)
     45                #j = "%s%s%s"%(respath,j,suffix)
     46                j = "%s%s"%(respath,j)
     47                if sub != '':
     48                        j = re.sub(sub,suffix,j)
     49                else:
     50                        j = "%s%s" % (j,suffix)
     51                action(i,j,**keywords)
    3952
    4053def act_on_results (action,datapath,respath,filter='d'):
Note: See TracChangeset for help on using the changeset viewer.