Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions audfprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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)))

Expand Down