minor bug fixes

This commit is contained in:
Jannik 2019-01-22 18:12:30 +01:00
parent c735583a04
commit e47f3ea2f7
2 changed files with 63 additions and 48 deletions

View File

@ -137,17 +137,16 @@ public class MainWindowController {
@FXML private TableColumn<SourceDataType, String> sourceColumn; @FXML private TableColumn<SourceDataType, String> sourceColumn;
@FXML private TableColumn<SourceDataType, String> modeColumn; @FXML private TableColumn<SourceDataType, String> modeColumn;
@FXML private TreeTableColumn<FilmTabelDataType, String> columnStreamUrl;
@FXML private TreeTableColumn<FilmTabelDataType, String> columnTitle;
@FXML private TreeTableColumn<FilmTabelDataType, ImageView> columnFavorite;
@FXML private TreeTableColumn<FilmTabelDataType, String> columnSeason;
@FXML private TreeTableColumn<FilmTabelDataType, String> columnEpisode;
// table-mode // table-mode
@FXML private AnchorPane tableModeAnchorPane; @FXML private AnchorPane tableModeAnchorPane;
@FXML private JFXTextField searchTextField; @FXML private JFXTextField searchTextField;
@FXML private TreeTableView<FilmTabelDataType> filmsTreeTable; @FXML private TreeTableView<FilmTabelDataType> filmsTreeTable;
@FXML private TreeTableColumn<FilmTabelDataType, String> columnStreamUrl;
@FXML private TreeTableColumn<FilmTabelDataType, String> columnTitle;
@FXML private TreeTableColumn<FilmTabelDataType, ImageView> columnFavorite;
@FXML private TreeTableColumn<FilmTabelDataType, String> columnSeason;
@FXML private TreeTableColumn<FilmTabelDataType, String> columnEpisode;
@FXML private TreeItem<FilmTabelDataType> filmRoot = new TreeItem<>(new FilmTabelDataType("", "", "", "", false, null, null)); @FXML private TreeItem<FilmTabelDataType> filmRoot = new TreeItem<>(new FilmTabelDataType("", "", "", "", false, null, null));
@ -161,7 +160,8 @@ public class MainWindowController {
@FXML private JFXButton forwardBtn; @FXML private JFXButton forwardBtn;
// poster-mode // poster-mode
// @FXML private AnchorPane posterModeAnchorPane; @FXML private AnchorPane posterModeAnchorPane;
@FXML private ScrollPane posterModeScrollPane;
private DBController dbController; private DBController dbController;
private UpdateController updateController; private UpdateController updateController;
@ -220,7 +220,7 @@ public class MainWindowController {
// load sources list in gui // load sources list in gui
addSourceToTable(); addSourceToTable();
// posterModeStartup(); // TODO testing DO NOT USE THIS!! // posterModeStartup(); // TODO testing DO NOT USE THIS!!
} }
// Initialize general UI elements // Initialize general UI elements
@ -464,51 +464,53 @@ public class MainWindowController {
// Table-Mode fxml actions // Table-Mode fxml actions
@FXML @FXML
private void playbtnclicked() { private void playbtnclicked() {
if (currentTableFilm.getStreamUrl().contains("_rootNode")) { if (currentTableFilm.getStreamUrl().length() > 0) {
LOGGER.info("rootNode found, getting last watched episode"); if (currentTableFilm.getStreamUrl().contains("_rootNode")) {
currentTableFilm = dbController.getLastWatchedEpisode(currentTableFilm.getTitle()); LOGGER.info("rootNode found, getting last watched episode");
} currentTableFilm = dbController.getLastWatchedEpisode(currentTableFilm.getTitle());
}
if (isSupportedFormat(currentTableFilm)) {
new Player(getCurrentTableFilm()); if (isSupportedFormat(currentTableFilm)) {
} else { new Player(getCurrentTableFilm());
LOGGER.error("using fallback player!"); } else {
if (System.getProperty("os.name").contains("Linux")) { LOGGER.error("using fallback player!");
String line; if (System.getProperty("os.name").contains("Linux")) {
String output = ""; String line;
Process p; String output = "";
try { Process p;
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 { 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) { } catch (IOException e) {
LOGGER.warn("An error has occurred while opening the file!", 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")); return mimeType != null && (mimeType.contains("mp4") || mimeType.contains("vp6"));
} }
/**
* Poser Mode WIP
*/
private void posterModeStartup() { private void posterModeStartup() {
checkAllPosters(); checkAllPosters();
} }

View File

@ -64,6 +64,15 @@
<JFXButton fx:id="forwardBtn" contentDisplay="CENTER" onAction="#forwardBtnclicked" prefHeight="25.0" prefWidth="90.0" AnchorPane.bottomAnchor="132.0" AnchorPane.rightAnchor="12.0" /> <JFXButton fx:id="forwardBtn" contentDisplay="CENTER" onAction="#forwardBtnclicked" prefHeight="25.0" prefWidth="90.0" AnchorPane.bottomAnchor="132.0" AnchorPane.rightAnchor="12.0" />
</children> </children>
</AnchorPane> </AnchorPane>
<ScrollPane fx:id="posterModeScrollPane" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="32.0">
<content>
<AnchorPane fx:id="posterModeAnchorPane">
<padding>
<Insets bottom="17.0" />
</padding>
</AnchorPane>
</content>
</ScrollPane>
<ScrollPane fx:id="settingsScrollPane" prefHeight="568.0" prefWidth="800.0" style="-fx-background: white;" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="150.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="32.0"> <ScrollPane fx:id="settingsScrollPane" prefHeight="568.0" prefWidth="800.0" style="-fx-background: white;" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="150.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="32.0">
<content> <content>
<AnchorPane fx:id="settingsAnchorPane" prefWidth="832.0" style="-fx-background-color: white;"> <AnchorPane fx:id="settingsAnchorPane" prefWidth="832.0" style="-fx-background-color: white;">