|
|
|
@ -32,12 +32,13 @@ import java.io.InputStreamReader;
|
|
|
|
|
import java.io.Writer;
|
|
|
|
|
import java.math.BigInteger;
|
|
|
|
|
import java.net.URLConnection;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Locale;
|
|
|
|
|
import java.util.ResourceBundle;
|
|
|
|
|
import java.util.concurrent.ExecutorService;
|
|
|
|
|
import java.util.concurrent.Executors;
|
|
|
|
|
|
|
|
|
|
import javax.swing.SwingUtilities;
|
|
|
|
|
|
|
|
|
|
import org.apache.logging.log4j.LogManager;
|
|
|
|
|
import org.apache.logging.log4j.Logger;
|
|
|
|
|
import org.kellerkinder.Alerts.JFXInfoAlert;
|
|
|
|
@ -93,9 +94,9 @@ import kellerkinder.HomeFlix.controller.DBController;
|
|
|
|
|
import kellerkinder.HomeFlix.controller.OMDbAPIController;
|
|
|
|
|
import kellerkinder.HomeFlix.controller.UpdateController;
|
|
|
|
|
import kellerkinder.HomeFlix.controller.XMLController;
|
|
|
|
|
import kellerkinder.HomeFlix.datatypes.FilmTabelDataType;
|
|
|
|
|
import kellerkinder.HomeFlix.datatypes.SourceDataType;
|
|
|
|
|
import kellerkinder.HomeFlix.player.Player;
|
|
|
|
|
import kellerkinder.HomeFlix.datatypes.FilmTabelDataType;
|
|
|
|
|
|
|
|
|
|
public class MainWindowController {
|
|
|
|
|
|
|
|
|
@ -163,14 +164,13 @@ public class MainWindowController {
|
|
|
|
|
// poster-mode
|
|
|
|
|
// @FXML private AnchorPane posterModeAnchorPane;
|
|
|
|
|
|
|
|
|
|
private static DBController dbController; // the player needs the initialized dbController
|
|
|
|
|
private DBController dbController;
|
|
|
|
|
private UpdateController updateController;
|
|
|
|
|
private XMLController xmlController;
|
|
|
|
|
private Stage primaryStage;
|
|
|
|
|
private static final Logger LOGGER = LogManager.getLogger(MainWindowController.class.getName());
|
|
|
|
|
|
|
|
|
|
private boolean menuTrue = false;
|
|
|
|
|
private boolean settingsTrue = false;
|
|
|
|
|
|
|
|
|
|
private final String version = "0.7.0";
|
|
|
|
|
private final String buildNumber = "169";
|
|
|
|
@ -290,9 +290,8 @@ public class MainWindowController {
|
|
|
|
|
burgerTask.play();
|
|
|
|
|
menuTrue = true;
|
|
|
|
|
}
|
|
|
|
|
if (settingsTrue) {
|
|
|
|
|
if (settingsScrollPane.isVisible()) {
|
|
|
|
|
settingsScrollPane.setVisible(false);
|
|
|
|
|
settingsTrue = false;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -512,10 +511,11 @@ public class MainWindowController {
|
|
|
|
|
|
|
|
|
|
@FXML
|
|
|
|
|
private void openfolderbtnclicked() {
|
|
|
|
|
String dest = new File(getCurrentStreamUrl()).getParentFile().getAbsolutePath();
|
|
|
|
|
File dest = new File(getCurrentStreamUrl()).getParentFile();
|
|
|
|
|
|
|
|
|
|
if (!System.getProperty("os.name").contains("Linux")) {
|
|
|
|
|
try {
|
|
|
|
|
Desktop.getDesktop().open(new File(dest));
|
|
|
|
|
Desktop.getDesktop().open(dest);
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
@ -543,12 +543,10 @@ public class MainWindowController {
|
|
|
|
|
|
|
|
|
|
@FXML
|
|
|
|
|
private void settingsBtnclicked() {
|
|
|
|
|
if (settingsTrue) {
|
|
|
|
|
if (settingsScrollPane.isVisible()) {
|
|
|
|
|
settingsScrollPane.setVisible(false);
|
|
|
|
|
settingsTrue = false;
|
|
|
|
|
} else {
|
|
|
|
|
settingsScrollPane.setVisible(true);
|
|
|
|
|
settingsTrue = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -613,8 +611,8 @@ public class MainWindowController {
|
|
|
|
|
* clear the FilmsList and FilmRoot children, then update the database
|
|
|
|
|
*/
|
|
|
|
|
private void refreshAllFilms() {
|
|
|
|
|
getFilmsList().clear();
|
|
|
|
|
getFilmRoot().getChildren().clear();
|
|
|
|
|
filmsList.clear();
|
|
|
|
|
filmRoot.getChildren().clear();
|
|
|
|
|
dbController.refreshDataBase(); // refreshes the database after a source path was added
|
|
|
|
|
filmsList = dbController.getDatabaseFilmsList(); // returns a list of all films stored in the database
|
|
|
|
|
addFilmsToTable(filmsList);
|
|
|
|
@ -690,7 +688,7 @@ public class MainWindowController {
|
|
|
|
|
|
|
|
|
|
// clear old sources list/table
|
|
|
|
|
getSourcesList().clear();
|
|
|
|
|
getSourceRoot().getChildren().clear();
|
|
|
|
|
sourceRoot.getChildren().clear();
|
|
|
|
|
|
|
|
|
|
// clear the FilmsList and FilmRoot children, then update the database
|
|
|
|
|
refreshAllFilms();
|
|
|
|
@ -809,27 +807,27 @@ public class MainWindowController {
|
|
|
|
|
ObservableList<Node> textFlow = getTextFlow().getChildren();
|
|
|
|
|
|
|
|
|
|
// TODO this should move! ***
|
|
|
|
|
ArrayList<Text> nameText = new ArrayList<Text>();
|
|
|
|
|
nameText.add(new Text(XMLController.getLocalBundle().getString("title") + ": "));
|
|
|
|
|
nameText.add(new Text(XMLController.getLocalBundle().getString("year") + ": "));
|
|
|
|
|
nameText.add(new Text(XMLController.getLocalBundle().getString("rated") + ": "));
|
|
|
|
|
nameText.add(new Text(XMLController.getLocalBundle().getString("released") + ": "));
|
|
|
|
|
nameText.add(new Text(XMLController.getLocalBundle().getString("season") + ": "));
|
|
|
|
|
nameText.add(new Text(XMLController.getLocalBundle().getString("episode") + ": "));
|
|
|
|
|
nameText.add(new Text(XMLController.getLocalBundle().getString("runtime") + ": "));
|
|
|
|
|
nameText.add(new Text(XMLController.getLocalBundle().getString("genre") + ": "));
|
|
|
|
|
nameText.add(new Text(XMLController.getLocalBundle().getString("director") + ": "));
|
|
|
|
|
nameText.add(new Text(XMLController.getLocalBundle().getString("writer") + ": "));
|
|
|
|
|
nameText.add(new Text(XMLController.getLocalBundle().getString("actors") + ": "));
|
|
|
|
|
nameText.add(new Text(XMLController.getLocalBundle().getString("plot") + ": "));
|
|
|
|
|
nameText.add(new Text(XMLController.getLocalBundle().getString("language") + ": "));
|
|
|
|
|
nameText.add(new Text(XMLController.getLocalBundle().getString("country") + ": "));
|
|
|
|
|
nameText.add(new Text(XMLController.getLocalBundle().getString("awards") + ": "));
|
|
|
|
|
nameText.add(new Text(XMLController.getLocalBundle().getString("metascore") + ": "));
|
|
|
|
|
nameText.add(new Text(XMLController.getLocalBundle().getString("imdbRating") + ": "));
|
|
|
|
|
nameText.add(new Text(XMLController.getLocalBundle().getString("type") + ": "));
|
|
|
|
|
nameText.add(new Text(XMLController.getLocalBundle().getString("boxOffice") + ": "));
|
|
|
|
|
nameText.add(new Text(XMLController.getLocalBundle().getString("website") + ": "));
|
|
|
|
|
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("director") + ": ");
|
|
|
|
|
nameText[9] = new Text(XMLController.getLocalBundle().getString("writer") + ": ");
|
|
|
|
|
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
|
|
|
|
@ -845,7 +843,7 @@ public class MainWindowController {
|
|
|
|
|
if (cacheData[i] != null && (i == 5 || i == 6) && cacheData[5].length() == 0) {
|
|
|
|
|
// do nothing
|
|
|
|
|
} else if(cacheData[i] != null){
|
|
|
|
|
textFlow.addAll(nameText.get(i), new Text(cacheData[i] + "\n"));
|
|
|
|
|
textFlow.addAll(nameText[i], new Text(cacheData[i] + "\n"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -853,9 +851,9 @@ public class MainWindowController {
|
|
|
|
|
|
|
|
|
|
// add the image
|
|
|
|
|
try {
|
|
|
|
|
getPosterImageView().setImage(new Image(new File(cacheData[20]).toURI().toString()));
|
|
|
|
|
posterImageView.setImage(new Image(new File(cacheData[20]).toURI().toString()));
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
getPosterImageView().setImage(new Image("icons/close_black_2048x2048.png"));
|
|
|
|
|
posterImageView.setImage(new Image("icons/close_black_2048x2048.png"));
|
|
|
|
|
LOGGER.error("No Poster found, useing default.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -914,9 +912,6 @@ public class MainWindowController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// getter and setter
|
|
|
|
|
public static DBController getDbController() {
|
|
|
|
|
return dbController;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public FilmTabelDataType getCurrentTableFilm() {
|
|
|
|
|
return currentTableFilm;
|
|
|
|
@ -938,35 +933,15 @@ public class MainWindowController {
|
|
|
|
|
return indexList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ObservableList<FilmTabelDataType> getFilmsList() {
|
|
|
|
|
return filmsList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static ObservableList<SourceDataType> getSourcesList() {
|
|
|
|
|
return sourcesList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public TreeTableView<FilmTabelDataType> getFilmsTreeTable() {
|
|
|
|
|
return filmsTreeTable;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public TextFlow getTextFlow() {
|
|
|
|
|
return textFlow;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ImageView getPosterImageView() {
|
|
|
|
|
return posterImageView;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public JFXButton getUpdateBtn() {
|
|
|
|
|
return updateBtn;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public TreeItem<FilmTabelDataType> getFilmRoot() {
|
|
|
|
|
return filmRoot;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public TreeItem<SourceDataType> getSourceRoot() {
|
|
|
|
|
return sourceRoot;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|