From f3d144df48a3d6e6ea3e3acd2ccae0638bafe995 Mon Sep 17 00:00:00 2001 From: nobody Date: Fri, 22 Feb 2019 15:14:51 +0100 Subject: [PATCH 1/3] MS Windows console does not offer expansion --- audfprint.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/audfprint.py b/audfprint.py index c33cd37..7880df8 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: From 86517d4e3f8711f93a5558cbe992885f55022309 Mon Sep 17 00:00:00 2001 From: patatetom Date: Fri, 22 Feb 2019 15:30:07 +0100 Subject: [PATCH 2/3] analyzer.soundfiletotaldur can be zero with a bad file --- audfprint.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/audfprint.py b/audfprint.py index 7880df8..9e00dae 100755 --- a/audfprint.py +++ b/audfprint.py @@ -179,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: From 71013099dc7f2cb9454781785251732d6eb3095e Mon Sep 17 00:00:00 2001 From: patatetom Date: Fri, 22 Feb 2019 15:38:03 +0100 Subject: [PATCH 3/3] s sec --- audfprint.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/audfprint.py b/audfprint.py index 9e00dae..ec7c385 100755 --- a/audfprint.py +++ b/audfprint.py @@ -489,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)))