diff --git a/.classpath b/.classpath index 64f47f8..bf77390 100644 --- a/.classpath +++ b/.classpath @@ -1,7 +1,7 @@ - + diff --git a/README.md b/README.md index 3e84ec3..c12c841 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ 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, so **master contains the latest released version**. Please commit all changes to [dev](https://github.com/Seil0/Project-HomeFlix/tree/dev). +**Due to some changes with the API we use(not provided by us), the query does not work at the moment!** + Librarys used in this Project: JFoenix: https://github.com/jfoenixadmin/JFoenix minimal-json: https://github.com/ralfstx/minimal-json diff --git a/bin/.gitignore b/bin/.gitignore index 8e39425..b42b859 100644 --- a/bin/.gitignore +++ b/bin/.gitignore @@ -1,2 +1 @@ /application/ -/libraries/ diff --git a/bin/application/DBController.class b/bin/application/DBController.class index 9f604cf..fe33f4a 100644 Binary files a/bin/application/DBController.class and b/bin/application/DBController.class differ diff --git a/bin/application/Main.class b/bin/application/Main.class index 9a4b3ac..7ea09ff 100644 Binary files a/bin/application/Main.class and b/bin/application/Main.class differ diff --git a/bin/application/MainWindow.fxml b/bin/application/MainWindow.fxml index 803f728..032c390 100644 --- a/bin/application/MainWindow.fxml +++ b/bin/application/MainWindow.fxml @@ -2,9 +2,11 @@ + + @@ -40,16 +42,20 @@ - + - + + + + + - + @@ -86,16 +92,23 @@ - - - - diff --git a/bin/application/MainWindowController$1.class b/bin/application/MainWindowController$1.class index a04b9ab..83f39ab 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 9a9dbab..0598930 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 d08f4a1..d3984f0 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 1d49150..805fc84 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 f5f5151..cdf339c 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 5ebe321..e7f5c3d 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 6d07829..0fed876 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 6b4196d..9aca2d1 100644 Binary files a/bin/application/MainWindowController.class and b/bin/application/MainWindowController.class differ diff --git a/bin/application/apiQuery.class b/bin/application/apiQuery.class index 3979347..83ad53e 100644 Binary files a/bin/application/apiQuery.class and b/bin/application/apiQuery.class differ diff --git a/bin/application/application.css b/bin/application/application.css deleted file mode 100644 index 83d6f33..0000000 --- a/bin/application/application.css +++ /dev/null @@ -1 +0,0 @@ -/* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */ \ No newline at end of file diff --git a/bin/recources/icons/menu_icon_black.png b/bin/recources/icons/menu_icon_black.png deleted file mode 100644 index 19711de..0000000 Binary files a/bin/recources/icons/menu_icon_black.png and /dev/null differ diff --git a/bin/recources/icons/menu_icon_white.png b/bin/recources/icons/menu_icon_white.png deleted file mode 100644 index 11adfa7..0000000 Binary files a/bin/recources/icons/menu_icon_white.png and /dev/null differ diff --git a/src/recources/HomeFlix-Local_de_DE.properties b/bin/resources/HomeFlix-Local_de_DE.properties similarity index 86% rename from src/recources/HomeFlix-Local_de_DE.properties rename to bin/resources/HomeFlix-Local_de_DE.properties index bfa591e..aa9c214 100644 --- a/src/recources/HomeFlix-Local_de_DE.properties +++ b/bin/resources/HomeFlix-Local_de_DE.properties @@ -1,24 +1,35 @@ -# HomeFlix-Local_de_DE.properties German Local +#HomeFlix-Local_de_DE.properties German Local + +#main window translations info = Info settings = Einstellungen streamingSettings = Stream Einst. -tfPath = Pfad... tfSearch = Suche... openFolder = Ordner \u00F6ffnen + +#settings translations +settingsHead1Label = HomeFlix Einstellungen +tfPath = Pfad... chooseFolder = Ordner ausw\u00E4hlen -fontSize = Schriftgr\u00F6\u00DFe: +mainColorLabel = Hauptfarbe: +fontsizeLabel = Schriftgr\u00F6\u00DFe: +localLabel = Sprache: 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: +autoUpdateLabel = beim Start nach Updates suchen: version = Version: + +#column translations columnName = Name columnRating = Bewertung columnStreamUrl = Datei Name columnResolution = Aufl\u00F6sung columnSeason = Staffel columnYear = Jahr + +#error translations 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 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 @@ -27,9 +38,10 @@ errorOpenStream = Beim \u00F6ffnen des Streams ist ein Fehler aufgetreten! errorLoad = Beim laden der Einstellungen ist ein Fehler aufgetreten! errorSave = Beim speichern der Einstellungen ist ein Fehler aufgetreten! noFilmFound = Kein Film mit diesem Titel gefunden! -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-2017 Kellerkinder www.kellerkinder.xyz + +#textFlow translations title = Titel year = Jahr rating = Einstufung @@ -46,5 +58,6 @@ awards = Auszeichnungen metascore = Metascore imdbRating = IMDB-Bewertung type = Type + firstStartHeader = Es ist kein Stammverzeichnis f\u00FCr Filme angegeben! firstStartContent = Stammverzeichniss angeben? diff --git a/bin/recources/HomeFlix-Local_en_US.properties b/bin/resources/HomeFlix-Local_en_US.properties similarity index 83% rename from bin/recources/HomeFlix-Local_en_US.properties rename to bin/resources/HomeFlix-Local_en_US.properties index e221122..d166f04 100644 --- a/bin/recources/HomeFlix-Local_en_US.properties +++ b/bin/resources/HomeFlix-Local_en_US.properties @@ -1,24 +1,35 @@ -# HomeFlix-Local_en_US.properties US-English Local and default +#HomeFlix-Local_en_US.properties US-English Local and default + +#main window translations info = Info settings = Settings streamingSettings = Stream Settings -tfPath = Path... tfSearch = Search... openFolder = open Folder + +#settings translations +settingsHead1Label = HomeFlix Settings +tfPath = Path... chooseFolder = choose Directory -fontSize = font size: +mainColorLabel = main color: +fontsizeLabel = font size: +localLabel = local: checkUpdates = check for updates checkingUpdates = checking for updates... updateBtnavail = update available updateBtnNotavail = no update available -autoUpdate = check at startup for updates: +autoUpdateLabel = check at startup for updates: version = Version: + +#column translations columnName = Name columnRating = Rating columnStreamUrl = File Name columnResolution = Resolution columnSeason = Season columnYear = Year + +#error translations 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 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 @@ -27,9 +38,10 @@ errorOpenStream = An error has occurred during opening the stream! errorLoad = An error occurred while loading the settings! errorSave = An error occurred while saving the settings! noFilmFound = No film with this title found! -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-2017 Kellerkinder www.kellerkinder.xyz + +#textFlow translations title = Title year = Year rating = Rating @@ -46,5 +58,6 @@ awards = Awards metascore = Metascore imdbRating = IMDB-Rating type = Type + firstStartHeader = There is no root directory for movies! -firstStartContent = Specify a root directory? \ No newline at end of file +firstStartContent = Specify a root directory? diff --git a/bin/recources/Homeflix_Icon_64x64.png b/bin/resources/Homeflix_Icon_64x64.png similarity index 100% rename from bin/recources/Homeflix_Icon_64x64.png rename to bin/resources/Homeflix_Icon_64x64.png diff --git a/bin/recources/Homeflix_Poster.png b/bin/resources/Homeflix_Poster.png similarity index 100% rename from bin/recources/Homeflix_Poster.png rename to bin/resources/Homeflix_Poster.png diff --git a/bin/recources/icons/close_black_2048x2048.png b/bin/resources/icons/close_black_2048x2048.png similarity index 100% rename from bin/recources/icons/close_black_2048x2048.png rename to bin/resources/icons/close_black_2048x2048.png diff --git a/bin/recources/icons/ic_favorite_black_18dp_1x.png b/bin/resources/icons/ic_favorite_black_18dp_1x.png similarity index 100% rename from bin/recources/icons/ic_favorite_black_18dp_1x.png rename to bin/resources/icons/ic_favorite_black_18dp_1x.png diff --git a/bin/recources/icons/ic_favorite_border_black_18dp_1x.png b/bin/resources/icons/ic_favorite_border_black_18dp_1x.png similarity index 100% rename from bin/recources/icons/ic_favorite_border_black_18dp_1x.png rename to bin/resources/icons/ic_favorite_border_black_18dp_1x.png diff --git a/bin/recources/icons/ic_play_arrow_black_18dp_1x.png b/bin/resources/icons/ic_play_arrow_black_18dp_1x.png similarity index 100% rename from bin/recources/icons/ic_play_arrow_black_18dp_1x.png rename to bin/resources/icons/ic_play_arrow_black_18dp_1x.png diff --git a/bin/recources/icons/ic_play_arrow_white_18dp_1x.png b/bin/resources/icons/ic_play_arrow_white_18dp_1x.png similarity index 100% rename from bin/recources/icons/ic_play_arrow_white_18dp_1x.png rename to bin/resources/icons/ic_play_arrow_white_18dp_1x.png diff --git a/bin/recources/icons/ic_search_black_18dp_1x.png b/bin/resources/icons/ic_search_black_18dp_1x.png similarity index 100% rename from bin/recources/icons/ic_search_black_18dp_1x.png rename to bin/resources/icons/ic_search_black_18dp_1x.png diff --git a/bin/recources/icons/ic_skip_next_black_18dp_1x.png b/bin/resources/icons/ic_skip_next_black_18dp_1x.png similarity index 100% rename from bin/recources/icons/ic_skip_next_black_18dp_1x.png rename to bin/resources/icons/ic_skip_next_black_18dp_1x.png diff --git a/bin/recources/icons/ic_skip_next_white_18dp_1x.png b/bin/resources/icons/ic_skip_next_white_18dp_1x.png similarity index 100% rename from bin/recources/icons/ic_skip_next_white_18dp_1x.png rename to bin/resources/icons/ic_skip_next_white_18dp_1x.png diff --git a/bin/recources/icons/ic_skip_previous_black_18dp_1x.png b/bin/resources/icons/ic_skip_previous_black_18dp_1x.png similarity index 100% rename from bin/recources/icons/ic_skip_previous_black_18dp_1x.png rename to bin/resources/icons/ic_skip_previous_black_18dp_1x.png diff --git a/bin/recources/icons/ic_skip_previous_white_18dp_1x.png b/bin/resources/icons/ic_skip_previous_white_18dp_1x.png similarity index 100% rename from bin/recources/icons/ic_skip_previous_white_18dp_1x.png rename to bin/resources/icons/ic_skip_previous_white_18dp_1x.png diff --git a/src/application/DBController.java b/src/application/DBController.java index 9e0be27..3b841a1 100644 --- a/src/application/DBController.java +++ b/src/application/DBController.java @@ -39,8 +39,8 @@ public class DBController { private MainWindowController mainWindowController; private Main main; private String DB_PATH = System.getProperty("user.home") + "\\Documents\\HomeFlix" + "\\" + "Homeflix.db"; //path to database file - private Image favorite_black = new Image("recources/icons/ic_favorite_black_18dp_1x.png"); - private Image favorite_border_black = new Image("recources/icons/ic_favorite_border_black_18dp_1x.png"); + private Image favorite_black = new Image("resources/icons/ic_favorite_black_18dp_1x.png"); + private Image favorite_border_black = new Image("resources/icons/ic_favorite_border_black_18dp_1x.png"); private List filmsdbAll = new ArrayList(); private List filmsdbLocal = new ArrayList(); private List filmsdbStream = new ArrayList(); @@ -115,16 +115,20 @@ public class DBController { ea.printStackTrace(); } + //getting all files from the selected directory TODO rework String[] entries = new File(mainWindowController.getPath()).list(); - if(mainWindowController.getPath().equals("") || mainWindowController.getPath() == null){ + if(mainWindowController.getPath().equals("") || mainWindowController.getPath() == null){ System.out.println("Kein Pfad angegeben"); //if path == null or "" - }else{ + }else if(new File(mainWindowController.getPath()).exists()) { System.out.println(entries.length); for(int i=0;i!=entries.length;i++){ filmsDir.add(cutOffEnd(entries[i])); } + } else { + System.out.println(mainWindowController.getPath() + "dosen't exist!"); } - + + //getting all entries from the streaming lists for(int v=0; v< mainWindowController.streamingData.size(); v++){ String fileName = mainWindowController.getStreamingPath()+"/"+mainWindowController.streamingData.get(v).getStreamUrl(); try { @@ -138,7 +142,9 @@ public class DBController { } catch (IOException e) { e.printStackTrace(); } - } + } + + //add all entries to filmsAll and filmsdbAl, for later comparing filmsAll.addAll(filmsDir); filmsAll.addAll(filmsStream); filmsdbAll.addAll(filmsdbLocal); @@ -146,6 +152,11 @@ public class DBController { System.out.println("films in directory: "+filmsAll.size()); System.out.println("filme in db: "+filmsdbAll.size()); + /** + * if filmsdbAll.size() == 0 database is empty, we need to fill it + * else check if there is something to remove or to add + * TODO separate local and streaming for better error handling + */ if(filmsdbAll.size() == 0){ System.out.println("creating entries ..."); @@ -155,7 +166,7 @@ public class DBController { if(mainWindowController.getPath().equals("") || mainWindowController.getPath() == null){ System.out.println("Kein Pfad angegeben"); //if path == null or "" - }else{ + }else if(new File(mainWindowController.getPath()).exists()){ for(int j=0;j!=entries.length;j++) //goes through all the files in the directory { ps.setInt(1, 0); //rating as integer 1. column @@ -198,12 +209,10 @@ public class DBController { ps.close(); psS.close(); }catch (SQLException ea) { - System.err.println("Konnte nicht ausgeführt werden"); + System.err.println("Ups! an error occured!"); ea.printStackTrace(); } }else { - - try { try { checkAddEntry(); //check if added a new file @@ -271,7 +280,7 @@ public class DBController { try { stmt = connection.createStatement(); - ResultSet rs = stmt.executeQuery("SELECT * FROM film_local WHERE titel = '"+name+"';" ); + ResultSet rs = stmt.executeQuery("SELECT * FROM film_local WHERE titel = \""+name+"\";" ); if(rs.getString(4).equals("favorite_black")){ mainWindowController.localFilms.set(i, new tableData(1, 1, 1, rs.getDouble(1), "1", rs.getString(2), rs.getString(3), new ImageView(favorite_black),rs.getBoolean(5))); }else{ @@ -282,7 +291,7 @@ public class DBController { } catch (SQLException e) { try { stmt = connection.createStatement(); - ResultSet rs = stmt.executeQuery("SELECT * FROM film_streaming WHERE titel = '"+name+"';" ); + ResultSet rs = stmt.executeQuery("SELECT * FROM film_streaming WHERE titel = \""+name+"\";" ); if(rs.getString(8).equals("favorite_black")){ mainWindowController.streamingFilms.set(i,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))); }else{ @@ -305,25 +314,30 @@ public class DBController { Statement stmt = connection.createStatement(); for(int a=0; a nameText = new ArrayList(); ArrayList responseText = new ArrayList(); String fontFamily = main.getFONT_FAMILY(); @@ -598,7 +611,7 @@ public class DBController { try{ mainWindowController.image1.setImage(im); }catch (Exception e){ - mainWindowController.image1.setImage(new Image("recources/icons/close_black_2048x2048.png")); + mainWindowController.image1.setImage(new Image("resources/icons/close_black_2048x2048.png")); e.printStackTrace(); } mainWindowController.image1.setImage(im); @@ -619,4 +632,3 @@ public class DBController { } } - diff --git a/src/application/Main.java b/src/application/Main.java index cff2f19..b40c599 100644 --- a/src/application/Main.java +++ b/src/application/Main.java @@ -27,7 +27,6 @@ import java.io.IOException; import java.util.Locale; import java.util.Optional; import java.util.ResourceBundle; - import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Scene; @@ -43,7 +42,7 @@ public class Main extends Application { Stage primaryStage; private String path; - String currentWorkingDirectory; + String currentWorkingDirectory; private String COLOR = "ee3523"; private String FONT_FAMILY = "System"; private String mode = "local"; //local or streaming TODO @@ -61,12 +60,12 @@ public class Main extends Application { @Override public void start(Stage primaryStage) throws IOException { currentWorkingDirectory = new java.io.File( "." ).getCanonicalPath(); - this.primaryStage = primaryStage; + this.primaryStage = primaryStage; mainWindow(); } private void mainWindow(){ - + try { FXMLLoader loader = new FXMLLoader(Main.class.getResource("MainWindow.fxml")); AnchorPane pane = loader.load(); @@ -74,7 +73,7 @@ public class Main extends Application { primaryStage.setMinWidth(900.00); primaryStage.setResizable(false); primaryStage.setTitle("Project HomeFlix"); - primaryStage.getIcons().add(new Image(Main.class.getResourceAsStream("/recources/Homeflix_Icon_64x64.png"))); //adds application icon + primaryStage.getIcons().add(new Image(Main.class.getResourceAsStream("/resources/Homeflix_Icon_64x64.png"))); //adds application icon mainWindowController = loader.getController(); //Link of FXMLController and controller class mainWindowController.setAutoUpdate(AUTO_UPDATE); //set auto-update @@ -129,7 +128,7 @@ public class Main extends Application { mainWindowController.addDataUI(); Scene scene = new Scene(pane); //create new scene, append pane to scene - + scene.getStylesheets().add(Main.class.getResource("MainWindow.css").toExternalForm()); primaryStage.setScene(scene); //append scene to stage primaryStage.show(); //show stage } catch (IOException e) { @@ -141,11 +140,11 @@ public class Main extends Application { private String firstStart(){ MainWindowController.firststart = true; switch(System.getProperty("user.language")+"_"+System.getProperty("user.country")){ - case "en_US": bundle = ResourceBundle.getBundle("recources.HomeFlix-Local", Locale.US); //us_english + case "en_US": bundle = ResourceBundle.getBundle("resources.HomeFlix-Local", Locale.US); //us_english break; - case "de_DE": bundle = ResourceBundle.getBundle("recources.HomeFlix-Local", Locale.GERMAN); //German + case "de_DE": bundle = ResourceBundle.getBundle("resources.HomeFlix-Local", Locale.GERMAN); //German break; - default: bundle = ResourceBundle.getBundle("recources.HomeFlix-Local", Locale.US); //default local + default: bundle = ResourceBundle.getBundle("resources.HomeFlix-Local", Locale.US); //default local break; } diff --git a/src/application/MainWindow.css b/src/application/MainWindow.css new file mode 100644 index 0000000..cb1165b --- /dev/null +++ b/src/application/MainWindow.css @@ -0,0 +1,4 @@ +.jfx-hamburgerW StackPane { -fx-background-color: white; + -fx-background-radius: 5px; } +.jfx-hamburgerB StackPane { -fx-background-color: black; + -fx-background-radius: 5px; } \ No newline at end of file diff --git a/src/application/MainWindow.fxml b/src/application/MainWindow.fxml index 803f728..032c390 100644 --- a/src/application/MainWindow.fxml +++ b/src/application/MainWindow.fxml @@ -2,9 +2,11 @@ + + @@ -40,16 +42,20 @@ - + - + + + + + - + @@ -86,16 +92,23 @@ - - - - diff --git a/src/application/MainWindowController.java b/src/application/MainWindowController.java index 01dcb88..1b72bb1 100644 --- a/src/application/MainWindowController.java +++ b/src/application/MainWindowController.java @@ -42,9 +42,11 @@ import java.util.Properties; import java.util.ResourceBundle; import com.jfoenix.controls.JFXButton; import com.jfoenix.controls.JFXColorPicker; +import com.jfoenix.controls.JFXHamburger; import com.jfoenix.controls.JFXSlider; import com.jfoenix.controls.JFXTextField; import com.jfoenix.controls.JFXToggleButton; +import com.jfoenix.transitions.hamburger.HamburgerBackArrowBasicTransition; import javafx.animation.FadeTransition; import javafx.animation.ParallelTransition; @@ -72,6 +74,7 @@ import javafx.scene.control.TreeTableColumn.SortType; import javafx.scene.control.TreeTableView; import javafx.scene.image.Image; import javafx.scene.image.ImageView; +import javafx.scene.input.MouseEvent; import javafx.scene.layout.AnchorPane; import javafx.scene.layout.GridPane; import javafx.scene.layout.HBox; @@ -103,8 +106,6 @@ public class MainWindowController { @FXML ScrollPane scrollPane; @FXML - private JFXButton menubtn; //TODO switch to hamburger menu - @FXML private JFXButton playbtn; @FXML private JFXButton openfolderbtn; @@ -129,6 +130,8 @@ public class MainWindowController { @FXML private JFXButton streamingDirectoryBtn; @FXML + private JFXHamburger menuHam; + @FXML private JFXToggleButton autoupdateBtn; @FXML public JFXTextField tfPath; @@ -143,13 +146,20 @@ public class MainWindowController { @FXML public JFXSlider sliderFontSize; @FXML - private Label versionlbl; + private Label versionLabel; @FXML - private Label sizelbl; + private Label fontsizeLabel; @FXML - private Label aulbl; + private Label autoUpdateLabel; + @FXML + private Label settingsHead1Label; + @FXML + private Label mainColorLabel; + @FXML + private Label localLabel; @FXML ImageView image1; + private ImageView imv1; @FXML @@ -176,15 +186,15 @@ public class MainWindowController { @FXML private TableColumn dataNameEndColumn = new TableColumn<>("Datei Name mit Endung"); - private boolean menutrue = false; //saves the position of menuBtn (opened or closed) - private boolean settingstrue = false; + 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.1"; - private String buildNumber = "127"; - private String versionName = "plasma cow"; + private String version = "0.5.2"; + private String buildNumber = "129"; + private String versionName = "solidify cow"; 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"); @@ -199,7 +209,6 @@ public class MainWindowController { private String errorLoad; private String errorSave; private String infoText; - private String linuxBugText; private String vlcNotInstalled; private String currentWorkingDirectory; private String path; @@ -240,14 +249,12 @@ public class MainWindowController { ObservableList localFilms = FXCollections.observableArrayList(); ObservableList streamingFilms = FXCollections.observableArrayList(); ObservableList streamingData = FXCollections.observableArrayList(); - private ImageView menu_icon_black = new ImageView(new Image("recources/icons/menu_icon_black.png")); - private ImageView menu_icon_white = new ImageView(new Image("recources/icons/menu_icon_white.png")); - private ImageView skip_previous_white = new ImageView(new Image("recources/icons/ic_skip_previous_white_18dp_1x.png")); - private ImageView skip_previous_black = new ImageView(new Image("recources/icons/ic_skip_previous_black_18dp_1x.png")); - private ImageView skip_next_white = new ImageView(new Image("recources/icons/ic_skip_next_white_18dp_1x.png")); - private ImageView skip_next_black = new ImageView(new Image("recources/icons/ic_skip_next_black_18dp_1x.png")); - private ImageView play_arrow_white = new ImageView(new Image("recources/icons/ic_play_arrow_white_18dp_1x.png")); - private ImageView play_arrow_black = new ImageView(new Image("recources/icons/ic_play_arrow_black_18dp_1x.png")); + private ImageView skip_previous_white = new ImageView(new Image("resources/icons/ic_skip_previous_white_18dp_1x.png")); + private ImageView skip_previous_black = new ImageView(new Image("resources/icons/ic_skip_previous_black_18dp_1x.png")); + private ImageView skip_next_white = new ImageView(new Image("resources/icons/ic_skip_next_white_18dp_1x.png")); + private ImageView skip_next_black = new ImageView(new Image("resources/icons/ic_skip_next_black_18dp_1x.png")); + private ImageView play_arrow_white = new ImageView(new Image("resources/icons/ic_play_arrow_white_18dp_1x.png")); + private ImageView play_arrow_black = new ImageView(new Image("resources/icons/ic_play_arrow_black_18dp_1x.png")); private DirectoryChooser directoryChooser = new DirectoryChooser(); private MenuItem like = new MenuItem("like"); private MenuItem dislike = new MenuItem("dislike"); //TODO one option (like or dislike) @@ -259,30 +266,6 @@ public class MainWindowController { private apiQuery ApiQuery; DBController dbController; - /** - * TODO change value of Text-color change - */ - @FXML - private void menubtnclicked(){ - if(menutrue == false){ - sideMenuSlideIn(); - menutrue = true; - }else{ - sideMenuSlideOut(); - menutrue = false; - } - if(settingstrue == true){ - settingsAnchor.setVisible(false); - setPath(tfPath.getText()); - saveSettings(); - settingstrue = false; - } - if(streamingSettingsTrue == true){ - streamingSettingsAnchor.setVisible(false); - streamingSettingsTrue = false; - } - } - @FXML private void playbtnclicked(){ System.out.println(System.getProperty("os.name")); @@ -308,16 +291,9 @@ public class MainWindowController { 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.initOwner(main.primaryStage); - alert.showAndWait(); }else{ try { - Runtime.getRuntime().exec("vlc "+getPath()+"/"+ datPath); + Runtime.getRuntime().exec(new String[] { "vlc", getPath()+"/"+ datPath}); } catch (IOException e) { showErrorMsg(errorPlay,e); } @@ -332,7 +308,7 @@ public class MainWindowController { } }else if(mode.equals("streaming")){ try { - Desktop.getDesktop().browse(new URI(datPath)); //open the streaming URL in browser (TODO other option?) + Desktop.getDesktop().browse(new URI(datPath)); //open the streaming URL in browser } catch (URISyntaxException | IOException e) { showErrorMsg(errorOpenStream, (IOException) e); } @@ -375,18 +351,18 @@ public class MainWindowController { @FXML private void settingsBtnclicked(){ - if(settingstrue == false){ + if(settingsTrue == false){ if(streamingSettingsTrue == true){ streamingSettingsAnchor.setVisible(false); streamingSettingsTrue = false; } settingsAnchor.setVisible(true); - settingstrue = true; + settingsTrue = true; }else{ settingsAnchor.setVisible(false); setPath(tfPath.getText()); saveSettings(); - settingstrue = false; + settingsTrue = false; } } @@ -396,9 +372,9 @@ public class MainWindowController { @FXML private void streamingSettingsBtnclicked(){ if(streamingSettingsTrue == false){ - if(settingstrue == true){ + if(settingsTrue == true){ settingsAnchor.setVisible(false); - settingstrue = false; + settingsTrue = false; } streamingSettingsAnchor.setVisible(true); streamingSettingsTrue = true; @@ -423,8 +399,8 @@ public class MainWindowController { settingsAnchor.setVisible(false); streamingSettingsAnchor.setVisible(false); sideMenuSlideOut(); //disables side-menu - menutrue = false; - settingstrue = false; + menuTrue = false; + settingsTrue = false; streamingSettingsTrue = false; } @@ -589,6 +565,32 @@ public class MainWindowController { //Initializing the actions void initActions(){ + HamburgerBackArrowBasicTransition burgerTask = new HamburgerBackArrowBasicTransition(menuHam); + menuHam.addEventHandler(MouseEvent.MOUSE_PRESSED, (e)->{ + if(menuTrue == false){ + sideMenuSlideIn(); + burgerTask.setRate(1.0); + burgerTask.play(); + menuTrue = true; + }else{ + sideMenuSlideOut(); + burgerTask.setRate(-1.0); + burgerTask.play(); + menuTrue = false; + } + if(settingsTrue == true){ + settingsAnchor.setVisible(false); + setPath(tfPath.getText()); + saveSettings(); + settingsTrue = false; + } + if(streamingSettingsTrue == true){ + streamingSettingsAnchor.setVisible(false); + streamingSettingsTrue = false; + } + + }); + tfsearch.textProperty().addListener(new ChangeListener() { @Override public void changed(ObservableValue observable,String oldValue, String newValue) { @@ -858,7 +860,7 @@ public class MainWindowController { playbtn.setGraphic(play_arrow_white); returnBtn.setGraphic(skip_previous_white); forwardBtn.setGraphic(skip_next_white); - menubtn.setGraphic(menu_icon_white); + menuHam.getStyleClass().add("jfx-hamburgerW"); }else{ settingsBtn.setStyle("-fx-text-fill: BLACK;"); streamingSettingsBtn.setStyle("-fx-text-fill: BLACK;"); @@ -875,7 +877,7 @@ public class MainWindowController { playbtn.setGraphic(play_arrow_black); returnBtn.setGraphic(skip_previous_black); forwardBtn.setGraphic(skip_next_black); - menubtn.setGraphic(menu_icon_black); + menuHam.getStyleClass().add("jfx-hamburgerB"); } if(mode.equals("local")){ @@ -920,15 +922,15 @@ public class MainWindowController { void setLocalUI(){ switch(getLocal()){ case "en_US": - bundle = ResourceBundle.getBundle("recources.HomeFlix-Local", Locale.US); //us_English + bundle = ResourceBundle.getBundle("resources.HomeFlix-Local", Locale.US); //us_English cbLocal.getSelectionModel().select(0); break; case "de_DE": - bundle = ResourceBundle.getBundle("recources.HomeFlix-Local", Locale.GERMAN); //German + bundle = ResourceBundle.getBundle("resources.HomeFlix-Local", Locale.GERMAN); //German cbLocal.getSelectionModel().select(1); break; default: - bundle = ResourceBundle.getBundle("recources.HomeFlix-Local", Locale.US); //default local + bundle = ResourceBundle.getBundle("resources.HomeFlix-Local", Locale.US); //default local cbLocal.getSelectionModel().select(0); break; } @@ -942,9 +944,12 @@ public class MainWindowController { updateBtn.setText(bundle.getString("checkUpdates")); directoryBtn.setText(bundle.getString("chooseFolder")); streamingDirectoryBtn.setText(bundle.getString("chooseFolder")); - sizelbl.setText(bundle.getString("fontSize")); - aulbl.setText(bundle.getString("autoUpdate")); - versionlbl.setText(bundle.getString("version")+" "+version+" (Build: "+buildNumber+")"); + settingsHead1Label.setText(bundle.getString("settingsHead1Label")); + mainColorLabel.setText(bundle.getString("mainColorLabel")); + fontsizeLabel.setText(bundle.getString("fontsizeLabel")); + localLabel.setText(bundle.getString("localLabel")); + autoUpdateLabel.setText(bundle.getString("autoUpdateLabel")); + versionLabel.setText(bundle.getString("version")+" "+version+" (Build: "+buildNumber+")"); columnTitel.setText(bundle.getString("columnName")); columnRating.setText(bundle.getString("columnRating")); columnStreamUrl.setText(bundle.getString("columnStreamUrl")); @@ -960,7 +965,6 @@ public class MainWindowController { errorSave = bundle.getString("errorSave"); noFilmFound = bundle.getString("noFilmFound"); infoText = bundle.getString("version")+" "+version+" (Build: "+buildNumber+") "+versionName+bundle.getString("infoText"); - linuxBugText = bundle.getString("linuxBug"); vlcNotInstalled = bundle.getString("vlcNotInstalled"); title = bundle.getString("title"); diff --git a/src/application/apiQuery.java b/src/application/apiQuery.java index 0196a0c..545ca89 100644 --- a/src/application/apiQuery.java +++ b/src/application/apiQuery.java @@ -38,7 +38,8 @@ public class apiQuery{ private Image im; private String[] responseString = new String[20]; private String posterCache; - private String apiURL = "https://www.omdbapi.com/?"; + private String apiURL = "https://www.omdbapi.com/?apikey="; + private String apiKey = "b9f9fd23"; ArrayList responseText = new ArrayList(); ArrayList nameText = new ArrayList(); @@ -75,7 +76,7 @@ public class apiQuery{ moviename = moviename.replace(" ", "+"); //queryURL is apiURL and additional parameters, response-types: http,json,xml (must be json, since the response is processed with minimal-json ) - queryURL = new URL(apiURL + "t=" + moviename + "&plot=full&r=json"); + queryURL = new URL(apiURL + apiKey + "&t=" + moviename + "&plot=full&r=json"); is = queryURL.openStream(); br = new BufferedReader(new InputStreamReader(is, "UTF-8")); @@ -133,12 +134,11 @@ public class apiQuery{ } //if response == false then show mainWindowController.noFilmFound else create new Texts and add them to flowText - if(responseString[19].equals("False")){ + if(retdata.contains("\"Response\":\"False\"")){ //TODO + FIXME mainWindowController.textFlow.getChildren().add(new Text(mainWindowController.noFilmFound)); - im = new Image("recources/icons/close_black_2048x2048.png"); + im = new Image("resources/icons/close_black_2048x2048.png"); mainWindowController.image1.setImage(im); }else{ - // nameText.add(0, new Text(mainWindowController.title+": ")); nameText.add(1, new Text(mainWindowController.year+": ")); nameText.add(2, new Text(mainWindowController.rating+": ")); @@ -156,7 +156,6 @@ public class apiQuery{ nameText.add(14, new Text(mainWindowController.imdbRating+": ")); nameText.add(15, new Text(mainWindowController.type+": ")); - for(int i=0; i