forked from len0rd/rockbox
nwztools/database: misc improvements
* make gen_db.py work on Windows/Python 2 - use hashlib module instead of md5sum, also don't rely on / for file path matching - don't use 'file' for a variable name * fix parse_nvp_header.sh for older kernels pre-emmc kernel sources use a slightly different #define format; adjust regexp to catch it. * add nwz-x1000 series NVP layout (from icx1087_nvp.h) some new tags have no description, alas the driver doesn't have them :/ * minor fixes to nvp/README fixed typos/wording Change-Id: I77d8c2704be2f2316e32aadcfd362df7102360d4
This commit is contained in:
parent
f1c8d63a76
commit
03dd4b92be
8 changed files with 550 additions and 264 deletions
|
@ -3,6 +3,7 @@ import glob
|
|||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import hashlib
|
||||
|
||||
# parse models.txt
|
||||
g_models = []
|
||||
|
@ -35,14 +36,14 @@ g_hash_nvp = dict() # hash -> nvp
|
|||
g_nvp_hash = dict() # codename -> hash
|
||||
HASH_SIZE=6
|
||||
map_files = glob.glob('nvp/nw*.txt')
|
||||
for line in subprocess.run(["md5sum"] + map_files, stdout = subprocess.PIPE).stdout.decode("utf-8").split("\n"):
|
||||
if len(line.rstrip()) == 0:
|
||||
continue
|
||||
hash, file = line.rstrip().split()
|
||||
codename = re.search('nvp/(.*)\.txt', file).group(1)
|
||||
for f in map_files:
|
||||
h = hashlib.md5()
|
||||
h.update(open(f, "rb").read())
|
||||
hash = h.hexdigest()
|
||||
codename = re.search('(nw.*)\.txt', f).group(1)
|
||||
# sanity check
|
||||
if not (codename in g_series_codename):
|
||||
print("Warning: file %s does not have a match series in series.txt" % file)
|
||||
print("Warning: file %s does not have a match series in series.txt" % f)
|
||||
hash = hash[:HASH_SIZE]
|
||||
# only keep one file
|
||||
if not (hash in g_hash_nvp):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue