From 091044692863db710cb1b60e6bbb023c60516af4 Mon Sep 17 00:00:00 2001 From: Lipis Date: Sat, 23 Oct 2021 11:43:06 +0300 Subject: [PATCH] Countries (#864) --- flags.py | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/flags.py b/flags.py index 797d16bd..ffa7e46b 100644 --- a/flags.py +++ b/flags.py @@ -1,7 +1,7 @@ import os import json -flags_dir = os.path.join("flags", "4x3") +flags_dir = os.path.join("flags", "1x1") f = [] for (dirpath, dirnames, filenames) in os.walk(flags_dir): @@ -15,4 +15,24 @@ flags = json.load(country_json) flags.sort(key=lambda x: x["flag_1x1"]) with open('country.json', 'w') as output: - json.dump(flags, output, indent=2) + json.dump(flags, output, indent=2, sort_keys=True) + + +# Check if all files have names +countries = [flag["flag_1x1"][10:].replace('.svg', '') for flag in flags] + +all_good = True + +for code in codes: + if code not in countries: + print('Code not found in country.json:', code) + all_good = False + +for code in countries: + if code not in codes: + print('Flag icon not found for:', code) + all_good = False + + +if all_good: + print('All flag icons and country.json are in sync.')