parent
131c8a491b
commit
0f5d0b859f
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -8,6 +8,7 @@ openFolder = Ordner \u00F6ffnen
|
|||
chooseFolder = Ordner ausw\u00E4hlen
|
||||
fontSize = Schriftgr\u00F6\u00DFe:
|
||||
checkUpdates = Auf Update pr\u00FCfen
|
||||
checkingUpdates = Es wird nach Updates gesucht...
|
||||
updateBtnavail = Update verf\u00FCgbar
|
||||
updateBtnNotavail = Kein Update verf\u00FCgbar
|
||||
autoUpdate = beim Start nach Updates suchen:
|
||||
|
|
|
@ -8,6 +8,7 @@ openFolder = open Folder
|
|||
chooseFolder = choose Directory
|
||||
fontSize = font size:
|
||||
checkUpdates = check for updates
|
||||
checkingUpdates = checking for updates...
|
||||
updateBtnavail = update available
|
||||
updateBtnNotavail = no update available
|
||||
autoUpdate = check at startup for updates:
|
||||
|
|
|
@ -232,7 +232,7 @@ public class DBController {
|
|||
try {
|
||||
//load local Data
|
||||
Statement stmt = connection.createStatement();
|
||||
ResultSet rs = stmt.executeQuery("SELECT * FROM film_local");
|
||||
ResultSet rs = stmt.executeQuery("SELECT * FROM film_local ORDER BY titel");
|
||||
while (rs.next()) {
|
||||
if(rs.getString(4).equals("favorite_black")){
|
||||
mainWindowController.localFilms.add( new tableData(1, 1, 1, rs.getDouble(1), "1", rs.getString(2), rs.getString(3), new ImageView(favorite_black),rs.getBoolean(5)));
|
||||
|
@ -244,7 +244,7 @@ public class DBController {
|
|||
rs.close();
|
||||
|
||||
//load streaming Data TODO check if there are streaming data before loading -> maybe there is an issue now
|
||||
rs = stmt.executeQuery("SELECT * FROM film_streaming;");
|
||||
rs = stmt.executeQuery("SELECT * FROM film_streaming ORDER BY titel;");
|
||||
while (rs.next()) {
|
||||
if(rs.getString(8).equals("favorite_black")){
|
||||
mainWindowController.streamingFilms.add(new tableData(rs.getInt(1), rs.getInt(2), rs.getInt(3), rs.getDouble(4), rs.getString(5), rs.getString(6), rs.getString(7), new ImageView(favorite_black),rs.getBoolean(9)));
|
||||
|
@ -330,7 +330,7 @@ public class DBController {
|
|||
* @throws FileNotFoundException
|
||||
* @throws IOException
|
||||
*/
|
||||
private void checkAddEntry() throws SQLException, FileNotFoundException, IOException{ //TODO sort alphabetical
|
||||
private void checkAddEntry() throws SQLException, FileNotFoundException, IOException{
|
||||
System.out.println("checking for entrys to add to DB ...");
|
||||
String[] entries = new File(mainWindowController.getPath()).list();
|
||||
Statement stmt = connection.createStatement();
|
||||
|
|
|
@ -45,9 +45,9 @@ public class Main extends Application {
|
|||
private String streamingPathWin = System.getProperty("user.home") + "\\Documents\\HomeFlix";
|
||||
private String streamingPathLinux = System.getProperty("user.home") + "/HomeFlix";
|
||||
private String color = "ee3523";
|
||||
private String autoUpdate = "0";
|
||||
private String mode = "local"; //local or streaming
|
||||
private String local = System.getProperty("user.language")+"_"+System.getProperty("user.country");
|
||||
private boolean autoUpdate = false;
|
||||
private double size = 17;
|
||||
private ResourceBundle bundle;
|
||||
private MainWindowController mainWindowController;
|
||||
|
@ -77,7 +77,7 @@ public class Main extends Application {
|
|||
mainWindowController.setAutoUpdate(autoUpdate); //set auto-update
|
||||
mainWindowController.setMain(this); //call setMain
|
||||
|
||||
//Linux if directory exists -> check config.xml
|
||||
//Linux if directory exists -> check config.xml
|
||||
if(System.getProperty("os.name").equals("Linux")){
|
||||
if(dirLinux.exists() != true){
|
||||
dirLinux.mkdir();
|
||||
|
|
|
@ -182,6 +182,7 @@ public class MainWindowController {
|
|||
private boolean menutrue = false; //saves the position of menubtn (opened or closed)
|
||||
private boolean settingstrue = false;
|
||||
private boolean streamingSettingsTrue = false;
|
||||
private boolean autoUpdate = false;
|
||||
static boolean firststart = false;
|
||||
private int hashA = -2055934614;
|
||||
private String version = "0.5.0";
|
||||
|
@ -196,22 +197,20 @@ public class MainWindowController {
|
|||
|
||||
String errorUpdateD;
|
||||
String errorUpdateV;
|
||||
String noFilmFound;
|
||||
private String errorPlay;
|
||||
private String errorOpenStream;
|
||||
private String errorMode;
|
||||
private String errorLoad;
|
||||
private String errorSave;
|
||||
String noFilmFound;
|
||||
private String infoText;
|
||||
private String linuxBugText;
|
||||
private String vlcNotInstalled;
|
||||
private String aktBuildNumber;
|
||||
private String path;
|
||||
private String streamingPath;
|
||||
private String color;
|
||||
private String name;
|
||||
private String datPath;
|
||||
private String autoUpdate;
|
||||
private String mode;
|
||||
@SuppressWarnings("unused")
|
||||
private String ratingSortType;
|
||||
|
@ -472,21 +471,21 @@ public class MainWindowController {
|
|||
|
||||
@FXML
|
||||
private void updateBtnAction(){
|
||||
// Updater.update(buildURL, downloadLink, aktBuildNumber, buildNumber);
|
||||
System.out.println(Updater.getState());
|
||||
if(Updater.getState() == State.NEW){
|
||||
Updater.start();
|
||||
}else{
|
||||
Updater.run();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void autoupdateBtnAction(){
|
||||
if(autoUpdate.equals("0")){
|
||||
setAutoUpdate("1");
|
||||
if(autoUpdate){
|
||||
setAutoUpdate(false);
|
||||
}else{
|
||||
setAutoUpdate("0");
|
||||
setAutoUpdate(true);
|
||||
}
|
||||
saveSettings();
|
||||
}
|
||||
|
@ -519,7 +518,7 @@ public class MainWindowController {
|
|||
//"Main" Method called in Main.java main() when starting
|
||||
void setMain(Main main) {
|
||||
this.main = main;
|
||||
Updater = new updater(this,buildURL, downloadLink, aktBuildNumber, buildNumber);
|
||||
Updater = new updater(this,buildURL, downloadLink, buildNumber);
|
||||
dbController = new DBController(this);
|
||||
ApiQuery = new apiQuery(this, dbController);
|
||||
}
|
||||
|
@ -760,10 +759,14 @@ public class MainWindowController {
|
|||
updateBtn.setFont(Font.font("System", 12));
|
||||
cbLocal.setItems(locals);
|
||||
|
||||
//TODO rework!
|
||||
if(autoUpdate.equals("1")){
|
||||
if(autoUpdate){
|
||||
autoupdateBtn.setSelected(true);
|
||||
Updater.start();
|
||||
try {
|
||||
Updater.start();
|
||||
Updater.join();
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}else{
|
||||
autoupdateBtn.setSelected(false);
|
||||
}
|
||||
|
@ -1022,7 +1025,7 @@ public class MainWindowController {
|
|||
try {
|
||||
props.setProperty("path", getPath()); //writes path into property
|
||||
props.setProperty("color", getColor());
|
||||
props.setProperty("autoUpdate", getAutoUpdate());
|
||||
props.setProperty("autoUpdate", String.valueOf(isAutoUpdate()));
|
||||
props.setProperty("size", getSize().toString());
|
||||
props.setProperty("local", getLocal());
|
||||
props.setProperty("streamingPath", getStreamingPath());
|
||||
|
@ -1058,7 +1061,7 @@ public class MainWindowController {
|
|||
streamingPath = props.getProperty("streamingPath");
|
||||
color = props.getProperty("color");
|
||||
size = Double.parseDouble(props.getProperty("size"));
|
||||
autoUpdate = props.getProperty("autoUpdate");
|
||||
autoUpdate = Boolean.parseBoolean(props.getProperty("autoUpdate"));
|
||||
local = props.getProperty("local");
|
||||
mode = props.getProperty("mode");
|
||||
ratingSortType = props.getProperty("ratingSortType");
|
||||
|
@ -1068,7 +1071,7 @@ public class MainWindowController {
|
|||
showErrorMsg(errorSave, e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
// showErrorMsg(errorLoad, e); //TODO das soll beim ersten start nicht erscheinen
|
||||
// showErrorMsg(errorLoad, e); //TODO This should not be visible at first startup
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1113,11 +1116,11 @@ public class MainWindowController {
|
|||
return size;
|
||||
}
|
||||
|
||||
public void setAutoUpdate(String input){
|
||||
public void setAutoUpdate(boolean input){
|
||||
this.autoUpdate = input;
|
||||
}
|
||||
|
||||
public String getAutoUpdate(){
|
||||
public boolean isAutoUpdate(){
|
||||
return autoUpdate;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,43 +12,51 @@ import java.net.URL;
|
|||
import java.nio.channels.Channels;
|
||||
import java.nio.channels.ReadableByteChannel;
|
||||
|
||||
import javafx.application.Platform;
|
||||
|
||||
public class updater extends Thread{
|
||||
|
||||
private MainWindowController mainWindowController;
|
||||
private String buildURL;
|
||||
private String downloadLink;
|
||||
private String aktBuildNumber;
|
||||
private String updateBuildNumber;
|
||||
private String buildNumber;
|
||||
|
||||
public updater(MainWindowController m, String buildURL,String downloadLink,String aktBuildNumber,String buildNumber){
|
||||
public updater(MainWindowController m, String buildURL,String downloadLink,String buildNumber){
|
||||
mainWindowController=m;
|
||||
this.buildURL=buildURL;
|
||||
this.downloadLink=downloadLink;
|
||||
this.aktBuildNumber=aktBuildNumber;
|
||||
this.buildNumber=buildNumber;
|
||||
}
|
||||
|
||||
public void run(){
|
||||
System.out.println("check for updates ...");
|
||||
Platform.runLater(() -> {
|
||||
mainWindowController.updateBtn.setText(mainWindowController.bundle.getString("checkingUpdates"));
|
||||
});
|
||||
try {
|
||||
URL url = new URL(buildURL); //URL der Datei mit aktueller Versionsnummer
|
||||
URL url = new URL(buildURL); //URL of the text file with the current build number
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
|
||||
aktBuildNumber = in.readLine(); //schreibt inputstream in String
|
||||
updateBuildNumber = in.readLine(); //write InputStream in String
|
||||
in.close();
|
||||
} catch (IOException e1) {
|
||||
mainWindowController.showErrorMsg(mainWindowController.errorUpdateV, e1);
|
||||
}
|
||||
System.out.println("Build: "+buildNumber+", Update: "+aktBuildNumber);
|
||||
System.out.println("Build: "+buildNumber+", Update: "+updateBuildNumber);
|
||||
|
||||
//vergleicht die Versionsnummern, bei aktversion > version wird ein Update durchgrf<EFBFBD>hrt
|
||||
//Compares the program BuildNumber with the current BuildNumber if program BuildNumber < current BuildNumber then perform a update
|
||||
int iversion = Integer.parseInt(buildNumber);
|
||||
int iaktVersion = Integer.parseInt(aktBuildNumber.replace(".", ""));
|
||||
int iaktVersion = Integer.parseInt(updateBuildNumber.replace(".", ""));
|
||||
|
||||
if(iversion >= iaktVersion){
|
||||
// mainWindowController.updateBtn.setText(mainWindowController.bundle.getString("updateBtnNotavail"));
|
||||
Platform.runLater(() -> {
|
||||
mainWindowController.updateBtn.setText(mainWindowController.bundle.getString("updateBtnNotavail"));
|
||||
});
|
||||
System.out.println("no update available");
|
||||
}else{
|
||||
// mainWindowController.updateBtn.setText(mainWindowController.bundle.getString("updateBtnavail"));
|
||||
Platform.runLater(() -> {
|
||||
mainWindowController.updateBtn.setText(mainWindowController.bundle.getString("updateBtnavail"));
|
||||
});
|
||||
System.out.println("update available");
|
||||
try {
|
||||
URL website;
|
||||
|
@ -57,7 +65,7 @@ public class updater extends Thread{
|
|||
String updateDataURL = in.readLine();
|
||||
website = new URL(updateDataURL); //Update URL
|
||||
ReadableByteChannel rbc = Channels.newChannel(website.openStream()); //open new Stream/Channel
|
||||
FileOutputStream fos = new FileOutputStream("ProjectHomeFlix.jar"); //nea fileoutputstram for ProjectHomeFLix.jar
|
||||
FileOutputStream fos = new FileOutputStream("ProjectHomeFlix.jar"); //new FileOutputStream for ProjectHomeFLix.jar
|
||||
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); //gets file from 0 to max size
|
||||
fos.close(); //close fos (extrem wichtig!)
|
||||
Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //start again
|
||||
|
|
|
@ -8,6 +8,7 @@ openFolder = Ordner \u00F6ffnen
|
|||
chooseFolder = Ordner ausw\u00E4hlen
|
||||
fontSize = Schriftgr\u00F6\u00DFe:
|
||||
checkUpdates = Auf Update pr\u00FCfen
|
||||
checkingUpdates = Es wird nach Updates gesucht...
|
||||
updateBtnavail = Update verf\u00FCgbar
|
||||
updateBtnNotavail = Kein Update verf\u00FCgbar
|
||||
autoUpdate = beim Start nach Updates suchen:
|
||||
|
|
|
@ -8,6 +8,7 @@ openFolder = open Folder
|
|||
chooseFolder = choose Directory
|
||||
fontSize = font size:
|
||||
checkUpdates = check for updates
|
||||
checkingUpdates = checking for updates...
|
||||
updateBtnavail = update available
|
||||
updateBtnNotavail = no update available
|
||||
autoUpdate = check at startup for updates:
|
||||
|
|
Loading…
Reference in New Issue