Permalink
Browse files

Make possible to read mib files from other dirs than the current

directory.
  • Loading branch information...
codestation committed Sep 21, 2011
1 parent 957f1a8 commit 4b99fb6fdc0333b3d9f88ee488226afbec229f16
Showing with 4 additions and 3 deletions.
  1. +4 −3 mhp3loader/gen_id.py
View
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-
+import os
import sys
import hashlib
from struct import pack, unpack
@@ -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()

0 comments on commit 4b99fb6

Please sign in to comment.