Files
novafarma/scripts/cleanup_structure.py

135 lines
4.2 KiB
Python

#!/usr/bin/env python3
"""
Clean up assets/slike/ - move everything to proper locations
"""
import shutil
from pathlib import Path
REPO = Path("/Users/davidkotnik/repos/novafarma")
SLIKE = REPO / "assets/slike"
# Anomalous zones (should be in root, but visible)
ANOMALOUS = [
"amazonas", "arctic_zone", "atlantis", "bamboo_forest",
"catacombs", "chernobyl", "crystal_caves", "deep_ocean",
"dinozavri", "egyptian_desert", "endless_forest", "floating_islands",
"loch_ness", "mushroom_forest", "mythical_highlands", "shadow_realm",
"volcanic_zone", "wasteland"
]
# Numbered biomes (should be in biomi/)
NUMBERED_BIOMES = [
"01_dolina_farm", "02_temni_gozd", "03_zapusceno_mesto",
"04_zapuscena_tovarna", "05_nuklearna_cona", "06_podzemni_kompleks",
"07_ledena_divjina", "08_vulkanska_oblast", "09_gost_gozd"
]
print("="*70)
print("🧹 CLEANUP - Moving items to proper folders")
print("="*70)
# Check if biomi/ exists, check content
biomi_folder = SLIKE / "biomi"
if biomi_folder.exists():
print(f"\n✅ biomi/ exists")
numbered = list(biomi_folder.glob("*/"))
print(f" Contains: {len(numbered)} folders")
for f in numbered:
print(f" - {f.name}")
# Move old hladno/strelno into orozje/
hladno = SLIKE / "hladno"
strelno = SLIKE / "strelno"
orozje = SLIKE / "orozje"
if hladno.exists():
print(f"\n📦 Moving hladno/ → orozje/hladno/")
dest = orozje / "hladno"
if not dest.exists():
shutil.move(str(hladno), str(dest))
print(f" ✅ Moved")
else:
print(f" ⚠️ Destination exists, merging...")
for item in hladno.glob("*"):
if not (dest / item.name).exists():
shutil.move(str(item), str(dest / item.name))
hladno.rmdir()
print(f" ✅ Merged & removed")
if strelno.exists():
print(f"\n📦 Moving strelno/ → orozje/strelno/")
dest = orozje / "strelno"
if not dest.exists():
shutil.move(str(strelno), str(dest))
print(f" ✅ Moved")
else:
print(f" ⚠️ Destination exists, merging...")
for item in strelno.glob("*"):
if not (dest / item.name).exists():
shutil.move(str(item), str(dest / item.name))
strelno.rmdir()
print(f" ✅ Merged & removed")
# Move drevesa/ into rastline/
drevesa = SLIKE / "drevesa"
rastline = SLIKE / "rastline"
if drevesa.exists():
print(f"\n📦 Moving drevesa/ → rastline/drevesa/")
dest = rastline / "drevesa"
if not dest.exists():
shutil.move(str(drevesa), str(dest))
print(f" ✅ Moved")
else:
print(f" ⚠️ Destination exists, merging...")
for item in drevesa.glob("*"):
if not (dest / item.name).exists():
shutil.move(str(item), str(dest / item.name))
drevesa.rmdir()
print(f" ✅ Merged & removed")
# Check biomes/ (old folder)
biomes_old = SLIKE / "biomes"
if biomes_old.exists():
print(f"\n📦 Old biomes/ folder found")
content = list(biomes_old.glob("*"))
if len(content) > 0:
print(f" Moving content to biomi/...")
for item in content:
dest = biomi_folder / item.name
if not dest.exists():
shutil.move(str(item), str(dest))
print(f"{item.name}")
# Remove if empty
if len(list(biomes_old.glob("*"))) == 0:
biomes_old.rmdir()
print(f" ✅ Removed empty biomes/")
print("\n" + "="*70)
print("✅ CLEANUP COMPLETE!")
print("="*70)
# Final structure
print("\n📂 FINAL STRUCTURE:")
print(f"\nMain folders (should be visible in assets/slike/):")
print(f" ✅ liki/ - characters")
print(f" ✅ predmeti/ - items")
print(f" ✅ orozje/ - weapons")
print(f" ✅ rastline/ - plants")
print(f" ✅ efekti/ - effects")
print(f" ✅ sovrazniki/ - enemies")
print(f" ✅ biomi/ - numbered biomes")
print(f" ✅ zgradbe/ - buildings")
print(f" ✅ ui/ - UI elements")
print(f" ✅ cutscenes/ - cutscenes")
print(f"\nAnomalous zones (18 folders):")
for zone in ANOMALOUS:
zone_path = SLIKE / zone
status = "" if zone_path.exists() else ""
print(f" {status} {zone}/")
print(f"\nFolder count: {len(list(SLIKE.glob('*/')))} total")