salida en app v2
This commit is contained in:
+49
-5
@@ -1,9 +1,53 @@
|
||||
{
|
||||
"esde_src": "C:/mingw/gitea/python_gui/ES-DE",
|
||||
"roms_src": "C:/mingw/gitea/python_gui/ROMs",
|
||||
"esde_dst": "C:/mingw/gitea/python_gui/SD/ES-DE",
|
||||
"roms_dst": "C:/mingw/gitea/python_gui/SD/ROMs",
|
||||
"esde_src": "C:/Users/jaild/Retroid/ES-DE",
|
||||
"roms_src": "C:/Users/jaild/Retroid/ROMs",
|
||||
"esde_dst": "F:/ES-DE",
|
||||
"roms_dst": "F:/ROMs",
|
||||
"selected": [
|
||||
"atarilynx"
|
||||
"arcade",
|
||||
"arcadia",
|
||||
"atari2600",
|
||||
"atari5200",
|
||||
"atari7800",
|
||||
"atarijaguar",
|
||||
"atarilynx",
|
||||
"atomiswave",
|
||||
"channelf",
|
||||
"colecovision",
|
||||
"dreamcast",
|
||||
"fds",
|
||||
"gamegear",
|
||||
"gb",
|
||||
"gba",
|
||||
"gbc",
|
||||
"intellivision",
|
||||
"mastersystem",
|
||||
"megadrive",
|
||||
"megaduck",
|
||||
"msx",
|
||||
"msx2",
|
||||
"n64",
|
||||
"nds",
|
||||
"neogeo",
|
||||
"neogeocd",
|
||||
"nes",
|
||||
"ngp",
|
||||
"ngpc",
|
||||
"pcengine",
|
||||
"pcenginecd",
|
||||
"psp",
|
||||
"psx",
|
||||
"satellaview",
|
||||
"saturn",
|
||||
"sega32x",
|
||||
"segacd",
|
||||
"sg-1000",
|
||||
"snes",
|
||||
"supergrafx",
|
||||
"supervision",
|
||||
"videopac",
|
||||
"virtualboy",
|
||||
"wonderswan",
|
||||
"wonderswancolor"
|
||||
]
|
||||
}
|
||||
+69
-12
@@ -125,7 +125,7 @@ class DirectorySelectorApp:
|
||||
selected = [self.listbox.get(i) for i in self.listbox.curselection()]
|
||||
|
||||
if not selected:
|
||||
self.append_log("No hay sistemas seleccionados.")
|
||||
self.append_log("❌ No hay sistemas seleccionados.")
|
||||
return
|
||||
|
||||
esde_src = self.path_esde_src.get()
|
||||
@@ -134,44 +134,54 @@ class DirectorySelectorApp:
|
||||
roms_dst = self.path_roms_dst.get()
|
||||
|
||||
if not all([esde_src, roms_src, esde_dst, roms_dst]):
|
||||
self.append_log("ERROR: Debes configurar todas las rutas antes de continuar.")
|
||||
self.append_log("❌ ERROR: Debes configurar todas las rutas antes de continuar.")
|
||||
return
|
||||
|
||||
self.append_log("=== INICIANDO ROBOCOPY ===")
|
||||
self.append_log("=" * 60)
|
||||
self.append_log("🚀 INICIANDO PROCESO DE COPIA")
|
||||
self.append_log(f"📦 Total de sistemas a procesar: {len(selected)}")
|
||||
self.append_log("=" * 60)
|
||||
|
||||
for system in selected:
|
||||
self.append_log(f"\n--- Sistema: {system} ---")
|
||||
for idx, system in enumerate(selected, 1):
|
||||
self.append_log(f"\n{'=' * 60}")
|
||||
self.append_log(f"🎮 SISTEMA [{idx}/{len(selected)}]: {system.upper()}")
|
||||
self.append_log("=" * 60)
|
||||
|
||||
# ROMs
|
||||
self.append_log(f"\n📁 [1/3] Copiando ROMs...")
|
||||
self.launch_robocopy_with_log(
|
||||
os.path.join(roms_src, system),
|
||||
os.path.join(roms_dst, system)
|
||||
)
|
||||
|
||||
# ES-DE gamelists
|
||||
self.append_log(f"\n📋 [2/3] Copiando gamelists...")
|
||||
self.launch_robocopy_with_log(
|
||||
os.path.join(esde_src, "gamelists", system),
|
||||
os.path.join(esde_dst, "gamelists", system)
|
||||
)
|
||||
|
||||
# ES-DE downloaded_media
|
||||
self.append_log(f"\n🖼️ [3/3] Copiando media...")
|
||||
self.launch_robocopy_with_log(
|
||||
os.path.join(esde_src, "downloaded_media", system),
|
||||
os.path.join(esde_dst, "downloaded_media", system)
|
||||
)
|
||||
|
||||
self.append_log("\n=== ROBOCOPY COMPLETADO ===")
|
||||
self.append_log(f"\n✅ Sistema '{system}' completado")
|
||||
|
||||
self.append_log("\n" + "=" * 60)
|
||||
self.append_log("🎉 PROCESO COMPLETADO EXITOSAMENTE")
|
||||
self.append_log("=" * 60)
|
||||
|
||||
def launch_robocopy_with_log(self, src, dst):
|
||||
if not os.path.isdir(src):
|
||||
self.append_log(f"[IGNORADO] No existe: {src}")
|
||||
self.append_log(f" ⚠️ Carpeta no existe (omitido): {os.path.basename(src)}")
|
||||
return
|
||||
|
||||
os.makedirs(dst, exist_ok=True)
|
||||
|
||||
cmd = ["robocopy", src, dst, "/MIR"]
|
||||
|
||||
self.append_log(f"Ejecutando: robocopy \"{src}\" \"{dst}\" /MIR")
|
||||
cmd = ["robocopy", src, dst, "/MIR", "/NP", "/NDL", "/NFL"]
|
||||
|
||||
process = subprocess.Popen(
|
||||
cmd,
|
||||
@@ -181,13 +191,60 @@ class DirectorySelectorApp:
|
||||
universal_newlines=True
|
||||
)
|
||||
|
||||
# Variables para extraer el resumen
|
||||
files_copied = 0
|
||||
dirs_copied = 0
|
||||
total_bytes = 0
|
||||
|
||||
for line in process.stdout:
|
||||
line = line.strip()
|
||||
if line:
|
||||
self.append_log(line)
|
||||
|
||||
# Extraer información relevante del output de robocopy
|
||||
if "Files :" in line and "Copied" in line:
|
||||
parts = line.split()
|
||||
try:
|
||||
copied_idx = parts.index("Copied")
|
||||
if copied_idx + 1 < len(parts):
|
||||
files_copied = int(parts[copied_idx + 1])
|
||||
except (ValueError, IndexError):
|
||||
pass
|
||||
|
||||
elif "Dirs :" in line and "Copied" in line:
|
||||
parts = line.split()
|
||||
try:
|
||||
copied_idx = parts.index("Copied")
|
||||
if copied_idx + 1 < len(parts):
|
||||
dirs_copied = int(parts[copied_idx + 1])
|
||||
except (ValueError, IndexError):
|
||||
pass
|
||||
|
||||
elif "Bytes :" in line and "Copied" in line:
|
||||
parts = line.split()
|
||||
try:
|
||||
copied_idx = parts.index("Copied")
|
||||
if copied_idx + 1 < len(parts):
|
||||
bytes_str = parts[copied_idx + 1].replace(",", "")
|
||||
total_bytes = int(bytes_str)
|
||||
except (ValueError, IndexError):
|
||||
pass
|
||||
|
||||
process.wait()
|
||||
|
||||
# Convertir bytes a formato legible
|
||||
if total_bytes > 0:
|
||||
if total_bytes < 1024:
|
||||
size_str = f"{total_bytes} B"
|
||||
elif total_bytes < 1024**2:
|
||||
size_str = f"{total_bytes/1024:.2f} KB"
|
||||
elif total_bytes < 1024**3:
|
||||
size_str = f"{total_bytes/(1024**2):.2f} MB"
|
||||
else:
|
||||
size_str = f"{total_bytes/(1024**3):.2f} GB"
|
||||
|
||||
self.append_log(f" ✓ {files_copied} archivos, {dirs_copied} carpetas ({size_str})")
|
||||
else:
|
||||
self.append_log(f" ✓ Sin cambios (ya sincronizado)")
|
||||
|
||||
# ---------------------------------------------------------
|
||||
# PERSISTENCIA
|
||||
# ---------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user