From fe6728faeb657aac4edc68155425c10c1b514100 Mon Sep 17 00:00:00 2001 From: luisgulo Date: Wed, 12 Jun 2024 23:37:14 +0200 Subject: [PATCH] Solventado error llamada sub-shell --- .hidden/CHANGELOG | 3 +++ .project | 4 +-- .src/FMain.class | 66 +++++++++++++++++++++++++---------------------- .src/FMain.form | 6 ++--- 4 files changed, 43 insertions(+), 36 deletions(-) diff --git a/.hidden/CHANGELOG b/.hidden/CHANGELOG index bbd0dd4..49ae06a 100644 --- a/.hidden/CHANGELOG +++ b/.hidden/CHANGELOG @@ -1,3 +1,6 @@ +* Wed Jun 12 2024 Luis GuLo 2.2.0 +- Solucion errores uso llamada a sistema shell + * Tue Apr 23 2024 Luis GuLo 1.0.22 - Ajuste version diff --git a/.project b/.project index 278e526..5eb7060 100644 --- a/.project +++ b/.project @@ -2,7 +2,7 @@ Title=SoundClouding Startup=FMain Icon=icono.png -Version=1.0.22 +Version=2.2.0 Component=gb.image Component=gb.gui Component=gb.form @@ -17,7 +17,7 @@ Vendor=LuisGuLo Address=luisgulo@gmail.com Url=https://gitea.soloconlinux.org.es/luisgulo/SoundClouding License=General Public License -PackageName=soundclouding-1.0.22 +PackageName=soundclouding-2.2.0 PackageVersion=2 CreateEachDirectory=1 Packager=1 diff --git a/.src/FMain.class b/.src/FMain.class index f1cda85..6ab7b31 100644 --- a/.src/FMain.class +++ b/.src/FMain.class @@ -37,56 +37,60 @@ Public Sub botonDescargar_Click() Dim NombreFichero As String 'Crear la carpeta SoundClouding Shell "mkdir -p " & User.Home & "/SoundClouding" Wait - ' Desactivamos para evitar pulsar más de una vez a los nerviosos botonDescargar.Enabled = False If txtURL.Text <> "" ' Mostramos que estamos haciendo algo... - labelProcesando.Text = ("Chequeando URL y ficheros multimedia...") + 'labelProcesando.Text = ("Chequeando URL y ficheros multimedia...") ' Obtener el nombre de fichero 'Shell "echo -ne $(yt-dlp " & txtURL.Text & " --get-filename)" To NombreFichero 'Shell "echo -ne $(yt-dlp " & txtURL.Text & " -F 2>/dev/null|grep mp4|grep -v 'only'|tail -1|awk '{print $1})" To NombreFichero - Shell "echo -ne $(yt-dlp " & txtURL.Text & " -F 2>/dev/null|grep mp4|grep -v 'only'|tail -1|awk '{print $1}')" To NombreFichero + 'Shell "echo -ne $(yt-dlp " & txtURL.Text & " -F 2>/dev/null|grep mp4|grep -v 'only'|tail -1|awk '{print $1}')" To NombreFichero + 'Message.Info(("ID de video:" & NombreFichero)) - If NombreFichero = "" - Message.Title = ("Error en URL") - Message.Error(("La URL indicada no se puede procesar para extraer audio/vídeo")) - txtURL.Text = "" - Else + 'If NombreFichero = "" + ' Message.Title = ("Error en URL") + ' Message.Error(("La URL indicada no se puede procesar para extraer audio/vídeo")) + ' txtURL.Text = "" + + 'Else Dim MejorFormato As String '' Obtener el ID del mejor formato MP4 - Shell "echo -ne $(yt-dlp -F " & txtURL.Text & " 2>/dev/null|grep mp4|grep -v 'only'|tail -1|awk '{print $1}' )" To MejorFormato - labelProcesando.Text = ("Descargando multimedia (audio/vídeo)") + 'Shell "echo -ne $(yt-dlp -F " & txtURL.Text & " 2>/dev/null|grep mp4|grep -v 'only'|tail -1|awk '{print $1}' )" To MejorFormato + 'labelProcesando.Text = ("Descargando multimedia (audio/vídeo)") 'Giro.Visible = True 'Giro.Start 'Giro.Refresh - txtGira.Visible = True + Shell "notify-send -t 6000 '📽️ SoundClouding:\nDescargando audio/vídeo...\nEspere a que finalice'" + labelProcesando.Text = "Descargando... Espere a que finalice" Wait 0.1 + 'txtGira.Visible = True + 'Wait 0.1 ' Descargamos musica/Video e incluimos la imagen de la caratula embebida If chkMusica.Value Then - 'Shell "cd " & User.Home & "/SoundClouding ; youtube-dl " & txtURL.Text & " --embed-thumbnail -x --audio-format mp3 " Wait - hProceso = Shell ("cd " & User.Home & "/SoundClouding ; yt-dlp " & txtURL.Text & " -x --audio-format mp3 ") For Read As "Proceso" + Shell "cd " & User.Home & "/SoundClouding ; yt-dlp " & txtURL.Text & " --embed-thumbnail -x --audio-format mp3 " Wait + 'hProceso = Shell ("cd " & User.Home & "/SoundClouding ; yt-dlp " & txtURL.Text & " -x --audio-format mp3 ") For Read As "Proceso" Else - 'Shell "cd " & User.Home & "/SoundClouding ; youtube-dl " & txtURL.Text & " --embed-thumbnail" Wait ' Descargar por ID (-f) - hProceso = Shell ("cd " & User.Home & "/SoundClouding ; yt-dlp -f " & MejorFormato & " " & txtURL.Text) For Read As "Proceso" + Shell "cd " & User.Home & "/SoundClouding ; yt-dlp " & txtURL.Text & " --embed-thumbnail" Wait ' Descargar por ID (-f) + 'hProceso = Shell ("cd " & User.Home & "/SoundClouding ; yt-dlp " & txtURL.Text & " --embed thumbnail --ignore-errors") For Read As "Proceso" Endif - Do While hProceso.State = Process.Running - Select Case txtGira.Text - Case "|" - txtGira.Text = "/" - Case "/" - txtGira.Text = "-" - Case "-" - txtGira.Text = "\\" - Case "\\" - txtGira.Text = "|" - Case Else - txtGira.Text = "|" - End Select - Wait 0.1 - Loop + ' Do While hProceso.State = Process.Running + ' Select Case txtGira.Text + ' Case "|" + ' txtGira.Text = "/" + ' Case "/" + ' txtGira.Text = "-" + ' Case "-" + ' txtGira.Text = "\\" + ' Case "\\" + ' txtGira.Text = "|" + ' Case Else + ' txtGira.Text = "|" + ' End Select + ' Wait 0.1 + ' Loop 'Giro.Stop 'Giro.Visible = False txtGira.Visible = False @@ -94,7 +98,7 @@ Public Sub botonDescargar_Click() Message.Title = ("Descarga finalizada") Message.Info(("Se ha descargado el audio/vídeo en: ") & User.Home & "/SoundClouding") txtURL.Text = "" - Endif + 'Endif Else Message.Title = ("URL no válida") Message.Warning(("Puede arrastrar y soltar una URL") & gb.CrLf & ("Si tiene algún problema, pruebe a cortar y pegar la dirección")) diff --git a/.src/FMain.form b/.src/FMain.form index d3391da..2e7e62c 100644 --- a/.src/FMain.form +++ b/.src/FMain.form @@ -2,9 +2,9 @@ { Form Form MoveScaled(0,0,77,29) - Mouse = Mouse.Pointing + Mouse = Cursor.Pointing Drop = True - Text = ("SoundClouding") + Text = ("📽️ SoundClouding") Icon = Picture["icono.png"] Resizable = False { txtURL TextBox @@ -40,8 +40,8 @@ Visible = False Font = Font["Bold,+4"] Foreground = Color.Red - Text = ("|") Alignment = Align.Center + Text = ("|") } { txtSalida Label MoveScaled(1,22,74,6)