Last active
December 5, 2025 00:02
-
-
Save AARP41298/21e7f469dc2dd6627e14ab8e9ea5ea82 to your computer and use it in GitHub Desktop.
Script para crear enlaces simbolicos en su carpeta de exCon correspondiente segun el .mogg
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import pathlib | |
| import pyuac | |
| def main(): | |
| # Pedir rutas dinámicamente | |
| base_dir = input("📂 Carpeta YARG destino: ").strip().strip('"') | |
| videos_dir = input("🎬 Carpeta VIDEOS origen: ").strip().strip('"') | |
| if not os.path.isdir(base_dir): | |
| print(f"❌ Carpeta destino no válida: {base_dir}") | |
| os.system("pause") | |
| return | |
| if not os.path.isdir(videos_dir): | |
| print(f"❌ Carpeta origen no válida: {videos_dir}") | |
| os.system("pause") | |
| return | |
| creados = [] | |
| existentes = [] | |
| no_encontrados = [] | |
| carpetas_sin_video = [] | |
| # === Crear vínculos según videos existentes === | |
| for file in os.listdir(videos_dir): | |
| if not file.lower().endswith(".webm"): | |
| continue | |
| video_name = os.path.splitext(file)[0].strip().lower() | |
| video_path = os.path.join(videos_dir, file) | |
| found = False | |
| for root, dirs, files in os.walk(base_dir): | |
| dirs[:] = [d for d in dirs if d.lower() != "songs_updates"] | |
| for d in dirs: | |
| if d.lower() == video_name: | |
| song_dir = os.path.join(root, d) | |
| link_path = os.path.join(song_dir, "video.webm") | |
| if os.path.exists(link_path): | |
| existentes.append(link_path) | |
| else: | |
| try: | |
| os.symlink(video_path, link_path) | |
| creados.append(link_path) | |
| except OSError as e: | |
| print(f"❌ Error al crear vínculo para {video_name}: {e}") | |
| found = True | |
| break | |
| if found: | |
| break | |
| if not found: | |
| no_encontrados.append(video_name) | |
| # === Buscar carpetas cuyo .mogg no tiene video correspondiente === | |
| video_names = { | |
| os.path.splitext(f)[0].strip().lower() | |
| for f in os.listdir(videos_dir) | |
| if f.lower().endswith(".webm") | |
| } | |
| for root, dirs, files in os.walk(base_dir): | |
| dirs[:] = [d for d in dirs if d.lower() != "songs_updates"] | |
| for file in files: | |
| if file.lower().endswith(".mogg"): | |
| song_name = os.path.splitext(file)[0].strip().lower() | |
| if song_name not in video_names: | |
| carpetas_sin_video.append(os.path.join(root, file)) | |
| # === Mostrar resumen === | |
| print("\n===== 📊 RESUMEN =====") | |
| print(f"✅ Vínculos creados: {len(creados)}") | |
| for p in creados: | |
| print(f" - {p}") | |
| print(f"\n📁 Ya existentes: {len(existentes)}") | |
| for p in existentes: | |
| print(f" - {p}") | |
| print(f"\n⚠️ No se encontró carpeta para videos: {len(no_encontrados)}") | |
| for name in no_encontrados: | |
| print(f" - {name}") | |
| print(f"\n📂 Carpetas sin videos (.mogg sin .webm): {len(carpetas_sin_video)}") | |
| for path in carpetas_sin_video: | |
| print(f" - {path}") | |
| print("\n========================\n") | |
| os.system("pause") # Mantiene la ventana abierta | |
| if __name__ == "__main__": | |
| if not pyuac.isUserAdmin(): | |
| print("🔒 Reiniciando con permisos de administrador...") | |
| pyuac.runAsAdmin() | |
| else: | |
| main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment