#!/usr/bin/env python3 """ πŸ‘₯ ORGANIZE ALL CHARACTERS Move character files to new characters/ structure """ import os import shutil from pathlib import Path # Base directory BASE_DIR = Path("/Users/davidkotnik/repos/novafarma/assets/slike") CHARACTERS_DIR = BASE_DIR / "characters" # Simple moves (direct 1:1) SIMPLE_MOVES = { "kai": "kai", "ana": "ana", "gronk": "gronk" } # liki/ categorization LIKI_PATTERNS = { "starsa": ["mom", "mama", "mati", "dad", "oče", "ata", "parent", "starΕ‘"], "npc": [] # Default catch-all } def get_liki_category(filename): """Determine where liki/ file should go""" fname_lower = filename.lower() for category, patterns in LIKI_PATTERNS.items(): for pattern in patterns: if pattern in fname_lower: return category # Default: NPC return "npc" def move_simple_folders(): """Move kai, ana, gronk directly""" print("\nπŸ‘₯ MOVING MAIN CHARACTERS...") for old_name, new_name in SIMPLE_MOVES.items(): old_dir = BASE_DIR / old_name new_dir = CHARACTERS_DIR / new_name if not old_dir.exists(): print(f" ⚠️ {old_name}/ not found, skipping") continue print(f"\n πŸ“ Processing {old_name}/...") moved = 0 for file_path in old_dir.rglob("*.png"): if file_path.is_file(): dest_path = new_dir / file_path.relative_to(old_dir) dest_path.parent.mkdir(parents=True, exist_ok=True) try: shutil.move(str(file_path), str(dest_path)) moved += 1 if moved <= 5: # Show first 5 print(f" βœ… {file_path.name}") except Exception as e: print(f" ❌ Error: {e}") print(f" πŸ“Š Moved {moved} files from {old_name}/ β†’ characters/{new_name}/") return True def organize_liki(): """Organize liki/ folder into starsa/ and npc/""" liki_dir = BASE_DIR / "liki" if not liki_dir.exists(): print("\n ⚠️ liki/ folder not found") return 0 print("\nπŸ“‚ ORGANIZING LIKI/ ...") moved = 0 for file_path in liki_dir.rglob("*.png"): if file_path.is_file(): category = get_liki_category(file_path.name) dest_dir = CHARACTERS_DIR / category dest_dir.mkdir(parents=True, exist_ok=True) dest_path = dest_dir / file_path.name try: shutil.move(str(file_path), str(dest_path)) moved += 1 if moved <= 5: # Show first 5 print(f" βœ… {file_path.name} β†’ {category}/") except Exception as e: print(f" ❌ Error: {e}") print(f" πŸ“Š Organized {moved} files from liki/") return moved def main(): print("πŸ‘₯ CHARACTER ORGANIZATION SCRIPT") print("="*60) # Move main characters move_simple_folders() # Organize liki liki_moved = organize_liki() # Summary print(f"\n{'='*60}") print("βœ… CHARACTER ORGANIZATION COMPLETE!") print(f"{'='*60}\n") # Show final counts print("πŸ“Š FINAL CHARACTER COUNTS:") for char_dir in ["kai", "ana", "gronk", "starsa", "npc"]: count = len(list((CHARACTERS_DIR / char_dir).rglob("*.png"))) print(f" {char_dir:10} : {count} files") print(f"\n{'='*60}\n") if __name__ == "__main__": main() print("✨ Done!")