diff --git a/app/helpers/description.py b/app/helpers/description.py index 0e3c4a1..d306fa3 100644 --- a/app/helpers/description.py +++ b/app/helpers/description.py @@ -1,22 +1,22 @@ import json import os -from app.settings import JSON_FOLDER +from app.settings import DESCRIPTION_FOLDER def get_icon_set_description(icon_set=''): - path = os.path.abspath(os.path.join(JSON_FOLDER, icon_set + '-dictionary.json')) + path = os.path.abspath(os.path.join(DESCRIPTION_FOLDER, icon_set + '-dictionary.json')) if not os.path.isfile(path): return None with open(path, encoding='utf-8') as f: - df = json.load(f) + icon_set_descriptions = json.load(f) - return df + return icon_set_descriptions def get_icon_description(icon_name='', icon_set=''): - path = os.path.abspath(os.path.join(JSON_FOLDER, icon_set + '-dictionary.json')) + path = os.path.abspath(os.path.join(DESCRIPTION_FOLDER, icon_set + '-dictionary.json')) if not os.path.isfile(path): return False diff --git a/app/settings.py b/app/settings.py index e4e35b3..02f5f65 100644 --- a/app/settings.py +++ b/app/settings.py @@ -10,7 +10,9 @@ load_dotenv(ENV_FILE, override=True, verbose=True) IMAGE_FOLDER = os.path.abspath(os.path.join(os.path.dirname(__file__), '../static/images/')) -JSON_FOLDER = os.path.abspath(os.path.join(os.path.dirname(__file__), '../json/')) +DESCRIPTION_FOLDER = os.path.abspath( + os.path.join(os.path.dirname(__file__), '../metadata/description/') +) COLORABLE_ICON_SETS = ['default'] DEFAULT_COLOR = {"r": '255', "g": '0', "b": '0'} diff --git a/json/babs-D-dictionary.json b/metadata/description/babs-D-dictionary.json similarity index 100% rename from json/babs-D-dictionary.json rename to metadata/description/babs-D-dictionary.json diff --git a/json/babs-F-dictionary.json b/metadata/description/babs-F-dictionary.json similarity index 100% rename from json/babs-F-dictionary.json rename to metadata/description/babs-F-dictionary.json diff --git a/json/babs-I-dictionary.json b/metadata/description/babs-I-dictionary.json similarity index 100% rename from json/babs-I-dictionary.json rename to metadata/description/babs-I-dictionary.json diff --git a/scripts/generate_babs_dic.py b/scripts/generate_babs_dic.py index c4a299e..dffdaa0 100644 --- a/scripts/generate_babs_dic.py +++ b/scripts/generate_babs_dic.py @@ -29,7 +29,7 @@ def generate_translation_file(args): def main(): # example command: - # python3 generate_babs_dic.py --input=../../tmp/Namenliste.xlsx --output=../json/babs + # python3 generate_babs_dic.py --input=../../tmp/babs.xlsx --output=../metadata/description/babs # (do not specify filetype for output since it creates a file for every language) parser = argparse.ArgumentParser(description='Create json translation file from excel file ') parser.add_argument('--input', action="store", dest='input', default=None) diff --git a/tests/unit_tests/test_json.py b/tests/unit_tests/test_json.py index 5695e21..67da527 100644 --- a/tests/unit_tests/test_json.py +++ b/tests/unit_tests/test_json.py @@ -1,7 +1,7 @@ import json import os -from app.settings import JSON_FOLDER +from app.settings import DESCRIPTION_FOLDER from tests.unit_tests.base_test import ServiceIconsUnitTests @@ -16,10 +16,10 @@ def validate_json(json_file): class IconsTests(ServiceIconsUnitTests): def test_json(self): - path = os.path.abspath(os.path.join(JSON_FOLDER, 'babs2_dictionary.json')) + path = os.path.abspath(os.path.join(DESCRIPTION_FOLDER, 'babs2_dictionary.json')) self.assertTrue(os.path.exists(path), "babs2 json file doesn't exist") - for root, dirs, files in os.walk(os.path.join(JSON_FOLDER)): + for root, dirs, files in os.walk(os.path.join(DESCRIPTION_FOLDER)): for name in files: p = os.path.join(root, name) with open(p, encoding='utf-8') as f: