Added new feature to add http proxy.

This commit is contained in:
da
2016-03-18 18:04:29 +01:00
parent 38085a4432
commit 516837f42d
5 changed files with 49 additions and 8 deletions
+13 -1
View File
@@ -11,16 +11,28 @@ public class StreamOpener extends Thread {
private Config c;
private String streamName;
private String quality;
private String proxy;
private String proxyParam;
public StreamOpener(Config c, int streamIndex, String quality) {
this.c = c;
this.streamName = c.getStreamName(streamIndex);
this.quality = quality;
this.proxy = c.getProxy();
}
public void run() {
try {
Logger.print("Starting stream livestreamer for "+this.streamName+" at "+this.quality+" quality");
Runtime rt = Runtime.getRuntime();
Process pr = rt.exec(this.c.getLSPath()+" twitch.tv/"+this.streamName+" "+this.quality);
// TODO: all this needs clean up
if (!this.proxy.equals("")) {
StringBuilder sb = new StringBuilder();
sb.append(" --http-proxy ");
sb.append(this.proxy);
this.proxyParam = sb.toString();
} else {
this.proxyParam = "";
}
Process pr = rt.exec(this.c.getLSPath()+" twitch.tv/"+this.streamName+" "+this.quality+this.proxyParam);
BufferedReader input = new BufferedReader(new InputStreamReader(pr.getInputStream()));