From dad6dcdff70a9a74e8726549c12da05060ad30d8 Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Thu, 22 Jan 2026 19:01:05 +0100 Subject: [PATCH] salida en app v2 --- config.json | 54 ++++++++++++++++++++++++++++++--- test_tkinter.py | 81 +++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 118 insertions(+), 17 deletions(-) diff --git a/config.json b/config.json index 2727d5c..653e8db 100644 --- a/config.json +++ b/config.json @@ -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" ] } \ No newline at end of file diff --git a/test_tkinter.py b/test_tkinter.py index 3044352..ae99725 100644 --- a/test_tkinter.py +++ b/test_tkinter.py @@ -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 # ---------------------------------------------------------