diff --git a/.classpath b/.classpath index 0499fc0..36c3e99 100644 --- a/.classpath +++ b/.classpath @@ -5,5 +5,6 @@ + diff --git a/.gitignore b/.gitignore index 2891925..70e9dff 100644 --- a/.gitignore +++ b/.gitignore @@ -50,3 +50,4 @@ minimal-json-0.9.4.jar config.xml config.xml +commons-lang3-3.4.jar diff --git a/bin/application/MainWindowController$1.class b/bin/application/MainWindowController$1.class index 56bcab9..eaf7445 100644 Binary files a/bin/application/MainWindowController$1.class and b/bin/application/MainWindowController$1.class differ diff --git a/bin/application/MainWindowController$2$1.class b/bin/application/MainWindowController$2$1.class index 0446fd1..7c0de3f 100644 Binary files a/bin/application/MainWindowController$2$1.class and b/bin/application/MainWindowController$2$1.class differ diff --git a/bin/application/MainWindowController$2$2.class b/bin/application/MainWindowController$2$2.class index 72ebfcf..7e5d3de 100644 Binary files a/bin/application/MainWindowController$2$2.class and b/bin/application/MainWindowController$2$2.class differ diff --git a/bin/application/MainWindowController$2$3.class b/bin/application/MainWindowController$2$3.class index c5035cf..d6a63e4 100644 Binary files a/bin/application/MainWindowController$2$3.class and b/bin/application/MainWindowController$2$3.class differ diff --git a/bin/application/MainWindowController$2$4.class b/bin/application/MainWindowController$2$4.class index 8ddb7a5..bbd9c30 100644 Binary files a/bin/application/MainWindowController$2$4.class and b/bin/application/MainWindowController$2$4.class differ diff --git a/bin/application/MainWindowController$2$5.class b/bin/application/MainWindowController$2$5.class index 58c4944..0ea76c1 100644 Binary files a/bin/application/MainWindowController$2$5.class and b/bin/application/MainWindowController$2$5.class differ diff --git a/bin/application/MainWindowController$2$6.class b/bin/application/MainWindowController$2$6.class index 5c31ace..ef115da 100644 Binary files a/bin/application/MainWindowController$2$6.class and b/bin/application/MainWindowController$2$6.class differ diff --git a/bin/application/MainWindowController$2.class b/bin/application/MainWindowController$2.class index b4cbb9e..b81e147 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 31aa30d..0a4ba50 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 2866a08..7482610 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 1b07de0..bda9136 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 67e61fa..14f2d9e 100644 Binary files a/bin/application/MainWindowController$6.class and b/bin/application/MainWindowController$6.class differ diff --git a/bin/application/MainWindowController.class b/bin/application/MainWindowController.class index bbf7c09..651c214 100644 Binary files a/bin/application/MainWindowController.class and b/bin/application/MainWindowController.class differ diff --git a/bin/recources/HomeFlix-Local_de_DE.properties b/bin/recources/HomeFlix-Local_de_DE.properties index b45c53e..6458573 100644 --- a/bin/recources/HomeFlix-Local_de_DE.properties +++ b/bin/recources/HomeFlix-Local_de_DE.properties @@ -13,4 +13,7 @@ columnRating = Bewertung columnDatName = Datei Name errorUpdateV = Beim ausf\u00FChren des Updates ist ein Fehler aufgetreten! \nError: could not check update version (nvc)\nWeitere Hilfe erhalten sie unter www.kellerkinder.xyz \noder wenden sie sich an support@kellerkinder.xyz errorUpdateD = Beim ausf\u00FChren des Updates ist ein Fehler aufgetreten! \nError: could not download update files (ndf)\nWeitere Hilfe erhalten sie unter www.kellerkinder.xyz \noder wenden sie sich an support@kellerkinder.xyz -infoText = \nMaintainer: seilo@kellerkinder.xyz und \nhendrik.schutter@coptersicht.de \n(c) 2016 Kellerkinder www.kellerkinder.xyz \ No newline at end of file +errorPlay = Beim \u00F6ffnen der Datei ist ein Fehler aufgetreten! \nError: could not open file (nof) \nWeitere Hilfe erhalten sie unter www.kellerkinder.xyz \noder wenden sie sich an support@kellerkinder.xyz +linuxBug = Zurzeit werden unter Linux leider keine Dateien mit Leerzeichen unterst\u00FCtzt! +vlcNotInstalled = Um einen Film abspielen wird der VLC Media Player ben\u00F6tigt! +infoText = \nMaintainer: seilo@kellerkinder.xyz und \nhendrik.schutter@coptersicht.de \n(c) 2016 Kellerkinder www.kellerkinder.xyz diff --git a/bin/recources/HomeFlix-Local_en_US.properties b/bin/recources/HomeFlix-Local_en_US.properties index c6eb5ca..857b80b 100644 --- a/bin/recources/HomeFlix-Local_en_US.properties +++ b/bin/recources/HomeFlix-Local_en_US.properties @@ -13,4 +13,7 @@ columnRating = Rating columnDatName = File Name errorUpdateV = An error has occurred during update! \nError: could not check update version (nvc) \nTo get help, visit www.kellerkinder.xyz \nor contcat support@kellerkinder.xyz errorUpdateD = An error has occurred during update! \nError: could not download update files (ndf) \nTo get help, visit www.kellerkinder.xyz \nor contcat support@kellerkinder.xyz -infoText = \nMaintainer: seilo@kellerkinder.xyz and \nhendrik.schutter@coptersicht.de \n(c) 2016 Kellerkinder www.kellerkinder.xyz \ No newline at end of file +errorPlay = An error has occurred during opening the file! \nError: could not open file (nof) \nTo get help, visit www.kellerkinder.xyz \nor contcat support@kellerkinder.xyz +linuxBug = Currently no files are supported with additional space under Linux unfortunately! +vlcNotInstalled = VLC Media Player is required to play a movie! +infoText = \nMaintainer: seilo@kellerkinder.xyz and \nhendrik.schutter@coptersicht.de \n(c) 2016 Kellerkinder www.kellerkinder.xyz diff --git a/src/application/MainWindowController.java b/src/application/MainWindowController.java index 79ad5de..2596fd6 100644 --- a/src/application/MainWindowController.java +++ b/src/application/MainWindowController.java @@ -40,6 +40,8 @@ import java.util.Properties; import java.util.ResourceBundle; import java.util.Scanner; +import org.apache.commons.lang3.SystemUtils; + import com.eclipsesource.json.Json; import com.eclipsesource.json.JsonObject; import com.jfoenix.controls.JFXButton; @@ -109,9 +111,9 @@ public class MainWindowController { @FXML private JFXButton settingsBtn = new JFXButton("Settings"); @FXML - private JFXButton updateBtn = new JFXButton("Auf Update prüfen"); + private JFXButton updateBtn = new JFXButton("Auf Update pr�fen"); @FXML - private JFXButton directoryBtn = new JFXButton("Ordner auswählen"); + private JFXButton directoryBtn = new JFXButton("Ordner ausw�hlen"); @FXML private JFXToggleButton autoupdateBtn = new JFXToggleButton(); @FXML @@ -129,7 +131,7 @@ public class MainWindowController { @FXML private Label versionlbl = new Label(); @FXML - private Label sizelbl = new Label("Schriftgröße:"); + private Label sizelbl = new Label("Schriftgr��e:"); @FXML private Label aulbl = new Label("beim starten nach Updates suchen:"); @FXML @@ -144,16 +146,19 @@ public class MainWindowController { @FXML TreeTableColumn columnDatName = new TreeTableColumn<>("Datei Name"); - private boolean menutrue = false; //merker für menubtn (öffnen oder schließen) + private boolean menutrue = false; //merker f�r menubtn (�ffnen oder schlie�en) private boolean settingstrue = false; - private String version = "0.3.5"; + private String version = "0.3.6"; private String versionURL = "https://raw.githubusercontent.com/Seil0/Project-HomeFlix/master/updates/version.txt"; private String downloadLink = "https://raw.githubusercontent.com/Seil0/Project-HomeFlix/master/updates/downloadLink.txt"; private String updateDataURL; private String errorUpdateD; private String errorUpdateV; + private String errorPlay; private String infoText; + private String linuxBugText; + private String vlcNotInstalled; private String aktVersion; private String path; private String color; @@ -280,7 +285,7 @@ public class MainWindowController { } }); - //demoBtn clicked + //demoBtn clicked debbuging demoBtn.setOnAction(new EventHandler(){ @Override public void handle(ActionEvent event) { @@ -306,18 +311,66 @@ public class MainWindowController { @FXML private void playbtnclicked(){ - try { - Desktop.getDesktop().open(new File(getPath()+"\\"+ datPath)); //öffnt die aktuell ausgewählte Datei - } catch (IOException e) { - // Auto-generated catch block - e.printStackTrace(); + if(SystemUtils.IS_OS_LINUX){ + System.out.println("This is Linux"); + String line; + String output = ""; + Process p; + try { + p = Runtime.getRuntime().exec("which vlc"); + BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream())); + while ((line = input.readLine()) != null) { + output = line; + } + System.out.println(output); + input.close(); + } catch (IOException e1) { + // Auto-generated catch block + e1.printStackTrace(); + } + if(output.contains("which: no vlc")||output == ""){ + Alert alert = new Alert(AlertType.INFORMATION); + alert.setHeaderText(""); + alert.setTitle("Info"); + alert.setContentText(vlcNotInstalled); + alert.showAndWait(); + }else if(datPath.contains(" ")){ + Alert alert = new Alert(AlertType.INFORMATION); + alert.setHeaderText(""); + alert.setTitle("Info"); + alert.setContentText(linuxBugText); + alert.showAndWait(); + }else{ + try { + Runtime.getRuntime().exec("vlc "+getPath()+"/"+ datPath); + } catch (IOException e) { + Alert alert = new Alert(AlertType.ERROR); + alert.setHeaderText(""); + alert.setTitle("Info"); + alert.setContentText(errorPlay); + alert.showAndWait(); + e.printStackTrace(); + } + } + }else if(SystemUtils.IS_OS_WINDOWS || SystemUtils.IS_OS_MAC_OSX){ + System.out.println("This is Windows or Mac OSX"); + try { + Desktop.getDesktop().open(new File(getPath()+"\\"+ datPath)); + } catch (IOException e) { + Alert alert = new Alert(AlertType.ERROR); + alert.setHeaderText(""); + alert.setTitle("Info"); + alert.setContentText(errorPlay); + alert.showAndWait(); + e.printStackTrace(); + } } } @FXML private void openfolderbtnclicked(){ try { - Desktop.getDesktop().open(new File(getPath())); //öffnet den aktuellen Pfad + Desktop.getDesktop().open(new File(getPath())); //�ffnet den aktuellen Pfad } catch (IOException e) { // Auto-generated catch block e.printStackTrace(); @@ -352,7 +405,7 @@ public class MainWindowController { demoBtn.setPrefWidth(130); demoBtn.setPrefHeight(32); demoBtn.setFont(Font.font("System", FontWeight.BOLD, 15)); - demoBtn.setDisable(true); + demoBtn.setDisable(false); menubtn.setText(""); menubtn.setMaxSize(32, 32); @@ -451,7 +504,7 @@ public class MainWindowController { } for(int i = 0; i < filterData.size(); i++){ - root.getChildren().addAll(new TreeItem(filterData.get(i))); //fügt daten zur Rootnode hinzu + root.getChildren().addAll(new TreeItem(filterData.get(i))); //f�gt daten zur Rootnode hinzu } } }); @@ -492,18 +545,18 @@ public class MainWindowController { treeTableViewfilm.getColumns().addAll(columnName, columnRating, columnDatName); - //Changelistener für TreeTable + //Changelistener f�r TreeTable treeTableViewfilm.getSelectionModel().selectedItemProperty().addListener(new ChangeListener() { @Override public void changed(ObservableValue observable, Object oldVal, Object newVal) { - // last = selected; //für autoplay + // last = selected; //f�r autoplay selected = treeTableViewfilm.getSelectionModel().getSelectedIndex(); // holt aktuelles Item last = selected - 1; next = selected + 1; Name = columnName.getCellData(selected); // holt Namen des Aktuelle Items aus der ColumnName datPath = columnDatName.getCellData(selected); // holt den aktuellen Datei Pfad aus der ColumnDatName - ta1.setText(""); // löscht Text in ta1 + ta1.setText(""); // l�scht Text in ta1 apiAbfrage(Name); // startet die api abfrage ta1.positionCaret(0); // setzt die startposition des Cursors in // ta1 @@ -513,7 +566,7 @@ public class MainWindowController { treeTableViewfilm.getColumns().get(2).setVisible(false); //blendet die Column mit den Dateinamen aus (wichtig um sie abzuspielen) } - //prüft auf Update und füht es gegebenenfalls aus + //pr�ft auf Update und f�ht es gegebenenfalls aus private void update(){ System.out.println("check for updates ..."); @@ -532,26 +585,26 @@ public class MainWindowController { } System.out.println("Version: "+version+", Update: "+aktVersion); - //vergleicht die Versionsnummern, bei aktversion > version wird ein Update durchgrführt + //vergleicht die Versionsnummern, bei aktversion > version wird ein Update durchgrf�hrt int iversion = Integer.parseInt(version.replace(".", "")); int iaktVersion = Integer.parseInt(aktVersion.replace(".", "")); if(iversion >= iaktVersion){ - updateBtn.setText("kein Update verfügbar"); - System.out.println("kein Update verfügbar"); + updateBtn.setText("kein Update verf�gbar"); + System.out.println("kein Update verf�gbar"); }else{ - updateBtn.setText("Update verfügbar"); - System.out.println("Update verfügbar"); + updateBtn.setText("Update verf�gbar"); + System.out.println("Update verf�gbar"); try { URL website; URL downloadURL = new URL(downloadLink); BufferedReader in = new BufferedReader(new InputStreamReader(downloadURL.openStream())); updateDataURL = in.readLine(); website = new URL(updateDataURL); //Update URL - ReadableByteChannel rbc = Channels.newChannel(website.openStream()); //öffnet neuen Stream/Channel - FileOutputStream fos = new FileOutputStream("ProjectHomeFlix.jar"); //neuer fileoutputstram für ProjectHomeFLix.jar - fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); //holt datei von 0 bis max größe - fos.close(); //schließt den fos (extrem wichtig!) + ReadableByteChannel rbc = Channels.newChannel(website.openStream()); //�ffnet neuen Stream/Channel + FileOutputStream fos = new FileOutputStream("ProjectHomeFlix.jar"); //neuer fileoutputstram f�r ProjectHomeFLix.jar + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); //holt datei von 0 bis max gr��e + fos.close(); //schlie�t den fos (extrem wichtig!) Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //starte neu System.exit(0); //beendet sich selbst } catch (IOException e) { @@ -567,7 +620,7 @@ public class MainWindowController { } } - //lädt die Daten im angegeben Ordner in newDaten + //l�dt die Daten im angegeben Ordner in newDaten public void loadData(){ if(getPath().equals("")||getPath().equals(null)){ System.out.println("Kein Pfad angegeben"); //falls der Pfad null oder "" ist @@ -579,7 +632,7 @@ public class MainWindowController { newDaten.add(new uiData(5.0, titel ,data)); } for(int i = 0; i < newDaten.size(); i++){ - root.getChildren().add(new TreeItem(newDaten.get(i))); //fügt daten zur Rootnode hinzu + root.getChildren().add(new TreeItem(newDaten.get(i))); //f�gt daten zur Rootnode hinzu } } } @@ -592,7 +645,7 @@ public class MainWindowController { return str.substring(0, pos); } - //setzt die Farben für die UI-Elemente + //setzt die Farben f�r die UI-Elemente public void applyColor(){ String style = "-fx-background-color: #"+getColor()+";"; String btnStyle = "-fx-button-type: RAISED; -fx-background-color: #"+getColor()+"; -fx-text-fill: BLACK;"; @@ -634,11 +687,11 @@ public class MainWindowController { public void setLoaclUI(int local){ switch(local){ - case 0: bundle = ResourceBundle.getBundle("application.HomeFlix-Local", Locale.US); //us_english + case 0: bundle = ResourceBundle.getBundle("recources.HomeFlix-Local", Locale.US); //us_english break; - case 1: bundle = ResourceBundle.getBundle("application.HomeFlix-Local", Locale.GERMAN); //german + case 1: bundle = ResourceBundle.getBundle("recources.HomeFlix-Local", Locale.GERMAN); //german break; - default:bundle = ResourceBundle.getBundle("application.HomeFlix-Local", Locale.US); //default local + default:bundle = ResourceBundle.getBundle("recources.HomeFlix-Local", Locale.US); //default local break; } settingsBtn.setText(bundle.getString("settings")); @@ -656,6 +709,9 @@ public class MainWindowController { errorUpdateD = bundle.getString("errorUpdateD"); errorUpdateV = bundle.getString("errorUpdateV"); infoText = bundle.getString("version")+" "+version+bundle.getString("infoText"); + linuxBugText = bundle.getString("linuxBug"); + errorPlay = bundle.getString("errorPlay"); + vlcNotInstalled = bundle.getString("vlcNotInstalled"); } //speichert die Einstellungen @@ -676,7 +732,7 @@ public class MainWindowController { } } - //lädt die Einstellungen + //l�dt die Einstellungen public void loadSettings(){ File configFile = new File("config.xml"); try { @@ -703,7 +759,7 @@ public class MainWindowController { return color; } - //entfernt 0x von dem rückgabe wert des Colorpickers + //entfernt 0x von dem r�ckgabe wert des Colorpickers private void editColor(String input){ StringBuilder sb = new StringBuilder(input); sb.delete(0, 2); @@ -761,7 +817,7 @@ public class MainWindowController { sc = new Scanner(System.in); moviename = input; - // für keinen oder "" Filmtitel + // f�r keinen oder "" Filmtitel if (moviename == null || moviename.equals("")) { System.out.println("No movie found"); } @@ -769,10 +825,10 @@ public class MainWindowController { //entfernen ungewolter leerzeichen moviename = moviename.trim(); - // ersetzen der Leerzeichen durch + für api-abfrage + // ersetzen der Leerzeichen durch + f�r api-abfrage moviename = moviename.replace(" ", "+"); - //URL wird zusammengestellt abfragetypen: http,json,xml (muss json sein um späteres trennen zu ermöglichen) + //URL wird zusammengestellt abfragetypen: http,json,xml (muss json sein um sp�teres trennen zu erm�glichen) dataurl = apiurl + "t=" + moviename + "&plot=full&r=json"; url = new URL(dataurl); @@ -781,7 +837,7 @@ public class MainWindowController { // lesen der Daten aus dem Antwort Stream while ((retdata = dis.readLine()) != null) { - //retdata in json object parsen und anschließend das json Objekt "zerschneiden" + //retdata in json object parsen und anschlie�end das json Objekt "zerschneiden" System.out.println(retdata); JsonObject object = Json.parse(retdata).asObject(); String titel = object.getString("Title", ""); @@ -816,7 +872,7 @@ public class MainWindowController { ta1.appendText("Titel: "+titel+"\n"); ta1.appendText("Jahr: "+ year+"\n"); ta1.appendText("Einstufung: "+rated+"\n"); - ta1.appendText("Veröffentlicht am: "+released+"\n"); + ta1.appendText("Ver�ffentlicht am: "+released+"\n"); ta1.appendText("Laufzeit: "+runtime+"\n"); ta1.appendText("Genre: "+genre+"\n"); ta1.appendText("Regisseur: "+director+"\n"); @@ -839,7 +895,7 @@ public class MainWindowController { System.out.println(e); } finally { try { - //schließt datainputStream, InputStream,Scanner + //schlie�t datainputStream, InputStream,Scanner if (dis != null) { dis.close(); } diff --git a/src/recources/HomeFlix-Local_de_DE.properties b/src/recources/HomeFlix-Local_de_DE.properties index b45c53e..6458573 100644 --- a/src/recources/HomeFlix-Local_de_DE.properties +++ b/src/recources/HomeFlix-Local_de_DE.properties @@ -13,4 +13,7 @@ columnRating = Bewertung columnDatName = Datei Name errorUpdateV = Beim ausf\u00FChren des Updates ist ein Fehler aufgetreten! \nError: could not check update version (nvc)\nWeitere Hilfe erhalten sie unter www.kellerkinder.xyz \noder wenden sie sich an support@kellerkinder.xyz errorUpdateD = Beim ausf\u00FChren des Updates ist ein Fehler aufgetreten! \nError: could not download update files (ndf)\nWeitere Hilfe erhalten sie unter www.kellerkinder.xyz \noder wenden sie sich an support@kellerkinder.xyz -infoText = \nMaintainer: seilo@kellerkinder.xyz und \nhendrik.schutter@coptersicht.de \n(c) 2016 Kellerkinder www.kellerkinder.xyz \ No newline at end of file +errorPlay = Beim \u00F6ffnen der Datei ist ein Fehler aufgetreten! \nError: could not open file (nof) \nWeitere Hilfe erhalten sie unter www.kellerkinder.xyz \noder wenden sie sich an support@kellerkinder.xyz +linuxBug = Zurzeit werden unter Linux leider keine Dateien mit Leerzeichen unterst\u00FCtzt! +vlcNotInstalled = Um einen Film abspielen wird der VLC Media Player ben\u00F6tigt! +infoText = \nMaintainer: seilo@kellerkinder.xyz und \nhendrik.schutter@coptersicht.de \n(c) 2016 Kellerkinder www.kellerkinder.xyz diff --git a/src/recources/HomeFlix-Local_en_US.properties b/src/recources/HomeFlix-Local_en_US.properties index c6eb5ca..857b80b 100644 --- a/src/recources/HomeFlix-Local_en_US.properties +++ b/src/recources/HomeFlix-Local_en_US.properties @@ -13,4 +13,7 @@ columnRating = Rating columnDatName = File Name errorUpdateV = An error has occurred during update! \nError: could not check update version (nvc) \nTo get help, visit www.kellerkinder.xyz \nor contcat support@kellerkinder.xyz errorUpdateD = An error has occurred during update! \nError: could not download update files (ndf) \nTo get help, visit www.kellerkinder.xyz \nor contcat support@kellerkinder.xyz -infoText = \nMaintainer: seilo@kellerkinder.xyz and \nhendrik.schutter@coptersicht.de \n(c) 2016 Kellerkinder www.kellerkinder.xyz \ No newline at end of file +errorPlay = An error has occurred during opening the file! \nError: could not open file (nof) \nTo get help, visit www.kellerkinder.xyz \nor contcat support@kellerkinder.xyz +linuxBug = Currently no files are supported with additional space under Linux unfortunately! +vlcNotInstalled = VLC Media Player is required to play a movie! +infoText = \nMaintainer: seilo@kellerkinder.xyz and \nhendrik.schutter@coptersicht.de \n(c) 2016 Kellerkinder www.kellerkinder.xyz diff --git a/updates/ProjectHomeFlix.jar b/updates/ProjectHomeFlix.jar index 6c7258c..97d7c9f 100644 Binary files a/updates/ProjectHomeFlix.jar and b/updates/ProjectHomeFlix.jar differ diff --git a/updates/version.txt b/updates/version.txt index 09e9157..53b61ec 100644 --- a/updates/version.txt +++ b/updates/version.txt @@ -1 +1 @@ -0.3.5 \ No newline at end of file +0.3.6 \ No newline at end of file