0
0
mirror of https://github.com/lipis/flag-icons.git synced 2024-11-24 11:17:29 +01:00
This commit is contained in:
Panayiotis Lipiridis 2021-10-23 12:31:02 +03:00
parent 3fd30007c4
commit f5f2e02c22
2 changed files with 270 additions and 13 deletions

File diff suppressed because it is too large Load Diff

View File

@ -8,31 +8,30 @@ for (dirpath, dirnames, filenames) in os.walk(flags_dir):
files.extend(filenames)
break
file_codes = [name.replace('.svg', '') for name in files]
file_codes = [name.replace(".svg", "") for name in files]
country_json = open("country.json")
flags = json.load(country_json)
flags.sort(key=lambda x: x["code"])
with open('country.json', 'w') as output:
json.dump(flags, output, indent=2, sort_keys=True)
# Check if all files have names
country_codes = [flag["code"] for flag in flags]
with open("country.json", "w") as output:
json.dump(flags, output, indent=2, sort_keys=True)
all_good = True
# Check if all files have names
for code in file_codes:
if code not in country_codes:
print('Code not found in country.json:', code)
all_good = False
if code not in country_codes:
print("Code not found in country.json:", code)
all_good = False
# Check if all countries have files
for code in country_codes:
if code not in file_codes:
print('Flag icon not found for:', code)
all_good = False
if code not in file_codes:
print("Flag icon not found for:", code)
all_good = False
if all_good:
print('All flag icons and country.json are in sync.')
print("All flag icons and country.json are in sync.")