import os
import hashlib
import json
import re

pattern = r'assets\\(.*?)\\'

# Initialize a dictionary to store the data
data = {}

# Specify the assets folder path
assets_path = 'assets'

# Walk through the assets folder and its subfolders
for root, dirs, files in os.walk(assets_path):
    for dir in dirs:
        name = os.path.join(root, dir)
        md5 = hashlib.md5(name.encode('utf-8')).hexdigest()
        
        if name.count("\\") == 2:
            match_type = ""
            match = re.search(pattern, name)
            if match:
                match_type = match.group(1)
            data[md5] = {'path': name, "type" : match_type}

# Write the data to a JSON file
with open('output.json', 'w') as json_file:
    json.dump(data, json_file, indent=4)
