Skip to content

Commit

Permalink
Make possible to read mib files from other dirs than the current
Browse files Browse the repository at this point in the history
directory.
  • Loading branch information
codestation committed Sep 21, 2011
1 parent 957f1a8 commit 4b99fb6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions mhp3loader/gen_id.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env python

import os
import sys
import hashlib
from struct import pack, unpack
Expand All @@ -23,10 +23,11 @@ def hashfile(filepath):
if __name__ == '__main__':
list = []
for filename in sys.argv[1:]:
print(filename + ": " + hashfile(filename)[:8])
basename = os.path.basename(filename)
print(basename + ": " + hashfile(filename)[:8])
val = pack('>I', int(hashfile(filename)[:8], 16))
hash = unpack('I', val)[0]
list.append((hash, int(filename[:4])))
list.append((hash, int(basename[:4])))
f = open('mib_id.dat', 'wb')
list.sort()

Expand Down

0 comments on commit 4b99fb6

Please sign in to comment.