1
0
Fork 0
fgmeta/fgaddon/find_md5file.py
2020-10-13 19:17:34 +01:00

25 lines
No EOL
502 B
Python
Executable file

#!/usr/bin/python
import os, sys, re, fnmatch
import hashlib, glob
def md5(fname):
hash_md5 = hashlib.md5()
with open(fname, "rb") as f:
for chunk in iter(lambda: f.read(4096), b""):
hash_md5.update(chunk)
return hash_md5.hexdigest()
filepath = sys.argv[1]
searchpath = sys.argv[2]
digest = md5(filepath)
print("Checking for " + digest)
wavfiles = glob.glob(searchpath + "/**/*.wav", recursive=True)
for f in wavfiles:
if (md5(f) == digest):
print(f)