#!/usr/bin/env python3 """ Organize Faza 1 Crop Assets Copies generated sprites from brain folder to proper game asset structure """ import os import shutil import re from pathlib import Path # Source directory (brain conversation folder) SOURCE_DIR = "/Users/davidkotnik/.gemini/antigravity/brain/eda9a368-77c1-4f9a-961e-2c9fce4e750e" # Destination base directory DEST_BASE = "/Users/davidkotnik/repos/novafarma/assets/crops/faza1" # Crop mapping CROPS = [ "corn", "tomato", "carrot", "potato", "lettuce", "pumpkin" ] SEASONS = ["spring", "summer", "fall", "winter"] def parse_filename(filename): """ Parse sprite filename to extract crop, season, and stage Example: carrot_spring_s3_1767563290519.png Returns: (crop, season, stage) or None if not a crop sprite """ # Pattern: {crop}_{season}_s{stage}_{timestamp}.png pattern = r"^(corn|tomato|carrot|potato|lettuce|pumpkin)_(spring|summer|fall|winter)_s(\d+)_\d+\.png$" match = re.match(pattern, filename) if match: crop, season, stage = match.groups() return (crop, season, int(stage)) return None def organize_assets(): """Copy and organize all crop sprites""" source_path = Path(SOURCE_DIR) if not source_path.exists(): print(f"❌ Source directory not found: {SOURCE_DIR}") return # Find all PNG files png_files = list(source_path.glob("*.png")) print(f"🔍 Found {len(png_files)} PNG files") print(f"📂 Organizing into: {DEST_BASE}\n") copied_count = 0 skipped_count = 0 for png_file in png_files: filename = png_file.name parsed = parse_filename(filename) if parsed is None: # Not a crop sprite, skip skipped_count += 1 continue crop, season, stage = parsed # Adjust crop name for folder (tomato -> tomatoes) crop_folder = "tomatoes" if crop == "tomato" else crop + "s" if crop != "corn" else crop # Create destination path dest_dir = Path(DEST_BASE) / crop_folder / season dest_dir.mkdir(parents=True, exist_ok=True) # New filename: stage{N}.png dest_filename = f"stage{stage}.png" dest_path = dest_dir / dest_filename # Copy file shutil.copy2(png_file, dest_path) copied_count += 1 print(f"✅ {crop:8} | {season:6} | stage {stage} -> {dest_path.relative_to(DEST_BASE)}") print(f"\n" + "="*60) print(f"📊 Summary:") print(f" ✅ Copied: {copied_count} crop sprites") print(f" ⏭️ Skipped: {skipped_count} non-crop files") print(f" 📂 Destination: {DEST_BASE}") print("="*60) if __name__ == "__main__": organize_assets()