summaryrefslogtreecommitdiffstats
path: root/utils/nwztools/database/gen_db.py
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2017-01-09 21:48:43 +0100
committerAmaury Pouly <amaury.pouly@gmail.com>2017-01-09 21:48:43 +0100
commit90284b6fe0e5ba89fe63943212bfd7ffc3e96d47 (patch)
treea8fb4291b53849568b4b4d6c581d4632773dd04a /utils/nwztools/database/gen_db.py
parent1d7b37eda1fe475a76b8c3be1cc21fe3e893ad17 (diff)
downloadrockbox-90284b6fe0e5ba89fe63943212bfd7ffc3e96d47.tar.gz
rockbox-90284b6fe0e5ba89fe63943212bfd7ffc3e96d47.zip
nwztools: fix typo (nwz-zx100 -> nw-zx100)
Also now gen_db.py can check for such mismatch Change-Id: I4d91aae0dde08c866eda2ed5da3c11431c46e06a
Diffstat (limited to 'utils/nwztools/database/gen_db.py')
-rwxr-xr-xutils/nwztools/database/gen_db.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/utils/nwztools/database/gen_db.py b/utils/nwztools/database/gen_db.py
index cf1423f2a5..8b7d1cbaaf 100755
--- a/utils/nwztools/database/gen_db.py
+++ b/utils/nwztools/database/gen_db.py
@@ -13,6 +13,7 @@ with open('models.txt') as fp:
g_models.append({'mid': int(mid, 0), 'name': name})
# parse series.txt
g_series = []
+g_series_codename = set()
with open('series.txt') as fp:
for line in fp:
# we unpack and repack 1) to make the format obvious 2) to catch errors
@@ -25,6 +26,7 @@ with open('series.txt') as fp:
models = []
models = [int(mid,0) for mid in models]
g_series.append({'codename': codename, 'name': name, 'models': models})
+ g_series_codename.add(codename)
# parse all maps in nvp/
# since most nvps are the same, what we actually do is to compute the md5sum hash
# of all files, to identify groups and then each entry in the name is in fact the
@@ -38,6 +40,9 @@ for line in subprocess.run(["md5sum"] + map_files, stdout = subprocess.PIPE).std
continue
hash, file = line.rstrip().split()
codename = re.search('nvp/(.*)\.txt', file).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)
hash = hash[:HASH_SIZE]
# only keep one file
if not (hash in g_hash_nvp):