diff --git a/audfprint.py b/audfprint.py index c33cd37..ec7c385 100755 --- a/audfprint.py +++ b/audfprint.py @@ -36,7 +36,12 @@ def filename_list_iterator(filelist, wavdir, wavext, listflag): as list files, prepending wavdir """ if not listflag: for filename in filelist: - yield os.path.join(wavdir, filename + wavext) + if os.path.isdir(filename): + for root, directories, filenames in os.walk(filename): + for filename in filenames: + yield os.path.join(wavdir, os.path.join(root, filename) + wavext) + else: + yield os.path.join(wavdir, filename + wavext) else: for listfilename in filelist: with open(listfilename, 'r') as f: @@ -174,10 +179,11 @@ def do_cmd(cmd, analyzer, hash_tab, filename_iter, matcher, outdir, type, report dur, nhash = analyzer.ingest(hash_tab, filename) tothashes += nhash ix += 1 + if analyzer.soundfiletotaldur: + report(["Added " + str(tothashes) + " hashes " + + "(%.1f" % (tothashes / float(analyzer.soundfiletotaldur)) + + " hashes/sec)"]) - report(["Added " + str(tothashes) + " hashes " - + "(%.1f" % (tothashes / float(analyzer.soundfiletotaldur)) - + " hashes/sec)"]) elif cmd == 'remove': # Removing files from hash table. for filename in filename_iter: @@ -483,7 +489,7 @@ def main(argv): elapsedtime = time_clock() - initticks if analyzer and analyzer.soundfiletotaldur > 0.: print("Processed " - + "%d files (%.1f s total dur) in %.1f s sec = %.3f x RT" \ + + "%d files (%.1f s total dur) in %.1f sec = %.3f x RT" \ % (analyzer.soundfilecount, analyzer.soundfiletotaldur, elapsedtime, (elapsedtime / analyzer.soundfiletotaldur)))