| import os |
| import sys |
| import subprocess |
| from concurrent.futures import ThreadPoolExecutor |
|
|
| output_dir = 'target_imgs_v73' |
|
|
| def process_skin(skin_id): |
| input_path = f'skins/{skin_id}.png' |
| output_path = f'{output_dir}/{skin_id}.png' |
| if not os.path.exists(output_path): |
| print(f"Starting process for skin: {skin_id}...") |
| |
| result = subprocess.run( |
| [sys.executable, 'build_target_img.py', input_path, output_path], |
| capture_output=True, |
| text=True |
| ) |
| if result.returncode == 0: |
| print(f"Successfully processed: {skin_id}") |
| else: |
| print(f"Error processing skin {skin_id}:") |
| print(result.stderr or result.stdout) |
|
|
| def main(): |
| os.makedirs(output_dir, exist_ok=True) |
| iset = set() |
| for i in os.listdir('skins'): |
| if i.endswith('.png') and not i.startswith('.'): |
| iset.add(i.split('.')[0]) |
| |
| |
| |
| max_workers = 4 |
| print(f"Processing {len(iset)} skins using {max_workers} parallel workers...") |
| with ThreadPoolExecutor(max_workers=max_workers) as executor: |
| executor.map(process_skin, sorted(list(iset))) |
|
|
| if __name__ == '__main__': |
| main() |