diff --git a/src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java b/src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java index efa48af..3c87741 100644 --- a/src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java +++ b/src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java @@ -137,17 +137,16 @@ public class MainWindowController { @FXML private TableColumn sourceColumn; @FXML private TableColumn modeColumn; - @FXML private TreeTableColumn columnStreamUrl; - @FXML private TreeTableColumn columnTitle; - @FXML private TreeTableColumn columnFavorite; - @FXML private TreeTableColumn columnSeason; - @FXML private TreeTableColumn columnEpisode; - // 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, null)); @@ -161,7 +160,8 @@ public class MainWindowController { @FXML private JFXButton forwardBtn; // poster-mode -// @FXML private AnchorPane posterModeAnchorPane; + @FXML private AnchorPane posterModeAnchorPane; + @FXML private ScrollPane posterModeScrollPane; private DBController dbController; private UpdateController updateController; @@ -220,7 +220,7 @@ public class MainWindowController { // load sources list in gui addSourceToTable(); -// posterModeStartup(); // TODO testing DO NOT USE THIS!! +// posterModeStartup(); // TODO testing DO NOT USE THIS!! } // Initialize general UI elements @@ -464,51 +464,53 @@ public class MainWindowController { // Table-Mode fxml actions @FXML private void playbtnclicked() { - if (currentTableFilm.getStreamUrl().contains("_rootNode")) { - LOGGER.info("rootNode found, getting last watched episode"); - currentTableFilm = dbController.getLastWatchedEpisode(currentTableFilm.getTitle()); - } - - if (isSupportedFormat(currentTableFilm)) { - new Player(getCurrentTableFilm()); - } else { - LOGGER.error("using fallback player!"); - if (System.getProperty("os.name").contains("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; - } - LOGGER.info("which vlc: " + output); - input.close(); - } catch (IOException e1) { - e1.printStackTrace(); - } - if (output.contains("which: no vlc") || output == "") { - JFXInfoAlert vlcInfoAlert = new JFXInfoAlert("Info", - XMLController.getLocalBundle().getString("vlcNotInstalled"), - btnStyle, primaryStage); - vlcInfoAlert.showAndWait(); - } else { + if (currentTableFilm.getStreamUrl().length() > 0) { + if (currentTableFilm.getStreamUrl().contains("_rootNode")) { + LOGGER.info("rootNode found, getting last watched episode"); + currentTableFilm = dbController.getLastWatchedEpisode(currentTableFilm.getTitle()); + } + + if (isSupportedFormat(currentTableFilm)) { + new Player(getCurrentTableFilm()); + } else { + LOGGER.error("using fallback player!"); + if (System.getProperty("os.name").contains("Linux")) { + String line; + String output = ""; + Process p; try { - new ProcessBuilder("vlc", getCurrentStreamUrl()).start(); + p = Runtime.getRuntime().exec("which vlc"); + BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream())); + while ((line = input.readLine()) != null) { + output = line; + } + LOGGER.info("which vlc: " + output); + input.close(); + } catch (IOException e1) { + e1.printStackTrace(); + } + if (output.contains("which: no vlc") || output == "") { + JFXInfoAlert vlcInfoAlert = new JFXInfoAlert("Info", + XMLController.getLocalBundle().getString("vlcNotInstalled"), + btnStyle, primaryStage); + vlcInfoAlert.showAndWait(); + } else { + try { + new ProcessBuilder("vlc", getCurrentStreamUrl()).start(); + } catch (IOException e) { + LOGGER.warn("An error has occurred while opening the file!", e); + } + } + + } else if (System.getProperty("os.name").contains("Windows") || System.getProperty("os.name").contains("Mac OS X")) { + try { + Desktop.getDesktop().open(new File(getCurrentStreamUrl())); } catch (IOException e) { LOGGER.warn("An error has occurred while opening the file!", e); } + } else { + LOGGER.error(System.getProperty("os.name") + ", OS is not supported, please contact a developer! "); } - - } else if (System.getProperty("os.name").contains("Windows") || System.getProperty("os.name").contains("Mac OS X")) { - try { - Desktop.getDesktop().open(new File(getCurrentStreamUrl())); - } catch (IOException e) { - LOGGER.warn("An error has occurred while opening the file!", e); - } - } else { - LOGGER.error(System.getProperty("os.name") + ", OS is not supported, please contact a developer! "); } } } @@ -894,6 +896,10 @@ public class MainWindowController { return mimeType != null && (mimeType.contains("mp4") || mimeType.contains("vp6")); } + /** + * Poser Mode WIP + */ + private void posterModeStartup() { checkAllPosters(); } diff --git a/src/main/resources/fxml/MainWindow.fxml b/src/main/resources/fxml/MainWindow.fxml index b850b67..9bd0731 100644 --- a/src/main/resources/fxml/MainWindow.fxml +++ b/src/main/resources/fxml/MainWindow.fxml @@ -64,6 +64,15 @@ + + + + + + + + +