Archived
Added new feature to add http proxy.
This commit is contained in:
@@ -17,6 +17,8 @@ public class Config implements Serializable {
|
|||||||
|
|
||||||
private int sortStreamsBy;
|
private int sortStreamsBy;
|
||||||
|
|
||||||
|
private String proxy;
|
||||||
|
|
||||||
public int getLastSelectedStream() {
|
public int getLastSelectedStream() {
|
||||||
return lastSelectedStream;
|
return lastSelectedStream;
|
||||||
}
|
}
|
||||||
@@ -69,4 +71,11 @@ public class Config implements Serializable {
|
|||||||
this.streamItems = list;
|
this.streamItems = list;
|
||||||
ConfigFileIOHandler.save();
|
ConfigFileIOHandler.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getProxy() {
|
||||||
|
return proxy;
|
||||||
|
}
|
||||||
|
public void setProxy(String proxy) {
|
||||||
|
this.proxy = proxy;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,7 @@
|
|||||||
</grid>
|
</grid>
|
||||||
</children>
|
</children>
|
||||||
</grid>
|
</grid>
|
||||||
<grid id="e3588" layout-manager="GridLayoutManager" row-count="3" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
<grid id="e3588" layout-manager="GridLayoutManager" row-count="4" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
<margin top="0" left="0" bottom="0" right="0"/>
|
<margin top="0" left="0" bottom="0" right="0"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||||
@@ -67,7 +67,7 @@
|
|||||||
</component>
|
</component>
|
||||||
<component id="42a4f" class="javax.swing.JCheckBox" binding="nichtImplementiertCheckBox" default-binding="true">
|
<component id="42a4f" class="javax.swing.JCheckBox" binding="nichtImplementiertCheckBox" default-binding="true">
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties>
|
<properties>
|
||||||
<text value=" (nicht implementiert)"/>
|
<text value=" (nicht implementiert)"/>
|
||||||
@@ -75,7 +75,7 @@
|
|||||||
</component>
|
</component>
|
||||||
<component id="e34b3" class="javax.swing.JLabel">
|
<component id="e34b3" class="javax.swing.JLabel">
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties>
|
<properties>
|
||||||
<text value="Debugmodus:"/>
|
<text value="Debugmodus:"/>
|
||||||
@@ -99,7 +99,7 @@
|
|||||||
</component>
|
</component>
|
||||||
<component id="c3f1e" class="javax.swing.JLabel">
|
<component id="c3f1e" class="javax.swing.JLabel">
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties>
|
<properties>
|
||||||
<text value="Favoriten Import:"/>
|
<text value="Favoriten Import:"/>
|
||||||
@@ -107,7 +107,7 @@
|
|||||||
</component>
|
</component>
|
||||||
<component id="3e70" class="javax.swing.JTextField" binding="twitchBenutzernameTextField" default-binding="true">
|
<component id="3e70" class="javax.swing.JTextField" binding="twitchBenutzernameTextField" default-binding="true">
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||||
<preferred-size width="150" height="-1"/>
|
<preferred-size width="150" height="-1"/>
|
||||||
</grid>
|
</grid>
|
||||||
</constraints>
|
</constraints>
|
||||||
@@ -117,12 +117,28 @@
|
|||||||
</component>
|
</component>
|
||||||
<component id="9749e" class="javax.swing.JButton" binding="buttonImportUserData">
|
<component id="9749e" class="javax.swing.JButton" binding="buttonImportUserData">
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="2" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
<grid row="3" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties>
|
<properties>
|
||||||
<text value="Importieren"/>
|
<text value="Importieren"/>
|
||||||
</properties>
|
</properties>
|
||||||
</component>
|
</component>
|
||||||
|
<component id="2578" class="javax.swing.JTextField" binding="textFieldProxy">
|
||||||
|
<constraints>
|
||||||
|
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||||
|
<preferred-size width="150" height="-1"/>
|
||||||
|
</grid>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
</component>
|
||||||
|
<component id="e33c2" class="javax.swing.JLabel">
|
||||||
|
<constraints>
|
||||||
|
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<text value="Proxy (optional):"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
</children>
|
</children>
|
||||||
</grid>
|
</grid>
|
||||||
</children>
|
</children>
|
||||||
|
|||||||
@@ -16,9 +16,11 @@ public class SettingsWindow extends JDialog {
|
|||||||
private JButton suchenButton;
|
private JButton suchenButton;
|
||||||
private JTextField twitchBenutzernameTextField;
|
private JTextField twitchBenutzernameTextField;
|
||||||
private JButton buttonImportUserData;
|
private JButton buttonImportUserData;
|
||||||
|
private JTextField textFieldProxy;
|
||||||
|
|
||||||
public SettingsWindow() {
|
public SettingsWindow() {
|
||||||
textField1.setText(ConfigFileInstanceHandler.getConfig().getLSPath());
|
textField1.setText(ConfigFileInstanceHandler.getConfig().getLSPath());
|
||||||
|
textFieldProxy.setText(ConfigFileInstanceHandler.getConfig().getProxy());
|
||||||
setContentPane(contentPane);
|
setContentPane(contentPane);
|
||||||
setModal(true);
|
setModal(true);
|
||||||
getRootPane().setDefaultButton(buttonOK);
|
getRootPane().setDefaultButton(buttonOK);
|
||||||
@@ -95,6 +97,7 @@ public class SettingsWindow extends JDialog {
|
|||||||
|
|
||||||
private void onOK() {
|
private void onOK() {
|
||||||
ConfigFileInstanceHandler.getConfig().setLSPath(textField1.getText());
|
ConfigFileInstanceHandler.getConfig().setLSPath(textField1.getText());
|
||||||
|
ConfigFileInstanceHandler.getConfig().setProxy(textFieldProxy.getText());
|
||||||
ConfigFileIOHandler.save(ConfigFileInstanceHandler.getConfig());
|
ConfigFileIOHandler.save(ConfigFileInstanceHandler.getConfig());
|
||||||
dispose();
|
dispose();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import com.ixab.GUI.MainWindow;
|
|||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
private final static String version = "0.51 Alpha";
|
private final static String version = "0.52 Alpha";
|
||||||
private static Config c = null;
|
private static Config c = null;
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
try {
|
try {
|
||||||
@@ -45,6 +45,7 @@ public class Main {
|
|||||||
jfc.showOpenDialog(jf);
|
jfc.showOpenDialog(jf);
|
||||||
if (jfc.getSelectedFile() == null) System.exit(-1);
|
if (jfc.getSelectedFile() == null) System.exit(-1);
|
||||||
c.setLSPath(jfc.getSelectedFile().getAbsolutePath());
|
c.setLSPath(jfc.getSelectedFile().getAbsolutePath());
|
||||||
|
c.setProxy("");
|
||||||
jf.dispose();
|
jf.dispose();
|
||||||
ConfigFileIOHandler.save(c);
|
ConfigFileIOHandler.save(c);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,16 +11,28 @@ public class StreamOpener extends Thread {
|
|||||||
private Config c;
|
private Config c;
|
||||||
private String streamName;
|
private String streamName;
|
||||||
private String quality;
|
private String quality;
|
||||||
|
private String proxy;
|
||||||
|
private String proxyParam;
|
||||||
public StreamOpener(Config c, int streamIndex, String quality) {
|
public StreamOpener(Config c, int streamIndex, String quality) {
|
||||||
this.c = c;
|
this.c = c;
|
||||||
this.streamName = c.getStreamName(streamIndex);
|
this.streamName = c.getStreamName(streamIndex);
|
||||||
this.quality = quality;
|
this.quality = quality;
|
||||||
|
this.proxy = c.getProxy();
|
||||||
}
|
}
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
Logger.print("Starting stream livestreamer for "+this.streamName+" at "+this.quality+" quality");
|
Logger.print("Starting stream livestreamer for "+this.streamName+" at "+this.quality+" quality");
|
||||||
Runtime rt = Runtime.getRuntime();
|
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()));
|
BufferedReader input = new BufferedReader(new InputStreamReader(pr.getInputStream()));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user