mirror of
https://github.com/aaronraimist/element-themes
synced 2026-03-14 14:25:51 +01:00
Added build.py
This commit is contained in:
parent
36495fa4ce
commit
e2a78e9395
1 changed files with 14 additions and 9 deletions
23
build.py
23
build.py
|
|
@ -14,20 +14,25 @@ BLACKLIST = [
|
|||
if __name__ == '__main__':
|
||||
result = []
|
||||
json_paths = []
|
||||
# Let's recursively look for all the JSON files
|
||||
|
||||
|
||||
# 1. Let's recursively look for all the JSON files
|
||||
|
||||
# root_dirs = ["Discord", "Geeko Dark", etc...]
|
||||
root = os.listdir("./")
|
||||
for root_dir in root:
|
||||
if root_dir in BLACKLIST:
|
||||
is_dir = os.path.isdir(f"./{root_dir}")
|
||||
if root_dir in BLACKLIST or not is_dir:
|
||||
continue
|
||||
|
||||
is_dir = os.path.isdir(f"./{root_dir}")
|
||||
if not is_dir:
|
||||
continue
|
||||
|
||||
# if root_Dir is "Discord" then deep_dirs is
|
||||
# if root_dir is "Discord" then deep_dirs is
|
||||
# deep_dirs = ["Discord-Dark"]
|
||||
# ./Discord
|
||||
# └── Discord-Dark
|
||||
# ├── Discord-Dark-Theme.json
|
||||
# └── Discord-Dark-Theme.png
|
||||
|
||||
deep_dirs = os.listdir(f"./{root_dir}")
|
||||
for deep in deep_dirs:
|
||||
current_path = f"./{root_dir}/{deep}"
|
||||
|
|
@ -41,19 +46,19 @@ if __name__ == '__main__':
|
|||
if file.lower().endswith(".json"):
|
||||
json_paths.append(current_path)
|
||||
print(f"Added {file}")
|
||||
|
||||
|
||||
elif deep.lower().endswith(".json"):
|
||||
json_paths.append(current_path)
|
||||
print(f"Added {file}")
|
||||
|
||||
# Now let's parse all the JSON files
|
||||
# 2. Now let's parse all the JSON files
|
||||
for json_path in json_paths:
|
||||
with open(json_path, 'r') as file:
|
||||
parsed = json.load(file)
|
||||
result.append(parsed)
|
||||
|
||||
|
||||
# Finally output the themes as an array
|
||||
# 3. Finally output the themes as a JSON array
|
||||
with open(OUTPUT, 'w') as output:
|
||||
output.write(
|
||||
json.dumps(result, indent=2)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue