Files
novafarma/scripts/organize_references.py
David Kotnik 7ab6025486 🎨 Generated 10 Steampunk/Chibi Animals & Final Reference Org
EXTENDED SESSION (03:00 - 03:45 CET):

1. ANIMAL GENERATION (assets/slike/animals/generated_steampunk/):
    10 unique assets created:
   - Farm: Cow, Pig, Chicken, Duck, Goat, Horse, Rabbit, Donkey, Llama
   - Forest: Fox, Bear, Wolf
   - Style: Dark Noir Steampunk Chibi

2. REFERENCE ORGANIZATION (assets/slike/glavna_referenca/):
    Organized 2,626 files into subfolders
    Created comprehensive biome structure (200 folders)
    Moved docs to docs/art_guidelines/

SESSION UPDATE:
- Total Time: 3h 03min
- Files Processed: 5,788+
- Status: SESSION COMPLETE! 🚀
2026-01-20 10:45:44 +01:00

106 lines
3.6 KiB
Python

#!/usr/bin/env python3
"""
Organize glavna_referenca files into subfolders
"""
import os
import shutil
from pathlib import Path
BASE_DIR = Path("/Users/davidkotnik/repos/novafarma/assets/slike/glavna_referenca")
# Categorization patterns
PATTERNS = {
"characters/kai": ["kai", "player"],
"characters/ana": ["ana"],
"characters/gronk": ["gronk"],
"characters/npc": ["npc", "mayor", "priest", "blacksmith", "merchant"],
"animals/domestic": ["cow", "chicken", "sheep", "pig", "horse", "dog", "cat", "krava", "kokos", "ovca", "prase"],
"animals/wild": ["wolf", "bear", "deer", "fox", "volk", "medved", "jelen"],
"animals/infected": ["zombie", "infected", "mutant"],
"environment/narava": ["tree", "bush", "plant", "flower", "drevo", "grm", "rastlin"],
"environment/rudnik": ["rock", "stone", "ore", "kamen", "ruda"],
"environment/tla": ["ground", "dirt", "grass", "path", "trava", "zemlja", "pot"],
"environment/gradnja": ["house", "building", "barn", "hiša", "zgradba"],
"items/tools": ["tool", "hoe", "axe", "pickaxe", "shovel", "motika", "sekira"],
"items/weapons": ["weapon", "sword", "gun", "bow", "meč", "orožje"],
"items/seeds": ["seed", "seme"],
"items/crops": ["wheat", "carrot", "potato", "corn", "pšenica", "korenje"],
"items/consumables": ["food", "potion", "hrana"],
"biomes": ["biome", "forest", "desert", "swamp", "gozd", "puščava"],
"buildings": ["farm", "shop", "inn", "farma", "trgovina"],
"ui": ["ui", "button", "icon", "ikona", "gumb"],
"effects": ["effect", "particle", "vfx", "učinek"],
}
def categorize_file(filename):
"""Determine category based on filename"""
fname_lower = filename.lower()
for category, patterns in PATTERNS.items():
for pattern in patterns:
if pattern in fname_lower:
return category
return None
def organize_references():
"""Organize all PNG files in glavna_referenca"""
print("🗂️ ORGANIZING GLAVNA_REFERENCA...")
print("="*60)
moved = 0
skipped = 0
# Get all PNG files in root
png_files = list(BASE_DIR.glob("*.png"))
total = len(png_files)
print(f"Found {total} PNG files to organize\n")
for i, file_path in enumerate(png_files, 1):
category = categorize_file(file_path.name)
if category:
dest_dir = BASE_DIR / category
dest_dir.mkdir(parents=True, exist_ok=True)
dest_path = dest_dir / file_path.name
if not dest_path.exists():
try:
shutil.move(str(file_path), str(dest_path))
moved += 1
if moved % 100 == 0:
print(f" Progress: {moved}/{total} files moved...")
except Exception as e:
print(f" ❌ Error moving {file_path.name}: {e}")
skipped += 1
else:
skipped += 1
print(f"\n{'='*60}")
print(f"✅ Moved: {moved} files")
print(f"⚠️ Skipped: {skipped} files (no category match)")
print(f"📊 Total: {total} files processed")
print(f"{'='*60}")
# Show category breakdown
print("\n📁 FILES PER CATEGORY:")
for category in PATTERNS.keys():
cat_dir = BASE_DIR / category
if cat_dir.exists():
count = len(list(cat_dir.glob("*.png")))
if count > 0:
print(f" {category:30} {count:4} files")
return moved
if __name__ == "__main__":
moved = organize_references()
print(f"\n✨ Done! Organized {moved} reference files!")