Subida a Gitea

This commit is contained in:
luisgulo 2023-06-02 17:07:42 +02:00
commit ab835c8667
9 changed files with 207 additions and 0 deletions

2
.directory Normal file
View File

@ -0,0 +1,2 @@
[Desktop Entry]
Icon=./.icon.png

17
.gitignore vendored Normal file
View File

@ -0,0 +1,17 @@
#---- Gambas files to ignore (v5)
*.gambas
.lock
*~
core
core.*
vgcore
vgcore.*
.kdbg*
.*.prof
.lang/*.pot
.gambas/*
.settings
.startup
.list
.info
#----

3
.hidden/CHANGELOG Normal file
View File

@ -0,0 +1,3 @@
* Tue Jan 31 2023 luisgulo <luisgulo@gmail.com> 1.0.0
- Version Inicial

BIN
.icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

25
.project Normal file
View File

@ -0,0 +1,25 @@
# Gambas Project File 3.0
Title=Download Video
Startup=FMain
Icon=gnome-mime-application-vnd.rn-realmedia-secure.png
Version=1.0.0
Component=gb.image
Component=gb.gui
Component=gb.form
Description="Aplicacion para extraer VIDEOS de una URL.\nHace uso de yt-dlp_linux"
Authors="LuisGuLo"
TabSize=2
Translate=1
Language=es_ES
Maintainer=luisgulo
Vendor=SoloConLinux
Address=luisgulo@gmail.com
Url=https://repositorio.soloconlinux.org.es
License=General Public License
PackageName=downvideo-1.0.0
Packager=1
Systems=debian
Menus=debian:"Applications/Video"
Categories=debian:"Video"
Groups=debian:"video"
ExtraDependencies=debian:"ytdlplinux\t\t"

116
.src/FMain.class Normal file
View File

@ -0,0 +1,116 @@
' Gambas class file
' Gambas class file
'' Instalar para todos los usuarios
' sudo wget https://yt-dl.org/latest/youtube-dl -O /usr/local/bin/youtube-dl
' sudo chmod 755 /usr/local/bin/youtube-dl
'' Tambien se puede usar solo para usuario local (en ruta privada)
'' Para actualizarlo: youtube-dl --update
'' Forma de uso (incluye imagen en audio)
' youtube-dl https://soundcloud.com/grupo/cancion --embed-thumbnail
Public hProceso As Process
Public Sub Form_Open()
Me.Title = "DownVideo - version " & Application.Version
Giro.Visible = False
Giro.Stop
' Definimos la shell para llamadas...
System.Shell = "/bin/bash"
CompruebaDL()
labelProcesando.Text = ""
End
Public Sub Form_Drop()
Dim cadenaDrag As String
If Drag.Format = "text/unicode" Then
'Borramos caracteres NULL (\x00) del codigo UNICODE recibido
cadenaDrag = Replace(Drag.Paste("text/unicode"), "\x00", "")
txtURL.Text = cadenaDrag
Else
Message.Title = ("URL no válida")
Message.Warning(("Solo puede arrastrar y soltar una URL") & gb.CrLf & ("Si tiene algún problema, pruebe a cortar y pegar la dirección"))
Endif
End
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...")
' Obtener el nombre de fichero
Shell "echo -ne $(youtube-dl " & txtURL.Text & " --get-filename)" To NombreFichero
If NombreFichero = ""
Message.Title = ("Error en URL")
Message.Error(("La URL indicada no se puede procesar para extraer vídeo"))
txtURL.Text = ""
Else
Dim MejorFormato As String
' Shell "echo -ne $(youtube-dl -F " & txtURL.Text & " | grep best |awk '{print $1}')" To MejorFormato
labelProcesando.Text = ("Descargando Vídeo")
txtGira.Visible = True
Wait 0.1
' Descargamos MUSICA e incluimos la imagen de la caratula embebida
hProceso = Shell ("cd " & User.Home & "/SoundClouding ; yt-dlp_linux -f mp4/bestvideo --embed-thumbnail " & txtURL.Text) For Read As "Proceso"
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
txtGira.Visible = False
labelProcesando.Text = "Descarga finalizada en: " & User.Home & "/SoundClouding" & gb.CrLf & NombreFichero
'Message.Title = ("Descarga finalizada")
'Message.Info(("Se ha descargado el audio/música en: ") & User.Home & "/SoundClouding" & gb.CrLf & " → " & NombreFichero)
txtURL.Text = ""
txtSalida.Text = ""
Shell "notify-send -t 3000 '" & "DownMusic:\n\nVídeo descargado correctamente'" Wait
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"))
Endif
' Reactivamos el boton
botonDescargar.Enabled = True
labelProcesando.Text = ""
End
Public Sub Proceso_Read()
Dim sline As String
sline = Read #Last, Lof(Last)
txtSalida.Text = sline
End
Public Function CompruebaDL()
' Comprobamos si existe youtube-dl (VERSION )
Dim Resultado As String
Shell "yt-dlp_linux --version 1>/dev/null 2>/dev/null; echo -n $?" To Resultado
If Resultado <> "0"
Message.Title = ("Error yt-dlp_linux")
Message.Error(("No se ha localizado la herramienta externa yt-dlp_linux") & gb.CrLf & ("* Debe instalarlo desde su gestor de paquetes"))
Quit
Endif
End

44
.src/FMain.form Normal file
View File

@ -0,0 +1,44 @@
# Gambas Form File 3.0
{ Form Form
MoveScaled(0,0,76,25)
Drop = True
Icon = Picture["gnome-mime-application-vnd.rn-realmedia-secure.png"]
Resizable = False
{ Giro Spinner
MoveScaled(48,9,8,8)
Visible = False
}
{ LabelURL Label
MoveScaled(1,0,74,4)
Text = ("Arrastre la URL del Audio/Música, o Cortar y Pegar en el recuadro de texto:")
}
{ txtURL TextBox
MoveScaled(1,4,74,4)
ToolTip = ("Arrastre aquí la URL de SoundCloud")
}
{ labelProcesando Label
MoveScaled(2,10,45,8)
Alignment = Align.TopLeft
}
{ txtSalida Label
MoveScaled(1,18,74,6)
Border = Border.Plain
}
{ botonDescargar ToolButton
MoveScaled(57,9,18,8)
Font = Font["Bold"]
ToolTip = ("Descargar Música")
Text = ("Descargar")
Picture = Picture["gnome-mime-application-vnd.rn-realmedia-secure.png"]
Border = True
}
{ txtGira Label
MoveScaled(48,9,8,8)
Visible = False
Font = Font["Bold,+4"]
Foreground = Color.Red
Text = ("|")
Alignment = Align.Center
}
}

0
README.md Normal file
View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB