From e84e7f9d20154ceb4a1116e8019874d5b091494c Mon Sep 17 00:00:00 2001 From: Seil0 Date: Wed, 19 Jun 2019 16:31:49 +0200 Subject: [PATCH] removed all table-mode stuff, minor ui tweaks * changed all icons to 48dp * the choisBox in SeriesView is now readable --- .../application/MainWindowController.java | 390 ++---------------- .../application/SeriesDetailView.java | 2 +- .../controller/OMDbAPIController.java | 4 +- .../HomeFlix/player/PlayerController.java | 28 +- src/main/resources/css/MainWindow.css | 8 +- src/main/resources/fxml/MainWindow.fxml | 45 -- src/main/resources/fxml/PlayerWindow.fxml | 34 +- src/main/resources/fxml/SeriesDetailView.fxml | 8 +- .../icons/baseline_fullscreen_black_48dp.png | Bin 0 -> 109 bytes .../baseline_fullscreen_exit_black_48dp.png | Bin 0 -> 111 bytes .../icons/baseline_pause_black_48dp.png | Bin 0 -> 107 bytes .../icons/baseline_stop_black_48dp.png | Bin 0 -> 107 bytes .../icons/ic_favorite_black_18dp_1x.png | Bin 214 -> 0 bytes .../ic_favorite_border_black_18dp_1x.png | Bin 261 -> 0 bytes .../icons/ic_fullscreen_black_24dp_1x.png | Bin 90 -> 0 bytes .../ic_fullscreen_exit_black_24dp_1x.png | Bin 93 -> 0 bytes .../icons/ic_pause_black_24dp_1x.png | Bin 81 -> 0 bytes .../icons/ic_play_arrow_black_18dp_1x.png | Bin 131 -> 0 bytes .../icons/ic_play_arrow_black_24dp_1x.png | Bin 150 -> 0 bytes .../icons/ic_play_arrow_white_18dp_1x.png | Bin 135 -> 0 bytes .../icons/ic_search_black_18dp_1x.png | Bin 215 -> 0 bytes .../icons/ic_skip_next_black_18dp_1x.png | Bin 128 -> 0 bytes .../icons/ic_skip_next_white_18dp_1x.png | Bin 134 -> 0 bytes .../icons/ic_skip_previous_black_18dp_1x.png | Bin 131 -> 0 bytes .../icons/ic_skip_previous_white_18dp_1x.png | Bin 138 -> 0 bytes .../resources/icons/ic_stop_black_24dp_1x.png | Bin 82 -> 0 bytes 26 files changed, 102 insertions(+), 417 deletions(-) create mode 100644 src/main/resources/icons/baseline_fullscreen_black_48dp.png create mode 100644 src/main/resources/icons/baseline_fullscreen_exit_black_48dp.png create mode 100755 src/main/resources/icons/baseline_pause_black_48dp.png create mode 100755 src/main/resources/icons/baseline_stop_black_48dp.png delete mode 100644 src/main/resources/icons/ic_favorite_black_18dp_1x.png delete mode 100644 src/main/resources/icons/ic_favorite_border_black_18dp_1x.png delete mode 100644 src/main/resources/icons/ic_fullscreen_black_24dp_1x.png delete mode 100644 src/main/resources/icons/ic_fullscreen_exit_black_24dp_1x.png delete mode 100644 src/main/resources/icons/ic_pause_black_24dp_1x.png delete mode 100644 src/main/resources/icons/ic_play_arrow_black_18dp_1x.png delete mode 100644 src/main/resources/icons/ic_play_arrow_black_24dp_1x.png delete mode 100644 src/main/resources/icons/ic_play_arrow_white_18dp_1x.png delete mode 100644 src/main/resources/icons/ic_search_black_18dp_1x.png delete mode 100644 src/main/resources/icons/ic_skip_next_black_18dp_1x.png delete mode 100644 src/main/resources/icons/ic_skip_next_white_18dp_1x.png delete mode 100644 src/main/resources/icons/ic_skip_previous_black_18dp_1x.png delete mode 100644 src/main/resources/icons/ic_skip_previous_white_18dp_1x.png delete mode 100644 src/main/resources/icons/ic_stop_black_24dp_1x.png diff --git a/src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java b/src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java index 5c5c88d..beeeb0f 100644 --- a/src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java +++ b/src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java @@ -38,7 +38,6 @@ import java.util.ResourceBundle; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; -import java.util.stream.Collectors; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -51,31 +50,21 @@ 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.TranslateTransition; -import javafx.application.Platform; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.fxml.FXML; -import javafx.scene.Node; import javafx.scene.control.ChoiceBox; -import javafx.scene.control.ContextMenu; import javafx.scene.control.Label; -import javafx.scene.control.MenuItem; import javafx.scene.control.ScrollPane; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.control.TreeItem; -import javafx.scene.control.TreeTableColumn; -import javafx.scene.control.TreeTableColumn.SortType; -import javafx.scene.control.TreeTableView; import javafx.scene.effect.BoxBlur; import javafx.scene.control.ScrollPane.ScrollBarPolicy; -import javafx.scene.image.Image; -import javafx.scene.image.ImageView; import javafx.scene.input.MouseEvent; import javafx.scene.layout.AnchorPane; import javafx.scene.layout.FlowPane; @@ -83,9 +72,6 @@ import javafx.scene.layout.HBox; import javafx.scene.layout.VBox; import javafx.scene.paint.Color; import javafx.scene.text.Font; -import javafx.scene.text.FontWeight; -import javafx.scene.text.Text; -import javafx.scene.text.TextFlow; import javafx.stage.DirectoryChooser; import javafx.stage.FileChooser; import javafx.stage.Stage; @@ -101,21 +87,23 @@ import kellerkinder.HomeFlix.player.Player; public class MainWindowController { - // general/settings fxml elements + // general @FXML private AnchorPane mainAnchorPane; - @FXML private ScrollPane settingsScrollPane; - @FXML private JFXHamburger menuHam; @FXML private HBox topHBox; @FXML private VBox sideMenuVBox; - @FXML private TableView sourcesTable; + + @FXML private JFXHamburger menuHam; @FXML private JFXButton aboutBtn; @FXML private JFXButton settingsBtn; + + // settings + @FXML private ScrollPane settingsScrollPane; + @FXML private JFXButton updateBtn; @FXML private JFXButton addDirectoryBtn; @FXML private JFXButton addStreamSourceBtn; - @FXML private JFXToggleButton autoUpdateToggleBtn; @FXML private JFXToggleButton autoplayToggleBtn; @@ -125,7 +113,7 @@ public class MainWindowController { @FXML private ChoiceBox branchChoisBox = new ChoiceBox<>(); @FXML private JFXSlider fontsizeSlider; - + @FXML private Label homeflixSettingsLbl; @FXML private Label mainColorLbl; @FXML private Label fontsizeLbl; @@ -135,31 +123,10 @@ public class MainWindowController { @FXML private Label sourcesLbl; @FXML private Label versionLbl; + @FXML private TableView sourcesTable; @FXML private TreeItem sourceRoot = new TreeItem<>(new SourceDataType("", "")); @FXML private TableColumn sourceColumn; @FXML private TableColumn modeColumn; - - // table-mode - @FXML private AnchorPane tableModeAnchorPane; - @FXML private JFXTextField searchTextField; - - @FXML private TreeTableView filmsTreeTable; - @FXML private TreeTableColumn columnStreamUrl; - @FXML private TreeTableColumn columnTitle; - @FXML private TreeTableColumn columnFavorite; - @FXML private TreeTableColumn columnSeason; - @FXML private TreeTableColumn columnEpisode; - @FXML private TreeItem filmRoot = new TreeItem<>(new FilmTabelDataType("", "", "", "", false, null)); - - - @FXML private ScrollPane textScrollPane; - @FXML private TextFlow textFlow; - @FXML private ImageView posterImageView; - - @FXML private JFXButton playbtn; - @FXML private JFXButton openfolderbtn; - @FXML private JFXButton returnBtn; - @FXML private JFXButton forwardBtn; // poster-mode @FXML private ScrollPane posterModeScrollPane; @@ -177,27 +144,18 @@ public class MainWindowController { private boolean menuTrue = false; - private final String version = "0.7.0"; - private final String buildNumber = "169"; + private final String version = "0.7.90"; + private final String buildNumber = "171"; private final String versionName = "toothless dragon"; private String btnStyle; - private final int hashA = -647380320; - private int last; - private int indexTable; - private int indexList; - private int next; private FilmTabelDataType currentTableFilm = new FilmTabelDataType("", "", "", "", false, null); private ObservableList languages = FXCollections.observableArrayList("English (en_US)", "Deutsch (de_DE)"); private ObservableList branches = FXCollections.observableArrayList("stable", "beta"); - private ObservableList filterData = FXCollections.observableArrayList(); private ObservableList filmsList = FXCollections.observableArrayList(); private ObservableList posterEmenents = FXCollections.observableArrayList(); private static ObservableList sourcesList = FXCollections.observableArrayList(); - private MenuItem like = new MenuItem("like"); - private MenuItem dislike = new MenuItem("dislike"); - private ContextMenu menu = new ContextMenu(like, dislike); private LocalDate lastValidCache = LocalDate.now().minusDays(30); // current date - 30 days is the last valid cache date public MainWindowController() { @@ -232,12 +190,10 @@ public class MainWindowController { initUI(); initActions(); dbController.init(); - refreshAllFilms(); - // load sources list in gui + // load data list in gui addSourceToTable(); - - posterModeStartup(); // TODO testing DO NOT USE THIS!! + posterModeStartup(); } // Initialize general UI elements @@ -271,22 +227,6 @@ public class MainWindowController { * Tabel-Mode */ private void initTabel() { - - // film Table - filmsTreeTable.setRoot(filmRoot); - filmsTreeTable.setColumnResizePolicy(TreeTableView.CONSTRAINED_RESIZE_POLICY); - filmsTreeTable.setShowRoot(false); - - // write content into cell - columnStreamUrl.setCellValueFactory(cellData -> cellData.getValue().getValue().streamUrlProperty()); - columnTitle.setCellValueFactory(cellData -> cellData.getValue().getValue().titleProperty()); - columnSeason.setCellValueFactory(cellData -> cellData.getValue().getValue().seasonProperty()); - columnEpisode.setCellValueFactory(cellData -> cellData.getValue().getValue().episodeProperty()); - columnFavorite.setCellValueFactory(cellData -> cellData.getValue().getValue().imageProperty()); - - // context menu for treeTableViewfilm - filmsTreeTable.setContextMenu(menu); - // sourcesTreeTable sourceColumn.setCellValueFactory(cellData -> cellData.getValue().pathProperty()); modeColumn.setCellValueFactory(cellData -> cellData.getValue().modeProperty()); @@ -334,111 +274,10 @@ public class MainWindowController { fontsizeSlider.valueProperty().addListener(e -> { XMLController.setFontSize(fontsizeSlider.getValue()); - if (!getCurrentTitle().isEmpty()) { - setSelectedFilmInfo(dbController.readCache(getCurrentStreamUrl())); - } - xmlController.saveSettings(); - }); - - // Table-Mode actions - searchTextField.textProperty().addListener((e, oldValue, newValue) -> { - filmRoot.getChildren().clear(); - filterData.clear(); - filterData = filmsList.stream() - .filter(x -> x.getTitle().toLowerCase().contains(searchTextField.getText().toLowerCase())) - .collect(Collectors.toCollection(FXCollections::observableArrayList)); - - addFilmsToTable(filterData); - - if (searchTextField.getText().hashCode() == hashA) { - XMLController.setColor("000000"); - colorPicker.setValue(new Color(0, 0, 0, 1)); - applyColor(); - } - }); - - like.setOnAction(e -> { - dbController.like(getCurrentStreamUrl()); - filmsList.set(indexList, dbController.getStream(getCurrentStreamUrl())); - refreshTableElement(); - }); - - dislike.setOnAction(e -> { - dbController.dislike(getCurrentStreamUrl()); - filmsList.set(indexList, dbController.getStream(getCurrentStreamUrl())); - refreshTableElement(); - }); - - // FIXME fix bug when sort by ASCENDING, wrong order - columnFavorite.sortTypeProperty().addListener((e, paramT1, paramT2) -> { - filmRoot.getChildren().clear(); - filterData.clear(); - - if (paramT2.equals(SortType.DESCENDING)) { - // add favorites at the top - for (FilmTabelDataType film : filmsList) { - if (film.getFavorite()) { - filterData.add(0, film); - } else { - filterData.add(film); - } - } - } else { - // add favorites at the bottom - for (FilmTabelDataType film : filmsList) { - if (!film.getFavorite()) { - filterData.add(0, film); - } else { - filterData.add(film); - } - } - } - - addFilmsToTable(filterData); - }); - - // Change-listener for treeTableViewfilm - - filmsTreeTable.getSelectionModel().selectedItemProperty().addListener((e, paramT1, paramT2) -> { - if (filmsTreeTable.getSelectionModel().getSelectedItem() == null) { - return; - } - currentTableFilm = filmsTreeTable.getSelectionModel().getSelectedItem().getValue(); // set the current film object - indexTable = filmsTreeTable.getSelectionModel().getSelectedIndex(); // get selected items table index - last = indexTable - 1; - next = indexTable + 1; - - for (FilmTabelDataType film : filmsList) { - if (film.equals(currentTableFilm)) { - indexList = filmsList.indexOf(film); // get selected items list index - } - } - - if ((dbController.getCacheDate(getCurrentStreamUrl()).isAfter(lastValidCache) || getCurrentStreamUrl().contains("_rootNode")) - && dbController.searchCacheByURL(getCurrentStreamUrl())) { - LOGGER.info("loading from cache: " + getCurrentTitle()); - setSelectedFilmInfo(dbController.readCache(getCurrentStreamUrl())); - } else { - // this is not perfect! - new Thread(() -> { - Thread omdbAPIThread = new Thread(new OMDbAPIController(dbController, currentTableFilm, XMLController.getOmdbAPIKey())); - omdbAPIThread.setName("OMDbAPI"); - omdbAPIThread.start(); - - synchronized (omdbAPIThread) { - try { - omdbAPIThread.wait(); - } catch (InterruptedException e1) { - LOGGER.error(e1); - } - // update the GUI for the selected film - Platform.runLater(() -> { - setSelectedFilmInfo(dbController.readCache(getCurrentStreamUrl())); - }); - } - }).start(); - } + // TODO add functionality for postermode + + xmlController.saveSettings(); }); // Poster-Mode actions @@ -510,16 +349,6 @@ public class MainWindowController { } } - @FXML - private void returnBtnclicked() { - filmsTreeTable.getSelectionModel().select(last); - } - - @FXML - private void forwardBtnclicked() { - filmsTreeTable.getSelectionModel().select(next); - } - // general fxml actions @FXML private void aboutBtnAction() { @@ -585,11 +414,6 @@ public class MainWindowController { xmlController.saveSettings(); } - // refresh the selected child of the root node - private void refreshTableElement() { - filmRoot.getChildren().get(indexTable).setValue(filmsList.get(indexList)); - } - /** * refresh all films in filmsList and in filmsTable clear the FilmsList and * FilmRoot children, then update the database @@ -598,65 +422,6 @@ public class MainWindowController { filmsList.clear(); dbController.refreshDataBase(); // refreshes the database after a source path was added filmsList = dbController.getStreamsList(); // returns a list of all films stored in the database - - // refresh filmRoot in filmsTreeTable - filmRoot.getChildren().clear(); - addFilmsToTable(filmsList); - - // - } - - /** - * TODO rework! add data from a ObservableList to the films-table - * - * @param elementsList a list of elements you want to add - */ - public void addFilmsToTable(ObservableList elementsList) { - - for (FilmTabelDataType element : elementsList) { - - // only if the entry contains a season and a episode it's a valid series - if (!element.getSeason().isEmpty() && !element.getEpisode().isEmpty()) { - - // if there is any node check if it's the root node to the episode - // else there is no node at all so we must create a new - if (filmRoot.getChildren().size() > 0) { - for (int i = 0; i < filmRoot.getChildren().size(); i++) { - // if a root node exists, add element - // else create a new root node and add the element (if rootNode is the last - // node) (works since we edit the element!) - if (filmRoot.getChildren().get(i).getValue().getTitle().equals(element.getTitle())) { - TreeItem episodeNode = new TreeItem<>( - new FilmTabelDataType(element.getStreamUrl(), element.getTitle(), - element.getSeason(), element.getEpisode(), element.getFavorite(), - element.getImage())); - filmRoot.getChildren().get(i).getChildren().add(episodeNode); - } else if (filmRoot.getChildren().get(i).nextSibling() == null) { - TreeItem seriesRootNode = new TreeItem<>( - new FilmTabelDataType(element.getTitle() + "_rootNode", element.getTitle(), "", "", - element.getFavorite(), element.getImage())); - filmRoot.getChildren().add(seriesRootNode); - } - } - } else { - // add new root node - TreeItem seriesRootNode = new TreeItem<>( - new FilmTabelDataType(element.getTitle() + "_rootNode", element.getTitle(), "", "", - element.getFavorite(), element.getImage())); - filmRoot.getChildren().add(seriesRootNode); - - // add new element - TreeItem episodeNode = new TreeItem<>(new FilmTabelDataType( - element.getStreamUrl(), element.getTitle(), element.getSeason(), element.getEpisode(), - element.getFavorite(), element.getImage())); - filmRoot.getChildren().get(0).getChildren().add(episodeNode); - } - - } else { - // if season and episode are empty, we can assume the object is a film - filmRoot.getChildren().add(new TreeItem(element)); - } - } } // add a all elements of sourcesList to the sources table on the settings pane @@ -715,20 +480,12 @@ public class MainWindowController { btnStyle = "-fx-button-type: RAISED; -fx-background-color: #" + XMLController.getColor() + "; -fx-text-fill: WHITE;"; menuBtnStyle = "-fx-text-fill: WHITE;"; - playbtn.setGraphic(new ImageView(new Image("icons/ic_play_arrow_white_18dp_1x.png"))); - returnBtn.setGraphic(new ImageView(new Image("icons/ic_skip_previous_white_18dp_1x.png"))); - forwardBtn.setGraphic(new ImageView(new Image("icons/ic_skip_next_white_18dp_1x.png"))); - menuHam.getStyleClass().clear(); menuHam.getStyleClass().add("jfx-hamburgerW"); } else { btnStyle = "-fx-button-type: RAISED; -fx-background-color: #" + XMLController.getColor() + "; -fx-text-fill: BLACK;"; menuBtnStyle = "-fx-text-fill: BLACK;"; - playbtn.setGraphic(new ImageView(new Image("icons/ic_play_arrow_black_18dp_1x.png"))); - returnBtn.setGraphic(new ImageView(new Image("icons/ic_skip_previous_black_18dp_1x.png"))); - forwardBtn.setGraphic(new ImageView(new Image("icons/ic_skip_next_black_18dp_1x.png"))); - menuHam.getStyleClass().clear(); menuHam.getStyleClass().add("jfx-hamburgerB"); } @@ -736,16 +493,11 @@ public class MainWindowController { // boxes and TextFields sideMenuVBox.setStyle("-fx-background-color: #" + XMLController.getColor() + ";"); topHBox.setStyle("-fx-background-color: #" + XMLController.getColor() + ";"); - searchTextField.setFocusColor(Color.valueOf(XMLController.getColor())); // normal buttons addDirectoryBtn.setStyle(btnStyle); addStreamSourceBtn.setStyle(btnStyle); updateBtn.setStyle(btnStyle); - playbtn.setStyle(btnStyle); - openfolderbtn.setStyle(btnStyle); - returnBtn.setStyle(btnStyle); - forwardBtn.setStyle(btnStyle); // menu buttons settingsBtn.setStyle(menuBtnStyle); @@ -793,8 +545,6 @@ public class MainWindowController { aboutBtn.setText(XMLController.getLocalBundle().getString("info")); settingsBtn.setText(XMLController.getLocalBundle().getString("settings")); - searchTextField.setPromptText(XMLController.getLocalBundle().getString("tfSearch")); - openfolderbtn.setText(XMLController.getLocalBundle().getString("openFolder")); updateBtn.setText(XMLController.getLocalBundle().getString("checkUpdates")); addDirectoryBtn.setText(XMLController.getLocalBundle().getString("addDirectory")); addStreamSourceBtn.setText(XMLController.getLocalBundle().getString("addStreamSource")); @@ -805,69 +555,6 @@ public class MainWindowController { autoUpdateToggleBtn.setText(XMLController.getLocalBundle().getString("autoUpdate")); autoplayToggleBtn.setText(XMLController.getLocalBundle().getString("autoplay")); branchLbl.setText(XMLController.getLocalBundle().getString("branchLbl")); - columnStreamUrl.setText(XMLController.getLocalBundle().getString("columnStreamUrl")); - columnTitle.setText(XMLController.getLocalBundle().getString("columnName")); - columnFavorite.setText(XMLController.getLocalBundle().getString("columnFavorite")); - columnSeason.setText(XMLController.getLocalBundle().getString("columnSeason")); - columnEpisode.setText(XMLController.getLocalBundle().getString("columnEpisode")); - } - - private void setSelectedFilmInfo(String[] cacheData) { - Font font = Font.font("System", FontWeight.BOLD, (int) Math.round(XMLController.getFontSize())); - ObservableList textFlow = getTextFlow().getChildren(); - - // TODO this should move! *** - Text[] nameText = new Text[20]; - nameText[0] = new Text(XMLController.getLocalBundle().getString("title") + ": "); - nameText[1] = new Text(XMLController.getLocalBundle().getString("year") + ": "); - nameText[2] = new Text(XMLController.getLocalBundle().getString("rated") + ": "); - nameText[3] = new Text(XMLController.getLocalBundle().getString("released") + ": "); - nameText[4] = new Text(XMLController.getLocalBundle().getString("season") + ": "); - nameText[5] = new Text(XMLController.getLocalBundle().getString("episode") + ": "); - nameText[6] = new Text(XMLController.getLocalBundle().getString("runtime") + ": "); - nameText[7] = new Text(XMLController.getLocalBundle().getString("genre") + ": "); - nameText[8] = new Text(XMLController.getLocalBundle().getString("directors") + ": "); - nameText[9] = new Text(XMLController.getLocalBundle().getString("writers") + ": "); - nameText[10] = new Text(XMLController.getLocalBundle().getString("actors") + ": "); - nameText[11] = new Text(XMLController.getLocalBundle().getString("plot") + ": "); - nameText[12] = new Text(XMLController.getLocalBundle().getString("language") + ": "); - nameText[13] = new Text(XMLController.getLocalBundle().getString("country") + ": "); - nameText[14] = new Text(XMLController.getLocalBundle().getString("awards") + ": "); - nameText[15] = new Text(XMLController.getLocalBundle().getString("metascore") + ": "); - nameText[16] = new Text(XMLController.getLocalBundle().getString("imdbRating") + ": "); - nameText[17] = new Text(XMLController.getLocalBundle().getString("type") + ": "); - nameText[18] = new Text(XMLController.getLocalBundle().getString("boxOffice") + ": "); - nameText[19] = new Text(XMLController.getLocalBundle().getString("website") + ": "); - // *** - - // set the correct font for the nameText - for (Text text : nameText) { - text.setFont(font); - } - - // clear the textFlow and add the new text - textFlow.clear(); - - for (int i = 0; i < 20; i++) { - // if the cacheData exists and they are not empty add the text - if(cacheData[i] != null && cacheData[i].length() > 0) { - textFlow.addAll(nameText[i], new Text(cacheData[i] + "\n")); - } - } - - getTextFlow().setStyle("-fx-font-size : " + ((int) Math.round(XMLController.getFontSize()) + 1) + "px;"); - - // add the image - try { - if (new File(cacheData[20]).isFile()) { - posterImageView.setImage(new Image(new File(cacheData[20]).toURI().toString())); - } else { - posterImageView.setImage(new Image(cacheData[20])); - } - } catch (Exception e) { - posterImageView.setImage(new Image("icons/Homeflix_Poster.png")); - LOGGER.error("No Poster found, useing default."); - } } // if AutoUpdate, then check for updates @@ -905,7 +592,8 @@ public class MainWindowController { private void posterModeStartup() { checkAllPosters(); - addGUIElements(); + addAllPosters(); + checkCache(); } /** @@ -918,7 +606,7 @@ public class MainWindowController { for (FilmTabelDataType entry : dbController.getAllNotCachedEntries()) { System.out.println(entry.getStreamUrl() + " is NOT cached!"); - Runnable OMDbAPIWorker = new OMDbAPIController(dbController, entry, XMLController.getOmdbAPIKey()); + Runnable OMDbAPIWorker = new OMDbAPIController(entry, XMLController.getOmdbAPIKey()); executor.execute(OMDbAPIWorker); } executor.shutdown(); @@ -940,7 +628,7 @@ public class MainWindowController { /** * add all cached films/series to the PosterMode GUI */ - private void addGUIElements() { + private void addAllPosters() { // refresh the posterModeElements list posterEmenents.clear(); posterEmenents = dbController.getPosterElementsList(); // returns a list of all PosterElements stored in the database @@ -949,19 +637,16 @@ public class MainWindowController { for (PosterModeElement element : posterEmenents) { element.getButton().addEventHandler(MouseEvent.MOUSE_CLICKED, (event) -> { enableBlur(); // blur the FlowPane + System.out.println("selected: " + element.getStreamURL()); // if the selected element is a file it's a film, else a series - if (new File(element.getStreamURL()).isFile()) { + if (new File(element.getStreamURL()).isFile() || element.getStreamURL().contains("http")) { filmDetailViewController.setFilm(element.getStreamURL()); filmDetailViewController.showPane(); } else { -// filmDetailViewController.setFilm(element.getStreamURL()); -// filmDetailViewController.showPane(); seriesDetailViewController.setSeries(element.getStreamURL()); seriesDetailViewController.showPane(); } - - System.out.println("selected: " + element.getStreamURL()); }); } @@ -971,6 +656,25 @@ public class MainWindowController { System.out.println("added gui elements"); } + // TODO can this be done in dbController? + /** + * check if the cache is to old, if so update asynchron + */ + private void checkCache() { + ExecutorService executor = Executors.newFixedThreadPool(5); + + // TODO if filmlist is not used anymore, it cann be removed + for(FilmTabelDataType entry : filmsList) { + if (dbController.getCacheDate(entry.getStreamUrl()).isBefore(lastValidCache)) { + System.out.println(entry.getTitle() + " chached on: " + dbController.getCacheDate(entry.getStreamUrl())); + Runnable OMDbAPIWorker = new OMDbAPIController(entry, XMLController.getOmdbAPIKey()); + executor.execute(OMDbAPIWorker); + } + } + + executor.shutdown(); + } + private void enableBlur() { BoxBlur boxBlur = new BoxBlur(); boxBlur.setWidth(9); @@ -997,22 +701,10 @@ public class MainWindowController { return currentTableFilm.getStreamUrl(); } - public int getIndexTable() { - return indexTable; - } - - public int getIndexList() { - return indexList; - } - public static ObservableList getSourcesList() { return sourcesList; } - public TextFlow getTextFlow() { - return textFlow; - } - public JFXButton getUpdateBtn() { return updateBtn; } diff --git a/src/main/java/kellerkinder/HomeFlix/application/SeriesDetailView.java b/src/main/java/kellerkinder/HomeFlix/application/SeriesDetailView.java index 7e0bf5b..dbdf814 100644 --- a/src/main/java/kellerkinder/HomeFlix/application/SeriesDetailView.java +++ b/src/main/java/kellerkinder/HomeFlix/application/SeriesDetailView.java @@ -67,7 +67,7 @@ public class SeriesDetailView { public void initialize() { dbController = DBController.getInstance(); seriesDVPane.setStyle("-fx-background-color: rgba(89,89,89,0.9);"); - scrollPaneEpisodes.setStyle("-fx-background-color: transparent;"); + scrollPaneEpisodes.setStyle("-fx-background-color: transparent;"); scrollPaneEpisodes.setHbarPolicy(ScrollBarPolicy.ALWAYS); cbSeason.getSelectionModel().selectedIndexProperty().addListener((e, oldValue, newValue) -> { diff --git a/src/main/java/kellerkinder/HomeFlix/controller/OMDbAPIController.java b/src/main/java/kellerkinder/HomeFlix/controller/OMDbAPIController.java index a746558..af156ec 100644 --- a/src/main/java/kellerkinder/HomeFlix/controller/OMDbAPIController.java +++ b/src/main/java/kellerkinder/HomeFlix/controller/OMDbAPIController.java @@ -55,10 +55,10 @@ public class OMDbAPIController implements Runnable { * @param currentTableFilm the current film object * @param omdbAPIKey the omdbAPI key */ - public OMDbAPIController(DBController dbController, FilmTabelDataType currentTableFilm, String omdbAPIKey) { - this.dbController = dbController; + public OMDbAPIController(FilmTabelDataType currentTableFilm, String omdbAPIKey) { this.currentTableFilm = currentTableFilm; this.omdbAPIKey = omdbAPIKey; + dbController = DBController.getInstance(); } @Override diff --git a/src/main/java/kellerkinder/HomeFlix/player/PlayerController.java b/src/main/java/kellerkinder/HomeFlix/player/PlayerController.java index 54e1db8..39eed19 100644 --- a/src/main/java/kellerkinder/HomeFlix/player/PlayerController.java +++ b/src/main/java/kellerkinder/HomeFlix/player/PlayerController.java @@ -65,6 +65,10 @@ public class PlayerController { @FXML private JFXButton playBtn; @FXML private JFXButton fullscreenBtn; @FXML private JFXButton nextEpBtn; + + @FXML private ImageView stopIcon; + @FXML private ImageView playIcon; + @FXML private ImageView fullscreenIcon; private Player player; private Media media; @@ -82,11 +86,10 @@ public class PlayerController { private boolean showControls = true; private boolean autoplay; - private ImageView stop_black = new ImageView(new Image("icons/ic_stop_black_24dp_1x.png")); - private ImageView play_arrow_black = new ImageView(new Image("icons/ic_play_arrow_black_24dp_1x.png")); - private ImageView pause_black = new ImageView(new Image("icons/ic_pause_black_24dp_1x.png")); - private ImageView fullscreen_black = new ImageView(new Image("icons/ic_fullscreen_black_24dp_1x.png")); - private ImageView fullscreen_exit_black = new ImageView(new Image("icons/ic_fullscreen_exit_black_24dp_1x.png")); + private Image playArrow = new Image("icons/baseline_play_arrow_black_48dp.png"); + private Image pause = new Image("icons/baseline_pause_black_48dp.png"); + private Image fullscreen = new Image("icons/baseline_fullscreen_black_48dp.png"); + private Image fullscreenExit = new Image("icons/baseline_fullscreen_exit_black_48dp.png"); /** * create a new PlayerWindow object @@ -130,9 +133,8 @@ public class PlayerController { initMediaPlayer(); // set the control elements to the correct value - stopBtn.setGraphic(stop_black); - playBtn.setGraphic(pause_black); - fullscreenBtn.setGraphic(fullscreen_exit_black); + playIcon.setImage(pause); + fullscreenIcon.setImage(fullscreenExit); timeSlider.setValue(0); } @@ -176,7 +178,7 @@ public class PlayerController { // if we are 120ms to the end stop the media mediaPlayer.stop(); DBController.getInstance().setCurrentTime(film.getStreamUrl(), 0); // reset old video start time - playBtn.setGraphic(play_arrow_black); + playIcon.setImage(playArrow); } else { if (nextEpBtn.isVisible()) nextEpBtn.setVisible(false); @@ -262,10 +264,10 @@ public class PlayerController { void fullscreenBtnAction(ActionEvent event) { if (player.getStage().isFullScreen()) { player.getStage().setFullScreen(false); - fullscreenBtn.setGraphic(fullscreen_black); + fullscreenIcon.setImage(fullscreen); } else { player.getStage().setFullScreen(true); - fullscreenBtn.setGraphic(fullscreen_exit_black); + fullscreenIcon.setImage(fullscreenExit); } } @@ -273,10 +275,10 @@ public class PlayerController { void playBtnAction(ActionEvent event) { if (mediaPlayer.getStatus().equals(Status.PLAYING)) { mediaPlayer.pause(); - playBtn.setGraphic(play_arrow_black); + playIcon.setImage(playArrow); } else { mediaPlayer.play(); - playBtn.setGraphic(pause_black); + playIcon.setImage(pause); } } diff --git a/src/main/resources/css/MainWindow.css b/src/main/resources/css/MainWindow.css index 3a799cc..0aff210 100644 --- a/src/main/resources/css/MainWindow.css +++ b/src/main/resources/css/MainWindow.css @@ -129,7 +129,13 @@ -fx-background-insets: 0.0; } -.scroll-bar:vertical > .thumb, .scroll-bar:horizontal > .thumb { +.scroll-bar:vertical > .thumb { + -fx-background-color: #BCBCBC; + -fx-background-insets: 0.0; + -fx-background-radius: 15.0; +} + +.scroll-bar:horizontal > .thumb { -fx-background-color: #FFFFFF; -fx-background-insets: 0.0; -fx-background-radius: 15.0; diff --git a/src/main/resources/fxml/MainWindow.fxml b/src/main/resources/fxml/MainWindow.fxml index e710025..239c5d2 100644 --- a/src/main/resources/fxml/MainWindow.fxml +++ b/src/main/resources/fxml/MainWindow.fxml @@ -4,7 +4,6 @@ - @@ -13,58 +12,14 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/resources/fxml/PlayerWindow.fxml b/src/main/resources/fxml/PlayerWindow.fxml index cfbdd27..40a58b4 100644 --- a/src/main/resources/fxml/PlayerWindow.fxml +++ b/src/main/resources/fxml/PlayerWindow.fxml @@ -3,13 +3,15 @@ + + - + @@ -25,15 +27,39 @@ - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/fxml/SeriesDetailView.fxml b/src/main/resources/fxml/SeriesDetailView.fxml index 555c79f..be1a12b 100644 --- a/src/main/resources/fxml/SeriesDetailView.fxml +++ b/src/main/resources/fxml/SeriesDetailView.fxml @@ -122,12 +122,16 @@ - + - + + + + + diff --git a/src/main/resources/icons/baseline_fullscreen_black_48dp.png b/src/main/resources/icons/baseline_fullscreen_black_48dp.png new file mode 100644 index 0000000000000000000000000000000000000000..917e418a93386a61338d7c2588985ed9805841b8 GIT binary patch literal 109 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA0wn)(8}a}t6Hgb%kP61PS2uD3C0q}_*T{?$jEqLr9g*H)i0){4eU%4|1&-`+It_UpTX1B&t;uc GLK6VvuOPhu literal 0 HcmV?d00001 diff --git a/src/main/resources/icons/baseline_fullscreen_exit_black_48dp.png b/src/main/resources/icons/baseline_fullscreen_exit_black_48dp.png new file mode 100644 index 0000000000000000000000000000000000000000..5fc3166ac68a482f4b8c92622584292a5c3085a2 GIT binary patch literal 111 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA0wn)(8}a}tGfx-CkP61PR~5M!6hvGc-`Bs) z->55*v&s0jOND2QL#yTPx!fE}PTJn}WICX(A9-NFX{L$)8RM24-3FS#;OXk; Jvd$@?2>|5vARzz% literal 0 HcmV?d00001 diff --git a/src/main/resources/icons/baseline_pause_black_48dp.png b/src/main/resources/icons/baseline_pause_black_48dp.png new file mode 100755 index 0000000000000000000000000000000000000000..16d26b3363290ca3732ec6cad758f8f80e505da3 GIT binary patch literal 107 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDH3?y^UWFG-iYymzYu0R?HmZtAK52P4Ng8YIR y9G=}s19F5tT^vIy7?T$WJ@|j%e_}@P6-I_O0rQi$1J3t@^mw}ZxvXpK{{6!)-S*OcGq*Cn!3~ZKRy-bCIy+5 zaM-=xq^i2i^;m=WtsM8H|C8n1CbQq#Xw7>>;_Xci!|!g!M=nTz6)ep=_r!}g`Bjfv zL|1L%B!LNng+IOgTAqYhKA+UVB-&?YDex#DP4{G%kX)B4w@CdbwmV;XQrE92+68nd NgQu&X%Q~loCIBYqRbl`D diff --git a/src/main/resources/icons/ic_favorite_border_black_18dp_1x.png b/src/main/resources/icons/ic_favorite_border_black_18dp_1x.png deleted file mode 100644 index 7edb675069f3b54a74cf4dfa518600d0a7184fb4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 261 zcmV+g0s8)lP)B3901UBO}ED6Ya_3~g01orN+PqKlxUQ)@R1i_JzE>0W+96yi|H!lNn|Tu8)o|1 z&P@NTIFE4rxj7AO=N7?|3vCUvdaU{O?$NVwsVO{p@aD@3z?4t7CQ!03gk3`zSNJdq ztP3*$>b3w(3pL0&EL)gLZ^X05VrPmi4!EHT9{u z?_E*VQ79WQ;!al$Z0IUfBn)c_dya%_WodF}LO50Oi_D2*nSb&FB$qu_tZB1&00000 LNkvXXu0mjf2bgML diff --git a/src/main/resources/icons/ic_fullscreen_black_24dp_1x.png b/src/main/resources/icons/ic_fullscreen_black_24dp_1x.png deleted file mode 100644 index 3553d6a5d6c410575bb658b48e95e6a500f49e2c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 90 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM0wlfaz7_*1MNb#UkP60RiI)%Td6K#U0-41e n)OimJ^3-g&q^R4Q!@v;bW`FSMsV|R!iWxjz{an^LB{Ts5YOxpV diff --git a/src/main/resources/icons/ic_fullscreen_exit_black_24dp_1x.png b/src/main/resources/icons/ic_fullscreen_exit_black_24dp_1x.png deleted file mode 100644 index c8394487c9c3e539520d57b899313ab0779ed6ab..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 93 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM0wlfaz7_*16;Bt(kP60RhQ`1T@*ERyFt2`S q&y&E=&B# wc=B>S&sUzDB`$N=G(DB)Hcp&$#GH%4Jltn(&bImcfEF=$y85}Sb4q9e09LOpNdN!< diff --git a/src/main/resources/icons/ic_play_arrow_white_18dp_1x.png b/src/main/resources/icons/ic_play_arrow_white_18dp_1x.png deleted file mode 100644 index cae85ab67ad6d2bf814dfd750e71d3f2218ee45f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 135 zcmeAS@N?(olHy`uVBq!ia0vp^LLkh+0wn(&ce?|m{5)M8Lp07OCrDU)nBOkp%KyJw zIE;l!`+v7^*q8tRcmF@xBHDQ1-~UxDqJRJY|66~xKI~AJ7N_Pd_Y=Fy|4-(ytYKZK jQ1Rn_x79_bY6gb=Hc78ko_tmYn#|zo>gTe~DWM4f3@S8s diff --git a/src/main/resources/icons/ic_search_black_18dp_1x.png b/src/main/resources/icons/ic_search_black_18dp_1x.png deleted file mode 100644 index f0d4e97577508554557c9073d1607218a48a9215..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 215 zcmeAS@N?(olHy`uVBq!ia0vp^LLkh+0wn(&ce?|m=6Sj}hEy$!Cb2S zz#@wSU0t@Pto$0DvY0ANJfO+Jc_%@IDc0TTlGYW4ge=dxOQv65K9}b?`&LHRx8cR% ztCu6g?)Y}Lt=ngk@Z`Zl(KEKD3~YMen&xf}*ET;G_$_N8$FwfNh9@fAYVY{i6n=)3 zDh2b4Yjdk#-9FRh%B|g+o6h-co%%=f<|?zlxr?K|Z{I4PY&&VA`EOR~T>aDCXT#Nj PE@kj^^>bP0l+XkKwR2O_ diff --git a/src/main/resources/icons/ic_skip_next_black_18dp_1x.png b/src/main/resources/icons/ic_skip_next_black_18dp_1x.png deleted file mode 100644 index 327fd8d8af74d4c8d43a73b5a2d9f5fe5e930101..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 128 zcmeAS@N?(olHy`uVBq!ia0vp^LLkh+0wn(&ce?|m+&x_!Ln;`PC9XJ3Zj@}jf8YVb zvWqPJ#u~~W|1-N9h%&a?8>VN@ zdUhXI-v9mo!`&YJ|9`*1_u~Km^Z%<0hOsbZ|Kk=6`||()<^SuBXcR5HvFrSQVNT0G i5)Ty=)C|}K85lU`W}d0$oPPpnFoUP7pUXO@geCwHelqO< diff --git a/src/main/resources/icons/ic_skip_previous_black_18dp_1x.png b/src/main/resources/icons/ic_skip_previous_black_18dp_1x.png deleted file mode 100644 index 34c528d3cf9e84a0679632a39a8e9236f456e624..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 131 zcmeAS@N?(olHy`uVBq!ia0vp^LLkh+0wn(&ce?|mygXeTLn;`PC9WK3T*%mZ{?LNX zg={OH*bDj3d}tBCvVM_D+j$2$IoCrx*^O)d{}9<}WW##th}NPDRuUd9)^iF31o(W? e5)$~57#KRQX$kL`^k4oXYh3Ob6Mw<&;$VR?=W@% diff --git a/src/main/resources/icons/ic_stop_black_24dp_1x.png b/src/main/resources/icons/ic_stop_black_24dp_1x.png deleted file mode 100644 index 0588f0b4cf92eca1c16aa65c47550dddf8a39099..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 82 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM0wlfaz7_*1NlzEYkP60R1<9VK{}u{-2CEW7 em^%|h7#LjB`wN$O|Lg=RV(@hJb6Mw<&;$UT`4g=G