diff --git a/.classpath b/.classpath
index 4174765..64f47f8 100644
--- a/.classpath
+++ b/.classpath
@@ -4,8 +4,8 @@
-
-
+
+
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
index 3a21537..a698e59 100644
--- a/.settings/org.eclipse.jdt.core.prefs
+++ b/.settings/org.eclipse.jdt.core.prefs
@@ -1,5 +1,6 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
diff --git a/README.md b/README.md
index dbfa37a..3e84ec3 100644
--- a/README.md
+++ b/README.md
@@ -2,12 +2,13 @@
Project HomeFlix is a Kellerkinder Project, that alowes you to sort all your local saved movies in clean UI.
-The dev branch is **only merged** into master when a **new release** is released. Please commit all changes to [dev](https://github.com/Seil0/Project-HomeFlix/tree/dev).
+The dev branch is **only merged** into master when a **new release** is released, so **master contains the latest released version**. Please commit all changes to [dev](https://github.com/Seil0/Project-HomeFlix/tree/dev).
Librarys used in this Project:
JFoenix: https://github.com/jfoenixadmin/JFoenix
minimal-json: https://github.com/ralfstx/minimal-json
-sqlite-jdbc: https://github.com/xerial/sqlite-jdbc
+sqlite-jdbc: https://github.com/xerial/sqlite-jdbc
+apache commons io : https://commons.apache.org/proper/commons-io/
## Installation
diff --git a/bin/.gitignore b/bin/.gitignore
index b42b859..8e39425 100644
--- a/bin/.gitignore
+++ b/bin/.gitignore
@@ -1 +1,2 @@
/application/
+/libraries/
diff --git a/bin/application/DBController.class b/bin/application/DBController.class
index 9f604cf..6a474fe 100644
Binary files a/bin/application/DBController.class and b/bin/application/DBController.class differ
diff --git a/bin/application/MainWindowController$1.class b/bin/application/MainWindowController$1.class
index c392df7..a04b9ab 100644
Binary files a/bin/application/MainWindowController$1.class and b/bin/application/MainWindowController$1.class differ
diff --git a/bin/application/MainWindowController$2.class b/bin/application/MainWindowController$2.class
index d6a1ab4..9a9dbab 100644
Binary files a/bin/application/MainWindowController$2.class and b/bin/application/MainWindowController$2.class differ
diff --git a/bin/application/MainWindowController$3.class b/bin/application/MainWindowController$3.class
index fc86b80..d08f4a1 100644
Binary files a/bin/application/MainWindowController$3.class and b/bin/application/MainWindowController$3.class differ
diff --git a/bin/application/MainWindowController$4.class b/bin/application/MainWindowController$4.class
index 66c3735..1d49150 100644
Binary files a/bin/application/MainWindowController$4.class and b/bin/application/MainWindowController$4.class differ
diff --git a/bin/application/MainWindowController$5.class b/bin/application/MainWindowController$5.class
index 64a6d23..f5f5151 100644
Binary files a/bin/application/MainWindowController$5.class and b/bin/application/MainWindowController$5.class differ
diff --git a/bin/application/MainWindowController$6.class b/bin/application/MainWindowController$6.class
index 5f0c70e..5ebe321 100644
Binary files a/bin/application/MainWindowController$6.class and b/bin/application/MainWindowController$6.class differ
diff --git a/bin/application/MainWindowController$7.class b/bin/application/MainWindowController$7.class
index 9f1378c..6d07829 100644
Binary files a/bin/application/MainWindowController$7.class and b/bin/application/MainWindowController$7.class differ
diff --git a/bin/application/MainWindowController.class b/bin/application/MainWindowController.class
index bd3b673..6b4196d 100644
Binary files a/bin/application/MainWindowController.class and b/bin/application/MainWindowController.class differ
diff --git a/bin/application/updater.class b/bin/application/updater.class
index 2185f2c..f7249c3 100644
Binary files a/bin/application/updater.class and b/bin/application/updater.class differ
diff --git a/bin/libraries/jfoenix-1.3.0.jar b/bin/libraries/jfoenix-1.4.0.jar
similarity index 91%
rename from bin/libraries/jfoenix-1.3.0.jar
rename to bin/libraries/jfoenix-1.4.0.jar
index 37e7860..789ef3b 100644
Binary files a/bin/libraries/jfoenix-1.3.0.jar and b/bin/libraries/jfoenix-1.4.0.jar differ
diff --git a/bin/libraries/sqlite-jdbc-3.16.1.jar b/bin/libraries/sqlite-jdbc-3.16.1.jar
deleted file mode 100644
index 9d4b5bb..0000000
Binary files a/bin/libraries/sqlite-jdbc-3.16.1.jar and /dev/null differ
diff --git a/bin/libraries/sqlite-jdbc-3.18.0.jar b/bin/libraries/sqlite-jdbc-3.18.0.jar
new file mode 100644
index 0000000..8e9dce1
Binary files /dev/null and b/bin/libraries/sqlite-jdbc-3.18.0.jar differ
diff --git a/src/application/MainWindowController.java b/src/application/MainWindowController.java
index 14131af..01dcb88 100644
--- a/src/application/MainWindowController.java
+++ b/src/application/MainWindowController.java
@@ -32,7 +32,6 @@ import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
-import java.lang.Thread.State;
import java.math.BigInteger;
import java.net.URI;
import java.net.URISyntaxException;
@@ -184,10 +183,8 @@ public class MainWindowController {
static boolean firststart = false;
private int hashA = -2055934614;
private String version = "0.5.1";
- private String buildNumber = "125";
+ private String buildNumber = "127";
private String versionName = "plasma cow";
- private String buildURL = "https://raw.githubusercontent.com/Seil0/Project-HomeFlix/master/updates/buildNumber.txt";
- private String downloadLink = "https://raw.githubusercontent.com/Seil0/Project-HomeFlix/master/updates/downloadLink.txt";
private File dirWin = new File(System.getProperty("user.home") + "/Documents/HomeFlix");
private File dirLinux = new File(System.getProperty("user.home") + "/HomeFlix");
private File fileWin = new File(dirWin + "/config.xml");
@@ -470,13 +467,9 @@ public class MainWindowController {
@FXML
private void updateBtnAction(){
- System.out.println(Updater.getState());
- if(Updater.getState() == State.NEW){
- Updater.start();
- }else{
- Updater.run();
- }
-
+ Thread updateThread = new Thread(Updater);
+ updateThread.setName("Updater");
+ updateThread.start();
}
@FXML
@@ -519,7 +512,7 @@ public class MainWindowController {
*/
void setMain(Main main) {
this.main = main;
- Updater = new updater(this,buildURL, downloadLink, buildNumber);
+ Updater = new updater(this, buildNumber);
dbController = new DBController(this, this.main);
ApiQuery = new apiQuery(this, dbController, this.main);
}
@@ -763,8 +756,10 @@ public class MainWindowController {
if(autoUpdate){
autoupdateBtn.setSelected(true);
try {
- Updater.start();
- Updater.join();
+ Thread updateThread = new Thread(Updater);
+ updateThread.setName("Updater");
+ updateThread.start();
+ updateThread.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
diff --git a/src/application/updater.java b/src/application/updater.java
index bab88d9..33d7763 100644
--- a/src/application/updater.java
+++ b/src/application/updater.java
@@ -15,20 +15,25 @@ import javax.swing.ProgressMonitorInputStream;
import org.apache.commons.io.FileUtils;
+import com.eclipsesource.json.Json;
+import com.eclipsesource.json.JsonArray;
+import com.eclipsesource.json.JsonObject;
+import com.eclipsesource.json.JsonValue;
+
import javafx.application.Platform;
-public class updater extends Thread{
+public class updater implements Runnable{
private MainWindowController mainWindowController;
- private String buildURL;
- private String downloadLink;
- private String updateBuildNumber;
private String buildNumber;
+ private String apiOutput;
+ private String updateBuildNumber; //tag_name from Github
+ private String browserDownloadUrl; //update download link
+ private String githubApi = "https://api.github.com/repos/Seil0/Project-HomeFlix/releases/latest";
- public updater(MainWindowController m, String buildURL,String downloadLink,String buildNumber){
+
+ public updater(MainWindowController m, String buildNumber){
mainWindowController=m;
- this.buildURL=buildURL;
- this.downloadLink=downloadLink;
this.buildNumber=buildNumber;
}
@@ -37,14 +42,27 @@ public class updater extends Thread{
Platform.runLater(() -> {
mainWindowController.updateBtn.setText(mainWindowController.bundle.getString("checkingUpdates"));
});
- try {
- URL url = new URL(buildURL); //URL of the text file with the current build number
- BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
- updateBuildNumber = in.readLine(); //write InputStream in String
- in.close();
+
+ try {
+ URL githubApiUrl = new URL(githubApi);
+ BufferedReader ina = new BufferedReader(new InputStreamReader(githubApiUrl.openStream()));
+ apiOutput = ina.readLine();
+ ina.close();
} catch (IOException e1) {
mainWindowController.showErrorMsg(mainWindowController.errorUpdateV, e1);
+ e1.printStackTrace();
}
+
+ JsonObject object = Json.parse(apiOutput).asObject();
+ JsonArray objectAssets = Json.parse(apiOutput).asObject().get("assets").asArray();
+
+ updateBuildNumber = object.getString("tag_name", "");
+// updateName = object.getString("name", "");
+// updateChanges = object.getString("body", "");
+ for (JsonValue asset : objectAssets) {
+ browserDownloadUrl = asset.asObject().getString("browser_download_url", "");
+
+ }
System.out.println("Build: "+buildNumber+", Update: "+updateBuildNumber);
//Compares the program BuildNumber with the current BuildNumber if program BuildNumber < current BuildNumber then perform a update
@@ -61,9 +79,10 @@ public class updater extends Thread{
mainWindowController.updateBtn.setText(mainWindowController.bundle.getString("updateBtnavail"));
});
System.out.println("update available");
+ System.out.println("download link: " + browserDownloadUrl);
try {
//get the download-Data URL
- URL downloadURL = new URL(downloadLink);
+ URL downloadURL = new URL(browserDownloadUrl);
BufferedReader in = new BufferedReader(new InputStreamReader(downloadURL.openStream()));
String updateDataURL = in.readLine();
@@ -80,8 +99,9 @@ public class updater extends Thread{
Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //start again
System.exit(0); //finishes itself
} catch (IOException e) {
- //in case there is an error
- mainWindowController.showErrorMsg(mainWindowController.errorUpdateD, e);
+ Platform.runLater(() -> {
+ mainWindowController.showErrorMsg(mainWindowController.errorUpdateD, e);
+ });
}
}
}
diff --git a/src/libraries/jfoenix-1.3.0.jar b/src/libraries/jfoenix-1.4.0.jar
similarity index 91%
rename from src/libraries/jfoenix-1.3.0.jar
rename to src/libraries/jfoenix-1.4.0.jar
index 37e7860..789ef3b 100644
Binary files a/src/libraries/jfoenix-1.3.0.jar and b/src/libraries/jfoenix-1.4.0.jar differ
diff --git a/src/libraries/sqlite-jdbc-3.16.1.jar b/src/libraries/sqlite-jdbc-3.16.1.jar
deleted file mode 100644
index 9d4b5bb..0000000
Binary files a/src/libraries/sqlite-jdbc-3.16.1.jar and /dev/null differ
diff --git a/src/libraries/sqlite-jdbc-3.18.0.jar b/src/libraries/sqlite-jdbc-3.18.0.jar
new file mode 100644
index 0000000..8e9dce1
Binary files /dev/null and b/src/libraries/sqlite-jdbc-3.18.0.jar differ