Created
June 6, 2018 00:45
-
-
Save silicontrip/8bfb4e548a33ddcac0061b4aeea49a21 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| import os | |
| import fnmatch | |
| import sys | |
| import struct | |
| import json | |
| djdb={} | |
| for root, dir, files in os.walk(sys.argv[1]): | |
| for items in fnmatch.filter(files, "*.bpmdj1"): | |
| djfn = root + os.sep + items | |
| try: | |
| f = open(djfn, "rb") | |
| f.seek(4) | |
| sid = "" | |
| for id in range(32): | |
| byte = f.read(1) | |
| l = struct.unpack("B",byte) | |
| sid += '{:02x}'.format(l[0]) | |
| djdb[sid] = djfn | |
| finally: | |
| f.close() | |
| print json.dumps(djdb,indent=4) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment