Skip to content

Commit

Permalink
En opciones se puede indicar un proxy para el rtmp y las urls http.
Browse files Browse the repository at this point in the history
  • Loading branch information
forestrf committed Apr 25, 2014
1 parent deb1902 commit 9fb07c3
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 3 deletions.
10 changes: 9 additions & 1 deletion Project files/RTMP-Downloader/Descargador.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,17 @@ public bool download ()

string parametroO = Utilidades.GetParametro(url, "o");
if(parametroO.IndexOf(":\\") == -1){

url = Utilidades.ReemplazaParametro (url, "o", MainClass.configs.rutaDescargas + parametroO);
}

if(MainClass.configs.proxy != null && MainClass.configs.proxy != ""){
if(Utilidades.GetParametro(url, "S")!=""){
url = Utilidades.ReemplazaParametro (url, "S", MainClass.configs.proxy);
}
else{
url += " -S \""+MainClass.configs.proxy+"\"";
}
}

Debug.WriteLine(Utilidades.WL("Iniciando proceso RTMPDump para = "+url));
procesoRTMPDUMP = new ProcessStartInfo ();
Expand Down
6 changes: 6 additions & 0 deletions Project files/RTMP-Downloader/HTML.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ public static class HTML
"<div class='contenidoTIT'>Dónde se guardarán la descargas:</div>" +
"<div class='contenidoCONT'>Ruta actual: "+MainClass.configs.rutaDescargas+"<br>" +
"<a href='/listadirs?ruta="+MainClass.configs.rutaDescargas+"'>Elejir dónde guardar los vídeos</a></div>" +
"<div class='contenidoTIT'>Configurar un proxy:</div>" +
"<form method='GET' action='/elijeproxy'>"+
"<div class='contenidoCONT'>Proxy: <input type='text' name='valor' placeholder='x.x.x.x:xxxx' value='"+MainClass.configs.proxy+"'>" +
"<input type='submit' value='Usar este proxy'><br>" +
"Para no usar proxy guarda el campo Proxy vacio." +
"</form>"+
"</div>";
}

Expand Down
17 changes: 15 additions & 2 deletions Project files/RTMP-Downloader/MainClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public static void Main (string[] cmdLine)


configs = Utilidades.leerConfigs ();
if (configs.rutaDescargas == null) {
if (configs.rutaDescargas == null || configs.rutaDescargas == "") {
configs.rutaDescargas = relativePath;
Utilidades.escribirConfigs (configs);
}
Expand Down Expand Up @@ -164,7 +164,12 @@ public static void Main (string[] cmdLine)
}
//Descargar urlhttp para usar el contenido como url
try{
url = new WebClient().DownloadString(urlhttp);
WebClient client = new WebClient();
if(configs.proxy != null && configs.proxy != ""){
WebProxy wp = new WebProxy(configs.proxy);
client.Proxy = wp;
}
url = client.DownloadString(urlhttp);
Debug.WriteLine(Utilidades.WL("url descargada desde urlhttp = "+url));
Debug.WriteLine(Utilidades.WL("Poniendo la descarga en cola"));
var t = new Thread(() => lanzaDescarga(url, nombre));
Expand Down Expand Up @@ -225,6 +230,14 @@ public static void Main (string[] cmdLine)
myServer.EnviaLocation ("/opciones");
continue;
}

if (path == "/elijeproxy") {
string proxy = GETurl.getParametro("valor");
configs.proxy = proxy;
Utilidades.escribirConfigs (configs);
myServer.EnviaLocation ("/opciones");
continue;
}

if (path == "/" && accion == "") {
myServer.Envia (HTML.getIndex());
Expand Down
1 change: 1 addition & 0 deletions Project files/RTMP-Downloader/Utilidades.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public static int UnixTimestamp()
[Serializable]
public class Configs{
public string rutaDescargas;
public string proxy;
}

public class Bloqueo{
Expand Down
1 change: 1 addition & 0 deletions Project files/RTMP-Downloader/web/css/all.css
Original file line number Diff line number Diff line change
Expand Up @@ -225,4 +225,5 @@ li {
}
.contenidoCONT{
font-size: 15px;
margin-bottom: 30px;
}

0 comments on commit 9fb07c3

Please sign in to comment.