diff options
author | Thomas Van Iseghem <[email protected]> | 2023-01-28 16:43:40 +0100 |
---|---|---|
committer | Thomas Van Iseghem <[email protected]> | 2023-01-28 16:43:40 +0100 |
commit | 688159cd92087a8450f5cf484b8cbb64c612adaa (patch) | |
tree | 7512301bf1e9c15ebe2f90ac70b73d123c97e94b | |
parent | c9c93b68f23f2367faf62e161c943c84857eb281 (diff) | |
download | OpenCortex-688159cd92087a8450f5cf484b8cbb64c612adaa.tar.gz OpenCortex-688159cd92087a8450f5cf484b8cbb64c612adaa.zip |
Added manual override json
-rw-r--r-- | Model Repositories/manual_override.json | 18 | ||||
-rw-r--r-- | Model Repositories/model_renamer.py | 18 |
2 files changed, 36 insertions, 0 deletions
diff --git a/Model Repositories/manual_override.json b/Model Repositories/manual_override.json new file mode 100644 index 0000000..a8e19fc --- /dev/null +++ b/Model Repositories/manual_override.json @@ -0,0 +1,18 @@ +{ + "ids":{ + "1017": "EVH 5150 III 100S Red EL34", + "1098": "EVH 5150 III 100S Blue EL34", + "1101": "Mesa Boogie Lone Star Clean 50W Normal", + "1102": "Mesa Boogie Lone Star Clean 50W Tweed", + "1103": "Mesa Boogie Lone Star Clean 100W Normal", + "1104": "Mesa Boogie Lone Star Clean 100W Tweed", + "1105": "Mesa Boogie Lone Star Drive 50W Normal", + "1106": "Mesa Boogie Lone Star Drive 50W Tweed", + "1107": "Mesa Boogie Lone Star Drive 100W Normal", + "1108": "Mesa Boogie Lone Star Drive 100W Tweed", + "1118": "EVH 5150 Blue 6L6", + "1119": "EVH 5150 Red 6L6", + "1148": "EVH 5150 III 100S Red EL34", + "1149": "EVH 5150 III 100S Blue EL34" + } +}
\ No newline at end of file diff --git a/Model Repositories/model_renamer.py b/Model Repositories/model_renamer.py index 24c41b9..382e5c1 100644 --- a/Model Repositories/model_renamer.py +++ b/Model Repositories/model_renamer.py @@ -1,6 +1,7 @@ # This script will take the ModelRepo.xml file and rename the models based on the trademark import argparse +import json import xml.etree.ElementTree as ET parser = argparse.ArgumentParser(description='Rename the models in an XML file') @@ -11,9 +12,20 @@ args = parser.parse_args() tree = ET.parse(args.original) root = tree.getroot() +def load_override_json(path): + with open(path) as f: + data = json.load(f) + return data + def get_actual_model(model): name = model.get('name') trademark = model.get('tm') + model_id = model.get('id') + + # Check if the model has a manual override + if model_id in override.keys(): + print('Overriding model: ' + name + ' with ' + override[model_id]) + return override[model_id] # Remove "Based on " from the name new_name = trademark.replace('Based on ', '') @@ -23,6 +35,9 @@ def get_actual_model(model): new_name = new_name.replace('loaded with', '|') # remove the word "with" from "loaded with" new_name = new_name.replace('with', '|') + # remove the word "tubes" from the name + new_name = new_name.replace('tubes', '') + new_name = new_name.replace('Tubes', '') # Check if the name contains a Mono or Stereo suffix if name.endswith('(M)'): @@ -34,6 +49,9 @@ def get_actual_model(model): print('Renaming models in file: ' + args.original) +override = load_override_json('manual_override.json')["ids"] +print(override) + # Itterate over the categories inside the XML file for category in root.findall('Category'): # Itterate over the models inside the category |