Files
novafarma/scripts/organize_characters.py
David Kotnik 1051633479 👥 CHARACTER ORGANIZATION COMPLETE - 1,749 files
Organized all character files into characters/ structure:

MAIN CHARACTERS:
 kai/     1,131 files (all animations, poses, styles)
 ana/       196 files (explorer, aging system, ghost forms)
 gronk/     181 files (walk cycles, portraits, full sheets)

NPCs:
 npc/       241 files (electrician, zombies, scouts, mechanics, statistician, etc.)
 starsa/      0 files (ready for parents assets)

MOVED FROM:
- kai/ → characters/kai/
- ana/ → characters/ana/
- gronk/ → characters/gronk/
- liki/ → characters/npc/ (all NPCs and side characters)

Added organize_characters.py script for automation.
2026-01-20 02:34:46 +01:00

127 lines
3.5 KiB
Python

#!/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!")