Compare commits

19 Commits
Author SHA1 Message Date
Unknown 79492b2887 Removed unnecessary files 2017-10-01 22:24:18 +02:00
da 479d7a2998 Fixed artifact. 2016-05-19 17:08:07 +02:00
da f2501ee103 Now using JSON config file. Bug fixes and improvements. 2016-05-18 20:52:22 +02:00
da a67d4d70d7 Removed IntelliJ project files. 2016-05-17 14:07:26 +02:00
da 907ba07b2e Main window is now resizable. Set minimum size. 2016-05-17 14:05:53 +02:00
da a0b1985e07 Translated README.md 2016-05-15 22:50:47 +02:00
daandtoksikk d927bd0d80 translated README.md 2016-05-12 13:12:26 +02:00
da f53dd46605 Added IntelliJ Project Files 2016-04-07 16:58:36 +02:00
da 16e9c6e0b0 edited README.md 2016-03-21 21:01:39 +01:00
da 60775d3378 added README.md 2016-03-21 20:56:24 +01:00
da 8523f9fa09 added precompiled .jar file 2016-03-21 20:20:10 +01:00
da 516837f42d Added new feature to add http proxy. 2016-03-18 18:04:29 +01:00
da 38085a4432 Modified .gitignore. 2016-03-06 23:00:54 +01:00
da 36d2cb472d [MODIFIED] Kleine Layout Anpassung 2015-12-07 08:39:52 +01:00
da 19d2912638 [MODIFIED] Kleine Layout Anpassung 2015-12-07 08:36:43 +01:00
toksikk ce9f1cd4ed [MODIFIED] Hauptfenster Layout angepasst 2015-12-03 12:57:52 +01:00
da 0ef94637f9 [ADDED] Persistierung der Checkbox-Auswahl 2015-12-01 18:33:09 +01:00
da b3c79235ed [FIX] NullPointerException nach Start ohne Items in der Liste 2015-11-30 21:55:54 +01:00
da da7301e374 [ADDED] Nächster und Vorheriger Button
[ADDED] AlertWindow für später
2015-11-30 21:09:29 +01:00
18 changed files with 472 additions and 119 deletions
+3 -2
View File
@@ -1,5 +1,6 @@
/out/production
/.idea /.idea
/out
/jLSLauncher.iml /jLSLauncher.iml
/config.dat /out/artifacts/jLSLauncher_jar/config.json
/config.json
# Created by .ignore support plugin (hsz.mobi) # Created by .ignore support plugin (hsz.mobi)
+41
View File
@@ -0,0 +1,41 @@
# jLSLauncher - Livestreamer launching utility
### Download
A pre-compiled `.jar`-file can be downloaded here: https://dev.ixab.de/da/jLSLauncher/raw/master/out/artifacts/jLSLauncher_jar/jLSLauncher.jar
### Required Software
* Java (minimum required is v7) - https://www.java.com/de/download/
* Livestreamer
### Installation of Livestreamer (Windows)
1. Download Livestreamer for Windows: http://docs.livestreamer.io/install.html#zip-archive
2. Extract the Zip-File to a folder of your choice.
### Installation of Livestreamer (Linux)
Please use your distribution's packet manager.
Optionally you can download Livestreamer here: http://docs.livestreamer.io/install.html
### Installation von jLSLauncher
`jLSLauncher.jar` does not need an installation and can be executed as is.
You can move or copy this tool to any other location you like.
The configuration is stored in a file named `config.json` which, if present, has to be moved to the same location.
### Usage of jLSLauncher
Double click `jLSLauncher.jar`.
If there is no program associated to launching `*.jar` files, jLSLauncher has to be launched via console/shell with the following commands:
* Windows: `java -jar X:\Pfad\zu\jLSLauncher.jar`
* Linux: `java -jar /pfad/zu/jLSLauncher.jar`
At the first start of jLSLauncher a *Open file* dialog is displayed. You'll have to point this to the previously extracted `livestreamer.exe` or `livestreamer` binary file on Linux.
### Bug Reports
Please use the Issue-Tracker at: https://dev.ixab.de/da/jLSLauncher/issues
Alternative method is to write a mail to da-bugreport@ixab.de
For detailed debug output, please start jLSLauncher via console or shell.
Binary file not shown.
Binary file not shown.
+43
View File
@@ -6,11 +6,44 @@ import java.util.ArrayList;
public class Config implements Serializable { public class Config implements Serializable {
private String LSPath; private String LSPath;
private ArrayList<StreamConfigItem> streamItems; private ArrayList<StreamConfigItem> streamItems;
public int getSortStreamsBy() {
return sortStreamsBy;
}
public void setSortStreamsBy(int sortStreamsBy) {
this.sortStreamsBy = sortStreamsBy;
}
private int sortStreamsBy;
private String proxy;
public int getLastSelectedStream() {
return lastSelectedStream;
}
public void setLastSelectedStream(int lastSelectedStream) {
this.lastSelectedStream = lastSelectedStream;
}
private int lastSelectedStream;
public int getLastSelectedQuality() {
return lastSelectedQuality;
}
public void setLastSelectedQuality(int lastSelectedQuality) {
this.lastSelectedQuality = lastSelectedQuality;
}
private int lastSelectedQuality;
public Config() { public Config() {
this.streamItems = new ArrayList<StreamConfigItem>(); this.streamItems = new ArrayList<StreamConfigItem>();
setSortStreamsBy(1);
setLastSelectedStream(-1);
setLastSelectedQuality(-1);
} }
public void setLSPath(String path) { public void setLSPath(String path) {
this.LSPath = path; this.LSPath = path;
ConfigFileIOHandler.save();
} }
public String getLSPath() { public String getLSPath() {
return this.LSPath; return this.LSPath;
@@ -21,9 +54,11 @@ public class Config implements Serializable {
} }
public void addStream(String streamName) { public void addStream(String streamName) {
this.streamItems.add(new StreamConfigItem(streamName)); this.streamItems.add(new StreamConfigItem(streamName));
ConfigFileIOHandler.save();
} }
public void removeStream(Object stream) { public void removeStream(Object stream) {
this.streamItems.remove(stream); this.streamItems.remove(stream);
ConfigFileIOHandler.save();
} }
public ArrayList<StreamConfigItem> getStreams() { public ArrayList<StreamConfigItem> getStreams() {
return this.streamItems; return this.streamItems;
@@ -33,5 +68,13 @@ public class Config implements Serializable {
} }
public void replaceStreamList(ArrayList<StreamConfigItem> list) { public void replaceStreamList(ArrayList<StreamConfigItem> list) {
this.streamItems = list; this.streamItems = list;
ConfigFileIOHandler.save();
}
public String getProxy() {
return proxy;
}
public void setProxy(String proxy) {
this.proxy = proxy;
} }
} }
@@ -1,53 +1,61 @@
package com.ixab.ConfigHandling; package com.ixab.ConfigHandling;
import com.cedarsoftware.util.io.JsonReader;
import com.cedarsoftware.util.io.JsonWriter;
import com.ixab.Logging.Logger; import com.ixab.Logging.Logger;
import java.io.*; import java.io.*;
import java.util.Scanner;
public class ConfigFileIOHandler { public class ConfigFileIOHandler {
public static Config load(String path) { public static Config load(String path) {
Config c = null;
try String content;
{ StringBuilder sb = new StringBuilder();
FileInputStream fileIn = new FileInputStream(path); try {
ObjectInputStream in = new ObjectInputStream(fileIn); String line = null;
c = (Config) in.readObject(); FileReader fr = new FileReader(path);
in.close(); BufferedReader br = new BufferedReader(fr);
fileIn.close(); while ((line = br.readLine()) != null) {
}catch(IOException i) sb.append(line);
{ }
i.printStackTrace(); br.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
return null; return null;
}catch(ClassNotFoundException e) } catch (IOException e) {
{
Logger.print("Config class not found");
e.printStackTrace(); e.printStackTrace();
return null; return null;
} }
return c; content = sb.toString();
Config c = (Config) JsonReader.jsonToJava(content);
if (c instanceof Config) {
Logger.print("Config loaded.");
return c;
} else {
return null;
}
} }
public static void save(Config c, String path) { public static void save(Config c, String path) {
try try {
{ FileWriter fw = new FileWriter(path);
FileOutputStream fileOut = BufferedWriter bw = new BufferedWriter(fw);
new FileOutputStream("config.dat"); bw.write(JsonWriter.formatJson(JsonWriter.objectToJson(c)));
ObjectOutputStream out = new ObjectOutputStream(fileOut); bw.close();
out.writeObject(c); Logger.print("Config saved.");
out.close(); } catch (FileNotFoundException e) {
fileOut.close(); e.printStackTrace();
Logger.print("Config data is saved in config.dat"); } catch (IOException e) {
}catch(IOException i) e.printStackTrace();
{
i.printStackTrace();
} }
} }
public static Config load() { public static Config load() {
return load("config.dat"); return load("config.json");
} }
public static void save(Config c) { public static void save(Config c) {
save(c, "config.dat"); save(c, "config.json");
} }
public static void save() { public static void save() {
save(ConfigFileInstanceHandler.getConfig(), "config.dat"); save(ConfigFileInstanceHandler.getConfig(), "config.json");
} }
} }
@@ -1,5 +1,6 @@
package com.ixab.ConfigHandling; package com.ixab.ConfigHandling;
import com.ixab.Logging.Logger;
import com.ixab.StreamHandling.StreamInfo; import com.ixab.StreamHandling.StreamInfo;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
@@ -32,6 +33,7 @@ public class StreamConfigItem implements Serializable {
this.category = StreamInfo.getGame(); this.category = StreamInfo.getGame();
} }
public void refreshInfo() { public void refreshInfo() {
Logger.print("Refreshing stream data for " + this.name, this);
this.getInfo(); this.getInfo();
} }
@@ -4,6 +4,31 @@ import java.util.ArrayList;
public class StreamConfigSorter { public class StreamConfigSorter {
public static ArrayList<StreamConfigItem> sortStreamItemArrayList(ArrayList<StreamConfigItem> list) { public static ArrayList<StreamConfigItem> sortStreamItemArrayList(ArrayList<StreamConfigItem> list) {
switch (ConfigFileInstanceHandler.getConfig().getSortStreamsBy()) {
case 1: return sortByStatus(list);
case 2: return sortByViewerCountAsc(list);
case 3: return sortByViewerCountDesc(list);
case 4: return sortByNameAsc(list);
default: return sortByStatus(list);
}
}
private static ArrayList<StreamConfigItem> sortByViewerCountAsc(ArrayList<StreamConfigItem> list) {
// TODO: implement
return null;
}
private static ArrayList<StreamConfigItem> sortByViewerCountDesc(ArrayList<StreamConfigItem> list) {
// TODO: implement
return null;
}
private static ArrayList<StreamConfigItem> sortByNameAsc(ArrayList<StreamConfigItem> list) {
// TODO: implement
return null;
}
private static ArrayList<StreamConfigItem> sortByStatus(ArrayList<StreamConfigItem> list) {
ArrayList<StreamConfigItem> result = new ArrayList<StreamConfigItem>(); ArrayList<StreamConfigItem> result = new ArrayList<StreamConfigItem>();
for (int i = 0; i<list.size(); i++) { for (int i = 0; i<list.size(); i++) {
if (list.get(i).getStatus()) { if (list.get(i).getStatus()) {
+64
View File
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.ixab.GUI.AlertWindow">
<grid id="cbd77" binding="contentPane" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="10" left="10" bottom="10" right="10"/>
<constraints>
<xy x="48" y="54" width="436" height="297"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<grid id="94766" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<hspacer id="98af6">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<grid id="9538f" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="e7465" class="javax.swing.JButton" binding="buttonOK">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="OK"/>
</properties>
</component>
</children>
</grid>
</children>
</grid>
<grid id="e3588" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<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"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="4c1c4" class="javax.swing.JLabel" binding="message">
<constraints>
<grid row="0" 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="Label"/>
</properties>
</component>
</children>
</grid>
</children>
</grid>
</form>
+47
View File
@@ -0,0 +1,47 @@
package com.ixab.GUI;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class AlertWindow extends JDialog {
private JPanel contentPane;
private JButton buttonOK;
private JLabel message;
public AlertWindow(String s) {
message.setText(s);
setContentPane(contentPane);
setModal(true);
getRootPane().setDefaultButton(buttonOK);
buttonOK.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
onOK();
}
});
}
private void onOK() {
// add your code here
dispose();
}
public void close() {
dispose();
}
public static void main(String[] args) {
AlertWindow dialog = new AlertWindow("unused main() in alertwindow");
dialog.pack();
dialog.setVisible(true);
System.exit(0);
}
public static AlertWindow main(String s) {
AlertWindow dialog = new AlertWindow(s);
dialog.pack();
dialog.setVisible(true);
System.exit(0);
return dialog;
}
}
+3
View File
@@ -1,7 +1,10 @@
package com.ixab.GUI; package com.ixab.GUI;
import com.ixab.Logging.Logger;
public class ErrorMessageGate { public class ErrorMessageGate {
public static void setErrorText(String s) { public static void setErrorText(String s) {
Logger.print(s);
MainWindow mw = MainWindowGate.getMainWindow(); MainWindow mw = MainWindowGate.getMainWindow();
mw.getErrorLabel().setText(s); mw.getErrorLabel().setText(s);
} }
+102 -69
View File
@@ -1,56 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.ixab.GUI.MainWindow"> <form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.ixab.GUI.MainWindow">
<grid id="27dc6" binding="panel" layout-manager="GridLayoutManager" row-count="4" column-count="5" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> <grid id="27dc6" binding="panel" 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>
<xy x="20" y="20" width="650" height="500"/> <xy x="20" y="20" width="680" height="500"/>
</constraints> </constraints>
<properties> <properties>
<minimumSize width="650" height="400"/> <minimumSize width="680" height="440"/>
<preferredSize width="650" height="400"/> <preferredSize width="680" height="440"/>
</properties> </properties>
<border type="none"/> <border type="none"/>
<children> <children>
<component id="cb567" class="javax.swing.JComboBox" binding="comboBoxStreams">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
<component id="35b31" class="javax.swing.JComboBox" binding="comboBoxQuality">
<constraints>
<grid row="0" column="4" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
<component id="cb42d" class="javax.swing.JLabel">
<constraints>
<grid row="0" 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="Stream:"/>
</properties>
</component>
<component id="3b81f" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="3" 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="Qualität:"/>
</properties>
</component>
<component id="7c5a1" class="javax.swing.JButton" binding="buttonRemoveStream" default-binding="true">
<constraints>
<grid row="0" 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>
<properties>
<text value="Ausgw. Stream entfernen"/>
</properties>
</component>
<grid id="7567d" layout-manager="GridLayoutManager" row-count="4" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> <grid id="7567d" layout-manager="GridLayoutManager" row-count="4" column-count="2" 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="1" column="0" row-span="1" col-span="5" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/> <grid row="1" column="0" row-span="1" col-span="3" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints> </constraints>
<properties/> <properties/>
<border type="none"/> <border type="none"/>
@@ -71,7 +35,7 @@
<text value="Kategorie:"/> <text value="Kategorie:"/>
</properties> </properties>
</component> </component>
<grid id="31cd7" layout-manager="GridLayoutManager" row-count="3" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> <grid id="31cd7" layout-manager="GridLayoutManager" row-count="5" column-count="4" 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="3" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/> <grid row="3" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
@@ -90,7 +54,7 @@
<grid id="8ebda" binding="panelPreviewImage" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> <grid id="8ebda" binding="panelPreviewImage" layout-manager="GridLayoutManager" row-count="1" column-count="1" 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="1" row-span="3" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"> <grid row="0" column="1" row-span="5" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
<minimum-size width="320" height="180"/> <minimum-size width="320" height="180"/>
<preferred-size width="320" height="180"/> <preferred-size width="320" height="180"/>
<maximum-size width="320" height="180"/> <maximum-size width="320" height="180"/>
@@ -102,24 +66,56 @@
<border type="none"/> <border type="none"/>
<children/> <children/>
</grid> </grid>
<hspacer id="8b583">
<constraints>
<grid row="0" column="2" row-span="2" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<vspacer id="edf84"> <vspacer id="edf84">
<constraints> <constraints>
<grid row="1" column="0" row-span="2" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/> <grid row="4" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints> </constraints>
</vspacer> </vspacer>
<vspacer id="f8cd8">
<constraints>
<grid row="4" column="2" row-span="1" col-span="2" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<component id="a5ab7" class="javax.swing.JButton" binding="vorherigerButton" default-binding="true">
<constraints>
<grid row="0" 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>
<properties>
<text value="&lt; vorheriger"/>
</properties>
</component>
<component id="1cf2f" class="javax.swing.JButton" binding="nächsterButton" default-binding="true">
<constraints>
<grid row="0" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="nächster &gt;"/>
</properties>
</component>
<component id="be49e" class="javax.swing.JButton" binding="buttonPlayStream" default-binding="true">
<constraints>
<grid row="1" column="2" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Stream abspielen"/>
</properties>
</component>
<component id="8b335" class="javax.swing.JButton" binding="buttonReloadStreamData"> <component id="8b335" class="javax.swing.JButton" binding="buttonReloadStreamData">
<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="2" column="2" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints> </constraints>
<properties> <properties>
<text value="Stream Daten neu laden"/> <text value="Stream Daten neu laden"/>
</properties> </properties>
</component> </component>
<component id="48958" class="javax.swing.JButton" binding="buttonReloadAllStreamData">
<constraints>
<grid row="3" column="2" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Alle Stream Daten neu laden"/>
</properties>
</component>
</children> </children>
</grid> </grid>
<component id="7fec7" class="javax.swing.JTextField" binding="textFieldStreamTitle"> <component id="7fec7" class="javax.swing.JTextField" binding="textFieldStreamTitle">
@@ -207,30 +203,14 @@
<grid id="47127" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> <grid id="47127" layout-manager="GridLayoutManager" row-count="2" column-count="2" 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="2" column="2" row-span="1" col-span="3" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/> <grid row="2" column="2" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints> </constraints>
<properties/> <properties/>
<border type="none"/> <border type="none"/>
<children> <children>
<component id="48958" class="javax.swing.JButton" binding="buttonReloadAllStreamData">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Alle Stream Daten neu laden"/>
</properties>
</component>
<component id="be49e" class="javax.swing.JButton" binding="buttonPlayStream" default-binding="true">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Stream abspielen"/>
</properties>
</component>
<component id="95ee2" class="javax.swing.JButton" binding="buttonSettings" default-binding="true"> <component id="95ee2" class="javax.swing.JButton" binding="buttonSettings" default-binding="true">
<constraints> <constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/> <grid row="0" column="0" row-span="2" 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="Einstellungen"/> <text value="Einstellungen"/>
@@ -244,12 +224,20 @@
<text value="Neuen Stream hinzufügen"/> <text value="Neuen Stream hinzufügen"/>
</properties> </properties>
</component> </component>
<component id="7c5a1" class="javax.swing.JButton" binding="buttonRemoveStream" default-binding="true">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Ausgw. Stream entfernen"/>
</properties>
</component>
</children> </children>
</grid> </grid>
<grid id="c88e9" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> <grid id="c88e9" layout-manager="GridLayoutManager" row-count="1" column-count="2" 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="3" column="0" row-span="1" col-span="5" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"> <grid row="3" column="0" row-span="1" col-span="3" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
<minimum-size width="-1" height="32"/> <minimum-size width="-1" height="32"/>
<preferred-size width="-1" height="32"/> <preferred-size width="-1" height="32"/>
<maximum-size width="-1" height="32"/> <maximum-size width="-1" height="32"/>
@@ -275,6 +263,51 @@
</hspacer> </hspacer>
</children> </children>
</grid> </grid>
<grid id="7eaaf" layout-manager="GridLayoutManager" row-count="2" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="0" row-span="1" col-span="3" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="cb42d" class="javax.swing.JLabel">
<constraints>
<grid row="0" 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="Stream:"/>
</properties>
</component>
<component id="cb567" class="javax.swing.JComboBox" binding="comboBoxStreams">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
<component id="3b81f" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="2" 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="Qualität:"/>
</properties>
</component>
<component id="35b31" class="javax.swing.JComboBox" binding="comboBoxQuality">
<constraints>
<grid row="0" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false">
<minimum-size width="70" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<hspacer id="7926d">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
</children>
</grid>
</children> </children>
</grid> </grid>
</form> </form>
+57 -6
View File
@@ -6,8 +6,10 @@ import com.ixab.ConfigHandling.StreamConfigItem;
import com.ixab.ConfigHandling.StreamConfigSorter; import com.ixab.ConfigHandling.StreamConfigSorter;
import com.ixab.Logging.Logger; import com.ixab.Logging.Logger;
import com.ixab.StreamHandling.StreamOpener; import com.ixab.StreamHandling.StreamOpener;
import com.sun.xml.internal.ws.policy.privateutil.PolicyUtils;
import javax.swing.*; import javax.swing.*;
import java.awt.*;
import java.awt.event.*; import java.awt.event.*;
public class MainWindow { public class MainWindow {
@@ -32,6 +34,8 @@ public class MainWindow {
private JLabel errorLabel; private JLabel errorLabel;
private JButton buttonReloadStreamData; private JButton buttonReloadStreamData;
private JButton vorherigerButton;
private JButton nächsterButton;
private boolean lockStreamInfoGetter = false; private boolean lockStreamInfoGetter = false;
public MainWindow() { public MainWindow() {
@@ -60,9 +64,7 @@ public class MainWindow {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
ConfigFileInstanceHandler.getConfig().removeStream(comboBoxStreams.getSelectedItem()); ConfigFileInstanceHandler.getConfig().removeStream(comboBoxStreams.getSelectedItem());
ConfigFileIOHandler.save(ConfigFileInstanceHandler.getConfig()); ConfigFileIOHandler.save(ConfigFileInstanceHandler.getConfig());
lockStreamInfoGetter = true;
refreshStreamsComboBox(); refreshStreamsComboBox();
lockStreamInfoGetter = false;
} }
}); });
comboBoxStreams.addActionListener(new ActionListener() { comboBoxStreams.addActionListener(new ActionListener() {
@@ -71,6 +73,7 @@ public class MainWindow {
if (!lockStreamInfoGetter) { if (!lockStreamInfoGetter) {
updateStreamDetails(); updateStreamDetails();
} }
ConfigFileInstanceHandler.getConfig().setLastSelectedStream(comboBoxStreams.getSelectedIndex());
} }
}); });
buttonReloadAllStreamData.addActionListener(new ActionListener() { buttonReloadAllStreamData.addActionListener(new ActionListener() {
@@ -92,6 +95,32 @@ public class MainWindow {
updateStreamDetails(); updateStreamDetails();
} }
}); });
nächsterButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (comboBoxStreams.getSelectedIndex()!=ConfigFileInstanceHandler.getConfig().getStreams().size()-1) {
comboBoxStreams.setSelectedIndex(comboBoxStreams.getSelectedIndex() + 1);
} else {
comboBoxStreams.setSelectedIndex(0);
}
}
});
vorherigerButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (comboBoxStreams.getSelectedIndex()!=0) {
comboBoxStreams.setSelectedIndex(comboBoxStreams.getSelectedIndex() - 1);
} else {
comboBoxStreams.setSelectedIndex(ConfigFileInstanceHandler.getConfig().getStreams().size()-1);
}
}
});
comboBoxQuality.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
ConfigFileInstanceHandler.getConfig().setLastSelectedQuality(comboBoxQuality.getSelectedIndex());
}
});
} }
private void startUpdaterThread() { private void startUpdaterThread() {
if (updateThread != null) { if (updateThread != null) {
@@ -166,23 +195,44 @@ public class MainWindow {
as.create(); as.create();
} }
private void refreshComboBoxes() { private void refreshComboBoxes() {
lockStreamInfoGetter = true;
refreshQualityComboBox(); refreshQualityComboBox();
refreshStreamsComboBox(); refreshStreamsComboBox();
lockStreamInfoGetter = false;
} }
protected void refreshStreamsComboBox() { protected void refreshStreamsComboBox() {
lockStreamInfoGetter = true;
Object o = comboBoxStreams.getSelectedItem(); Object o = comboBoxStreams.getSelectedItem();
comboBoxStreams.removeAllItems(); comboBoxStreams.removeAllItems();
for (StreamConfigItem stream : for (StreamConfigItem stream :
ConfigFileInstanceHandler.getConfig().getStreams()) { ConfigFileInstanceHandler.getConfig().getStreams()) {
comboBoxStreams.addItem(stream); comboBoxStreams.addItem(stream);
} }
comboBoxStreams.setSelectedItem(o); if (o != null) {
comboBoxStreams.setSelectedItem(o);
} else if (comboBoxStreams.getItemCount()>0) {
if (ConfigFileInstanceHandler.getConfig().getLastSelectedStream() == -1) {
comboBoxStreams.setSelectedIndex(0);
} else {
comboBoxStreams.setSelectedIndex(ConfigFileInstanceHandler.getConfig().getLastSelectedStream());
}
}
if (o == null && comboBoxStreams.getItemCount()>0) {
comboBoxStreams.setSelectedIndex(ConfigFileInstanceHandler.getConfig().getLastSelectedStream());
}
lockStreamInfoGetter = false;
} }
private void refreshQualityComboBox() { private void refreshQualityComboBox() {
Object o = comboBoxQuality.getSelectedItem();
comboBoxQuality.removeAllItems(); comboBoxQuality.removeAllItems();
comboBoxQuality.addItem("best"); comboBoxQuality.addItem("high"); comboBoxQuality.addItem("medium"); comboBoxQuality.addItem("low"); comboBoxQuality.addItem("mobile"); comboBoxQuality.addItem("best"); comboBoxQuality.addItem("high"); comboBoxQuality.addItem("medium"); comboBoxQuality.addItem("low"); comboBoxQuality.addItem("mobile");
if (o != null) {
comboBoxQuality.setSelectedItem(o);
}
if (ConfigFileInstanceHandler.getConfig().getLastSelectedQuality() == -1) {
ConfigFileInstanceHandler.getConfig().setLastSelectedQuality(comboBoxQuality.getSelectedIndex());
} else {
comboBoxQuality.setSelectedIndex(ConfigFileInstanceHandler.getConfig().getLastSelectedQuality());
}
} }
public static void main(String[] args) { public static void main(String[] args) {
JFrame frame = new JFrame("jLSLauncher "+ com.ixab.Main.getVersion()); JFrame frame = new JFrame("jLSLauncher "+ com.ixab.Main.getVersion());
@@ -191,6 +241,7 @@ public class MainWindow {
frame.pack(); frame.pack();
frame.setLocationByPlatform(true); frame.setLocationByPlatform(true);
frame.setVisible(true); frame.setVisible(true);
frame.setResizable(false); frame.setResizable(true);
frame.setMinimumSize(new Dimension(680, 440));
} }
} }
+24 -8
View File
@@ -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"/>
@@ -65,17 +65,17 @@
<text value="Pfad zu Livestreamer:"/> <text value="Pfad zu Livestreamer:"/>
</properties> </properties>
</component> </component>
<component id="42a4f" class="javax.swing.JCheckBox" binding="debugmodusCheckBox" 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=""/> <text value=" (nicht implementiert)"/>
</properties> </properties>
</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>
+4 -1
View File
@@ -11,14 +11,16 @@ public class SettingsWindow extends JDialog {
private JPanel contentPane; private JPanel contentPane;
private JButton buttonOK; private JButton buttonOK;
private JButton buttonCancel; private JButton buttonCancel;
private JCheckBox debugmodusCheckBox; private JCheckBox nichtImplementiertCheckBox;
private JTextField textField1; private JTextField textField1;
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();
} }
+4 -1
View File
@@ -3,12 +3,14 @@ package com.ixab;
import com.ixab.ConfigHandling.Config; import com.ixab.ConfigHandling.Config;
import com.ixab.ConfigHandling.ConfigFileIOHandler; import com.ixab.ConfigHandling.ConfigFileIOHandler;
import com.ixab.ConfigHandling.ConfigFileInstanceHandler; import com.ixab.ConfigHandling.ConfigFileInstanceHandler;
import com.ixab.GUI.AlertWindow;
import com.ixab.GUI.MainWindow; import com.ixab.GUI.MainWindow;
import com.ixab.Logging.Logger;
import javax.swing.*; import javax.swing.*;
public class Main { public class Main {
private final static String version = "0.4 Alpha"; private final static String version = "0.55 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 {
@@ -44,6 +46,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);
} }
+14 -1
View File
@@ -11,15 +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");
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()));