Files
novafarma/scripts/organize_items.py
David Kotnik 870e9b8384 🗂️ Item Organization Complete - Categorized 833 items into structured folders
- Created organized item structure:
  📁 items/
  ├── camping/ (62 files)
  ├── consumables/ (12 files)
  ├── crops/ (227 files)
  ├── resources/ (25 files)
  ├── seeds/ (96 files)
  ├── special/ (24 files)
  ├── storage/ (8 files)
  ├── tools/ (276 files)
  │   ├── wood/
  │   ├── stone/
  │   ├── iron/
  │   ├── gold/
  │   └── special/
  ├── ui/ (69 files)
  └── weapons/ (96 files)

- Added organize_items.py script for automated categorization
- Moved 833 files from predmeti/ to proper categories
- Left 1097 backup/duplicate files in predmeti/ for later cleanup
2026-01-20 01:30:24 +01:00

169 lines
5.2 KiB
Python

#!/usr/bin/env python3
"""
🎯 ITEM ORGANIZATION SCRIPT
Organizes all items from slike/predmeti/ into proper categories
"""
import os
import shutil
from pathlib import Path
# Base directories
BASE_DIR = Path("/Users/davidkotnik/repos/novafarma/assets/slike")
SOURCE_DIR = BASE_DIR / "predmeti"
ITEMS_DIR = BASE_DIR / "items"
# Category mapping (file patterns -> destination folder)
CATEGORIES = {
# TOOLS - by material
"tools/wood": [
"wood_hoe", "wood_shovel", "wood_scythe", "wood_watering_can", "wood_axe", "wood_pickaxe"
],
"tools/stone": [
"stone_hoe", "stone_shovel", "stone_scythe", "stone_watering_can", "stone_axe", "stone_pickaxe",
"hoe_basic", "shovel", "hoe" # basic = stone tier
],
"tools/iron": [
"iron_hoe", "iron_shovel", "iron_scythe", "iron_watering_can", "iron_axe", "iron_pickaxe"
],
"tools/gold": [
"steel_hoe", "steel_shovel", "steel_scythe", "steel_watering_can", "steel_axe", "steel_pickaxe"
],
"tools/special": [
"fishing_rod", "fishing_net", "hammer", "wrench", "baking_tools", "piercing_tools",
"bucket_tool", "compass_tool", "hourglass_tool", "saw_tool", "scissors_tool",
"tool_rack", "tool_shed", "tool_durability", "tool_break", "tool_icons", "tool_watering_can"
],
# WEAPONS
"weapons": [
"axe_basic", "battle_axe", "sword", "bow_weapon", "crossbow_weapon",
"dagger_weapon", "spear_weapon", "staff_weapon", "club_weapon", "mace_weapon",
"hammer_weapon", "pickaxe_basic"
],
# SEEDS
"seeds": [
"wheat_seed", "carrot_seed", "potato_seed", "tomato_seed", "corn_seed",
"cannabis_seed", "ganja_stage1_seed", "stage0_seed", "seeds_bag", "seed_packet"
],
# CROPS & FARMING
"crops": [
"crop_plot", "crop_storage", "crop_wilting", "crop_shed", "wheat_crop",
"wheat_s30", "wheat_stage", "carrot_stage", "potato_s32", "tomato_s32",
"corn_s32", "cannabis_s32"
],
# RESOURCES
"resources": [
"resource_icon", "resource_pile", "wood_log", "stone_icon", "stone_hoe"
],
# CONSUMABLES
"consumables": [
"bread_icon", "food_icon", "potion_icon"
],
# SPECIAL ITEMS
"special": [
"item_locket", "phoenix_moth", "phoenix_keeper", "artifact_icon",
"money_bag", "seed_merchant", "vape_lab"
],
# UI ICONS
"ui": [
"icon_", "backpack_icon", "coin_icon", "heart_icon", "key_icon",
"lock_icon", "map_icon", "skull_icon", "star_icon", "timer_icon",
"warning_icon", "shield_icon", "gem_icon", "quest_marker",
"inventory_", "weather_time"
],
# STORAGE & WORKSTATIONS
"storage": [
"repair_bench", "BIOME_CROP_TEST"
]
}
def get_category(filename):
"""Determine category for a file based on its name"""
fname = filename.lower()
# Check each category
for category, patterns in CATEGORIES.items():
for pattern in patterns:
if pattern.lower() in fname:
return category
# Default: check for common prefixes
if "oprema_orodja" in fname:
return "tools/special"
if "oprema_orožje" in fname or "oprema_oro" in fname:
return "weapons"
if "narava_pridelki" in fname:
return "crops"
if "vmesnik_ikone" in fname or "ostalo_vmesnik" in fname:
return "ui"
return None # Uncategorized
def organize_items():
"""Main organization function"""
if not SOURCE_DIR.exists():
print(f"❌ Source directory not found: {SOURCE_DIR}")
return
# Create category directories
for category in CATEGORIES.keys():
category_dir = ITEMS_DIR / category
category_dir.mkdir(parents=True, exist_ok=True)
print(f"✅ Created: {category}")
# Get all files
files = [f for f in SOURCE_DIR.iterdir() if f.is_file() and not f.name.startswith('.')]
print(f"\n📦 Found {len(files)} files in predmeti/")
# Stats
moved = 0
uncategorized = []
# Process each file
for file_path in files:
category = get_category(file_path.name)
if category:
dest_dir = ITEMS_DIR / category
dest_path = dest_dir / file_path.name
# Move file
try:
shutil.move(str(file_path), str(dest_path))
moved += 1
print(f"📁 {file_path.name}{category}/")
except Exception as e:
print(f"❌ Error moving {file_path.name}: {e}")
else:
uncategorized.append(file_path.name)
# Summary
print(f"\n{'='*60}")
print(f"✅ Moved: {moved} files")
print(f"❓ Uncategorized: {len(uncategorized)} files")
if uncategorized:
print(f"\n📋 Uncategorized files (will stay in predmeti/):")
for fname in sorted(uncategorized)[:20]: # Show first 20
print(f" - {fname}")
if len(uncategorized) > 20:
print(f" ... and {len(uncategorized) - 20} more")
print(f"{'='*60}\n")
if __name__ == "__main__":
print("🎯 ITEM ORGANIZATION SCRIPT")
print("="*60)
organize_items()
print("✨ Done!")