Files
novafarma/tools/organize_images.py
David Kotnik 9e6cee1354 🎨 Project organization - Dolina Smrti
- Reorganized 4513 images into 8 categories in Slike_za_Tiled/
- Integrated 330 DLC images into main categories
- Renamed project from novafarma to dolinasmrti
- Added README.md files for documentation
- Created 2 base TSX tilesets for Tiled
- Created template map (_template_base.tmx)
- All assets ready for Tiled Map Editor

Categories created:
- 01_characters/ (zombies, npcs, players)
- 02_creatures/ (animals, monsters, slimes, dinosaurs)
- 03_terrain/ (ground, fences, mine)
- 04_buildings/ (houses, ruins, structures)
- 05_objects/ (tools, items, farming)
- 06_vegetation/ (trees, plants)
- 08_misc/ (1257 files for manual review)
2025-12-24 15:52:40 +01:00

122 lines
4.5 KiB
Python
Executable File

#!/usr/bin/env python3
"""
Organizira slike v Slike_za_Tiled/ mapi v kategorije
"""
import os
import shutil
from pathlib import Path
# Bazna mapa
BASE_DIR = Path("/Users/davidkotnik/Desktop/novafarma/Slike_za_Tiled")
# Definicije kategorij (ključne besede -> ciljna mapa)
CATEGORIES = {
"01_characters/zombies": ["zombie"],
"01_characters/npcs": ["npc", "trader", "blacksmith", "merchant", "baker", "farmer", "doctor", "ivan", "jakob", "marija", "lena", "sonya", "romance"],
"01_characters/players": ["kai_character", "ana_character", "character_customization"],
"02_creatures/animals": ["animal", "cow", "chicken", "dog", "livestock", "donkey", "horse"],
"02_creatures/monsters": ["troll", "creature", "anomalous", "cryptid", "mythical_creatures"],
"02_creatures/slimes": ["slime"],
"02_creatures/dinosaurs": ["dinosaur", "dino"],
"03_terrain/ground": ["grass", "soil", "tileset", "ground", "terrain"],
"03_terrain/fences": ["fence"],
"03_terrain/mine": ["mine_tileset", "mine_interior", "mine_entrance"],
"04_buildings/houses": ["house", "farmhouse", "barn"],
"04_buildings/ruins": ["ruin", "buildings_ruins"],
"04_buildings/structures": ["building", "town_buildings", "structure", "blacksmith_workshop", "bridge", "wall", "city", "portal", "minting"],
"05_objects/tools": ["tool", "weapon", "bow", "arrow", "firearms"],
"05_objects/furniture": ["furniture", "bathroom", "bedroom", "kitchen", "living_room"],
"05_objects/items": ["items_pack", "backpack", "chest", "grave", "spawner", "objects_pack"],
"05_objects/farming": ["sprinkler", "seed", "crop"],
"06_vegetation/trees": ["tree", "sequoia", "birch", "vegetation"],
"06_vegetation/plants": ["flower", "plant", "leaf"],
"07_dlc_content/amazon": ["amazon"],
"07_dlc_content/atlantis": ["atlantis"],
"07_dlc_content/catacombs": ["catacombs"],
"07_dlc_content/chernobyl": ["chernobyl"],
"07_dlc_content/desert_egypt": ["egyptian", "egypt", "pyramid", "sphinx"],
"07_dlc_content/lochness": ["lochness"],
"07_dlc_content/mythical": ["mythical_pack"],
}
def create_directories():
"""Ustvari vse potrebne direktorije"""
print("🔨 Ustvarjam direktorije...")
for category in CATEGORIES.keys():
dir_path = BASE_DIR / category
dir_path.mkdir(parents=True, exist_ok=True)
print(f"{category}")
# Tudi misc
(BASE_DIR / "08_misc").mkdir(parents=True, exist_ok=True)
print(f" ✓ 08_misc")
print()
def organize_images():
"""Organizira slike v kategorije"""
print("📦 Organiziram slike...")
# Pridobi vse PNG slike v baznem direktoriju (samo top-level)
png_files = list(BASE_DIR.glob("*.png"))
total_files = len(png_files)
moved_files = 0
print(f"Najdenih {total_files} PNG datotek\n")
# Slovar za sledenje premikom
moved_to_category = {}
for png_file in png_files:
filename = png_file.name.lower()
moved = False
# Preveri vsako kategorijo
for category, keywords in CATEGORIES.items():
if any(keyword in filename for keyword in keywords):
target_dir = BASE_DIR / category
target_file = target_dir / png_file.name
# Premakni datoteko
shutil.move(str(png_file), str(target_file))
if category not in moved_to_category:
moved_to_category[category] = 0
moved_to_category[category] += 1
moved_files += 1
moved = True
break
# Če ni ujemanja, premakni v misc
if not moved:
target_dir = BASE_DIR / "08_misc"
target_file = target_dir / png_file.name
shutil.move(str(png_file), str(target_file))
if "08_misc" not in moved_to_category:
moved_to_category["08_misc"] = 0
moved_to_category["08_misc"] += 1
moved_files += 1
print("\n✅ Organizacija končana!\n")
print("📊 Statistika premikov:")
for category, count in sorted(moved_to_category.items()):
print(f" {category}: {count} datotek")
print(f"\n🎉 Skupaj premaknjenih: {moved_files} / {total_files}")
if __name__ == "__main__":
print("=" * 60)
print(" ORGANIZACIJA SLIK - NovaFarma")
print("=" * 60)
print()
create_directories()
organize_images()
print("\n" + "=" * 60)
print(" KONČANO!")
print("=" * 60)