- Timestamp:
- Dec 16, 2005, 2:22:58 AM (19 years ago)
- 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:
- 75139a9
- Parents:
- 7473074
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/aubio/bench/node.py
r7473074 r257debc 16 16 print 'command returning error was',cmd 17 17 #sys.exit(1) 18 if output == '' or output == ['']: return 18 19 return output 19 20 20 def list_files(datapath,filter='f'): 21 cmd = '%s%s%s%s' % ('find ',datapath,' -type ',filter) 21 def list_files(datapath,filter='f', maxdepth = -1): 22 if maxdepth >= 0: maxstring = " -maxdepth %d " % maxdepth 23 else: maxstring = "" 24 cmd = '%s' * 5 % ('find ',datapath,maxstring,' -type ',filter) 22 25 return runcommand(cmd) 23 26 24 def list_wav_files(datapath,maxdepth =1):25 return list_files(datapath, filter="f -name '*.wav' -maxdepth %d"%maxdepth)27 def list_wav_files(datapath,maxdepth = -1): 28 return list_files(datapath, filter="f -name '*.wav'",maxdepth = maxdepth) 26 29 27 def list_snd_files(datapath,maxdepth=1): 28 return list_files(datapath, filter="f -name '*.wav' -o -name '*.aif' -maxdepth %d"%maxdepth) 30 def list_snd_files(datapath,maxdepth = -1): 31 return list_files(datapath, filter="f -name '*.wav' -o -name '*.aif'", 32 maxdepth = maxdepth) 33 34 def list_res_files(datapath,maxdepth = -1): 35 return list_files(datapath, filter="f -name '*.txt'", maxdepth = maxdepth) 29 36 30 37 def list_dirs(datapath): … … 63 70 s = re.split(datapath, i ,maxsplit=1)[1] 64 71 action("%s%s%s"%(respath,'/',s)) 72 73 class task: 74 75 def __init__(self,datadir,resdir): 76 self.datadir = datadir 77 self.resdir = resdir 78 print "Checking data directory", self.datadir 79 self.checkdata() 80 self.checkres() 81 82 def checkdata(self): 83 print "Listing directories in data directory", 84 self.dirlist = list_dirs(self.datadir) 85 print " (%d elements)" % len(self.dirlist) 86 #for each in self.dirlist: print each 87 print "Listing sound files in data directory", 88 self.sndlist = list_snd_files(self.datadir) 89 print " (%d elements)" % len(self.sndlist) 90 #for each in self.sndlist: print each 91 print "Listing annotations in data directory", 92 self.reslist = list_res_files(self.datadir) 93 print " (%d elements)" % len(self.reslist) 94 #for each in self.reslist: print each 95 if not self.reslist or len(self.reslist) < len (self.sndlist): 96 print "ERR: not enough annotations" 97 return -1 98 else: 99 print "Found enough annotations" 100 101 def checkres(self): 102 print "Creating results directory" 103 act_on_results(mkdir,self.datadir,self.resdir,filter='d')
Note: See TracChangeset
for help on using the changeset viewer.