moved static vars and save & load code to XMLController

* moved static vars and save & load code to XMLController
* code clean up
* happy new year
This commit is contained in:
Jannik 2019-01-08 17:10:33 +01:00
parent 060527ae03
commit d3d22db7a8
17 changed files with 392 additions and 296 deletions

View File

@ -1,7 +1,7 @@
/** /**
* Project-HomeFlix * Project-HomeFlix
* *
* Copyright 2016-2018 <@Seil0> * Copyright 2016-2019 <@Seil0>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -21,25 +21,15 @@
*/ */
package kellerkinder.HomeFlix.application; package kellerkinder.HomeFlix.application;
import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.util.Locale; import java.util.Locale;
import java.util.Properties;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.kellerkinder.Alerts.JFX2BtnCancelAlert; import org.kellerkinder.Alerts.JFX2BtnCancelAlert;
import com.eclipsesource.json.Json;
import com.eclipsesource.json.JsonObject;
import javafx.application.Application; import javafx.application.Application;
import javafx.event.ActionEvent; import javafx.event.ActionEvent;
import javafx.event.EventHandler; import javafx.event.EventHandler;
@ -50,6 +40,7 @@ import javafx.scene.layout.AnchorPane;
import javafx.stage.DirectoryChooser; import javafx.stage.DirectoryChooser;
import javafx.stage.FileChooser; import javafx.stage.FileChooser;
import javafx.stage.Stage; import javafx.stage.Stage;
import kellerkinder.HomeFlix.controller.XMLController;
public class Main extends Application { public class Main extends Application {
@ -57,27 +48,15 @@ public class Main extends Application {
private Scene scene; private Scene scene;
private AnchorPane pane; private AnchorPane pane;
private MainWindowController mainWindowController; private MainWindowController mainWindowController;
private static String userHome = System.getProperty("user.home"); private static XMLController xmlController;
private static String userName = System.getProperty("user.name");
private static String osName = System.getProperty("os.name");
private static String osArch = System.getProperty("os.arch");
private static String osVers = System.getProperty("os.version");
private static String javaVers = System.getProperty("java.version");
private static String javaVend = System.getProperty("java.vendor");
private static String local = System.getProperty("user.language") + "_" + System.getProperty("user.country");
private static String dirHomeFlix;
private static File directory;
private static File configFile;
private static File posterCache;
private ResourceBundle bundle; private ResourceBundle bundle;
private static Logger LOGGER; private static Logger LOGGER;
private Properties props = new Properties();
@Override @Override
public void start(Stage primaryStage) throws IOException { public void start(Stage primaryStage) throws IOException {
LOGGER.info("OS: " + osName + " " + osVers + " " + osArch); LOGGER.info("OS: " + XMLController.getOsName() + " " + XMLController.getOsVers() + " " + XMLController.getOsVers());
LOGGER.info("Java: " + javaVend + " " + javaVers); LOGGER.info("Java: " + XMLController.getJavaVend() + " " + XMLController.getJavaVers());
LOGGER.info("User: " + userName + " " + userHome); LOGGER.info("User: " + XMLController.getUserName() + " " + XMLController.getUserHome());
this.primaryStage = primaryStage; this.primaryStage = primaryStage;
mainWindowController = new MainWindowController(this); mainWindowController = new MainWindowController(this);
@ -109,20 +88,16 @@ public class Main extends Application {
primaryStage.show(); // show stage primaryStage.show(); // show stage
// startup checks // startup checks
if (!configFile.exists()) { if (!XMLController.getConfigFile().exists()) {
directory.mkdir(); XMLController.getDirHomeFlix().mkdir();
System.out.println("config not found"); System.out.println("config not found");
addFirstSource(); addFirstSource();
mainWindowController.setColor("ee3523"); xmlController.saveSettings();
mainWindowController.setFontSize(17.0);
mainWindowController.setAutoUpdate(false);
mainWindowController.setLocal(local);
saveSettings();
} }
if (!posterCache.exists()) { if (!XMLController.getPosterCache().exists()) {
posterCache.mkdir(); XMLController.getPosterCache().mkdir();
} }
mainWindowController.init(); mainWindowController.init();
@ -136,31 +111,30 @@ public class Main extends Application {
* @param args arguments given at the start * @param args arguments given at the start
*/ */
public static void main(String[] args) { public static void main(String[] args) {
// Logger initialization
if (osName.contains("Windows")) { String logPath = "";
dirHomeFlix = userHome + "/Documents/HomeFlix";
if (System.getProperty("os.name").contains("Windows")) {
logPath = System.getProperty("user.home") + "/Documents/HomeFlix/app.log";
} else { } else {
dirHomeFlix = userHome + "/HomeFlix"; logPath = System.getProperty("user.home") + "/HomeFlix/app.log";
} }
// set the concrete files System.setProperty("logFilename", logPath);
directory = new File(dirHomeFlix); File logFile = new File(logPath);
configFile = new File(dirHomeFlix + "/config.xml");
posterCache = new File(dirHomeFlix + "/posterCache");
System.setProperty("logFilename", dirHomeFlix + "/app.log");
File logFile = new File(dirHomeFlix + "/app.log");
logFile.delete(); logFile.delete();
LOGGER = LogManager.getLogger(Main.class.getName()); LOGGER = LogManager.getLogger(Main.class.getName());
xmlController = new XMLController();
launch(args); launch(args);
} }
/** /** TODO this should move
* we need to get the path for the first source from the user and add it to * we need to get the path for the first source from the user and add it to
* sources.json, if the user ends the file-/directory-chooser the program will exit * sources.json, if the user ends the file-/directory-chooser the program will exit
*/ */
void addFirstSource() { void addFirstSource() {
switch (local) { switch (XMLController.getSysLocal()) {
case "en_US": case "en_US":
bundle = ResourceBundle.getBundle("locals.HomeFlix-Local", Locale.US); // us_english bundle = ResourceBundle.getBundle("locals.HomeFlix-Local", Locale.US); // us_english
break; break;
@ -217,103 +191,6 @@ public class Main extends Application {
selectFirstSource.showAndWait(); selectFirstSource.showAndWait();
} }
/**
* save the configuration to the config.xml file
*/
public void saveSettings() {
LOGGER.info("saving settings ...");
try {
props.setProperty("color", mainWindowController.getColor());
props.setProperty("autoUpdate", String.valueOf(mainWindowController.isAutoUpdate()));
props.setProperty("useBeta", String.valueOf(mainWindowController.isUseBeta()));
props.setProperty("autoplay", String.valueOf(mainWindowController.isAutoplay()));
props.setProperty("size", mainWindowController.getFontSize().toString());
props.setProperty("local", mainWindowController.getLocal());
OutputStream outputStream = new FileOutputStream(getConfigFile()); // new output-stream
props.storeToXML(outputStream, "Project HomeFlix settings"); // write new .xml
outputStream.close();
} catch (IOException e) {
LOGGER.error("An error occurred while saving the settings!", e);
}
}
/**
* load the configuration from the config.xml file
* and try to load the API keys from apiKeys.json
*/
public void loadSettings() {
LOGGER.info("loading settings ...");
try {
InputStream inputStream = new FileInputStream(getConfigFile());
props.loadFromXML(inputStream); // new input-stream from .xml
try {
mainWindowController.setColor(props.getProperty("color"));
} catch (Exception e) {
LOGGER.error("cloud not load color", e);
mainWindowController.setColor("00a8cc");
}
try {
mainWindowController.setFontSize(Double.parseDouble(props.getProperty("size")));
} catch (Exception e) {
LOGGER.error("cloud not load fontsize", e);
mainWindowController.setFontSize(17.0);
}
try {
mainWindowController.setAutoUpdate(Boolean.parseBoolean(props.getProperty("autoUpdate")));
} catch (Exception e) {
LOGGER.error("cloud not load autoUpdate", e);
mainWindowController.setAutoUpdate(false);
}
try {
mainWindowController.setUseBeta(Boolean.parseBoolean(props.getProperty("useBeta")));
} catch (Exception e) {
LOGGER.error("cloud not load autoUpdate", e);
mainWindowController.setUseBeta(false);
}
try {
mainWindowController.setAutoplay(Boolean.parseBoolean(props.getProperty("autoplay")));
} catch (Exception e) {
LOGGER.error("cloud not load autoplay", e);
mainWindowController.setAutoplay(false);
}
try {
mainWindowController.setLocal(props.getProperty("local"));
} catch (Exception e) {
LOGGER.error("cloud not load local", e);
mainWindowController.setLocal(System.getProperty("user.language") + "_" + System.getProperty("user.country"));
}
inputStream.close();
} catch (IOException e) {
LOGGER.error("An error occurred while loading the settings!", e);
}
// try loading the omdbAPI key
try {
InputStream in = getClass().getClassLoader().getResourceAsStream("apiKeys.json");
if (in != null) {
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
JsonObject apiKeys = Json.parse(reader).asObject();
mainWindowController.setOmdbAPIKey(apiKeys.getString("omdbAPIKey", ""));
reader.close();
in.close();
} else {
LOGGER.warn("Cloud not load apiKeys.json. No such file");
}
} catch (Exception e) {
LOGGER.error("Cloud not load the omdbAPI key. Please contact the developer!", e);
}
}
public Stage getPrimaryStage() { public Stage getPrimaryStage() {
return primaryStage; return primaryStage;
} }
@ -321,16 +198,4 @@ public class Main extends Application {
public AnchorPane getPane() { public AnchorPane getPane() {
return pane; return pane;
} }
public File getDirectory() {
return directory;
}
public File getConfigFile() {
return configFile;
}
public File getPosterCache() {
return posterCache;
}
} }

View File

@ -1,7 +1,7 @@
/** /**
* Project-HomeFlix * Project-HomeFlix
* *
* Copyright 2016-2018 <@Seil0> * Copyright 2016-2019 <@Seil0>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -86,6 +86,7 @@ import javafx.util.Duration;
import kellerkinder.HomeFlix.controller.DBController; import kellerkinder.HomeFlix.controller.DBController;
import kellerkinder.HomeFlix.controller.OMDbAPIController; import kellerkinder.HomeFlix.controller.OMDbAPIController;
import kellerkinder.HomeFlix.controller.UpdateController; import kellerkinder.HomeFlix.controller.UpdateController;
import kellerkinder.HomeFlix.controller.XMLController;
import kellerkinder.HomeFlix.datatypes.SourceDataType; import kellerkinder.HomeFlix.datatypes.SourceDataType;
import kellerkinder.HomeFlix.player.Player; import kellerkinder.HomeFlix.player.Player;
import kellerkinder.HomeFlix.datatypes.FilmTabelDataType; import kellerkinder.HomeFlix.datatypes.FilmTabelDataType;
@ -153,29 +154,22 @@ public class MainWindowController {
// poster-mode // poster-mode
// @FXML private AnchorPane posterModeAnchorPane; // @FXML private AnchorPane posterModeAnchorPane;
private Main main; private Main main;
private MainWindowController mainWindowController; private MainWindowController mainWindowController;
private UpdateController updateController; private UpdateController updateController;
private DBController dbController; private DBController dbController;
private XMLController xmlController;
private static final Logger LOGGER = LogManager.getLogger(MainWindowController.class.getName()); private static final Logger LOGGER = LogManager.getLogger(MainWindowController.class.getName());
private boolean menuTrue = false; private boolean menuTrue = false;
private boolean settingsTrue = false; private boolean settingsTrue = false;
private boolean autoUpdate = false;
private boolean useBeta = false;
private boolean autoplay = false;
private final String version = "0.7.0"; private final String version = "0.7.0";
private final String buildNumber = "165"; private final String buildNumber = "167";
private final String versionName = "toothless dragon"; private final String versionName = "toothless dragon";
private String btnStyle; private String btnStyle;
private String color;
private String local;
private String omdbAPIKey;
private double fontSize;
private final int hashA = -647380320; private final int hashA = -647380320;
private int last; private int last;
private int indexTable; private int indexTable;
@ -200,14 +194,15 @@ public class MainWindowController {
public MainWindowController(Main main) { public MainWindowController(Main main) {
this.main = main; this.main = main;
mainWindowController = this; mainWindowController = this;
dbController = new DBController(this.main, this); xmlController = new XMLController(); // TODO pass it over from main?
dbController = new DBController(this);
} }
public void init() { public void init() {
LOGGER.info("Initializing Project-HomeFlix build " + buildNumber); LOGGER.info("Initializing Project-HomeFlix build " + buildNumber);
main.loadSettings(); // load settings xmlController.loadSettings(); // load settings
checkAutoUpdate(); checkAutoUpdate();
// initialize the GUI and the DBController // initialize the GUI and the DBController
@ -222,16 +217,16 @@ public class MainWindowController {
// Initialize general UI elements // Initialize general UI elements
private void initUI() { private void initUI() {
versionLbl.setText("Version: " + version + " (Build: " + buildNumber + ")"); versionLbl.setText("Version: " + version + " (Build: " + buildNumber + ")");
fontsizeSlider.setValue(getFontSize()); fontsizeSlider.setValue(XMLController.getFontSize());
colorPicker.setValue(Color.valueOf(getColor())); colorPicker.setValue(Color.valueOf(XMLController.getColor()));
updateBtn.setFont(Font.font("System", 12)); updateBtn.setFont(Font.font("System", 12));
autoUpdateToggleBtn.setSelected(isAutoUpdate()); autoUpdateToggleBtn.setSelected(XMLController.isAutoUpdate());
autoplayToggleBtn.setSelected(isAutoplay()); autoplayToggleBtn.setSelected(XMLController.isAutoplay());
languageChoisBox.setItems(languages); languageChoisBox.setItems(languages);
branchChoisBox.setItems(branches); branchChoisBox.setItems(branches);
if (isUseBeta()) { if (XMLController.isUseBeta()) {
branchChoisBox.getSelectionModel().select(1); branchChoisBox.getSelectionModel().select(1);
} else { } else {
branchChoisBox.getSelectionModel().select(0); branchChoisBox.getSelectionModel().select(0);
@ -303,7 +298,7 @@ public class MainWindowController {
} }
if (settingsTrue) { if (settingsTrue) {
settingsScrollPane.setVisible(false); settingsScrollPane.setVisible(false);
main.saveSettings(); xmlController.saveSettings();
settingsTrue = false; settingsTrue = false;
} }
}); });
@ -313,9 +308,9 @@ public class MainWindowController {
public void changed(ObservableValue<? extends Number> ov, Number value, Number new_value) { public void changed(ObservableValue<? extends Number> ov, Number value, Number new_value) {
String local = languageChoisBox.getItems().get((int) new_value).toString(); String local = languageChoisBox.getItems().get((int) new_value).toString();
local = local.substring(local.length() - 6, local.length() - 1); // reading only en_US from English (en_US) local = local.substring(local.length() - 6, local.length() - 1); // reading only en_US from English (en_US)
setLocal(local); XMLController.setUsrLocal(local);
setLocalUI(); setLocalUI();
main.saveSettings(); xmlController.saveSettings();
} }
}); });
@ -323,22 +318,22 @@ public class MainWindowController {
@Override @Override
public void changed(ObservableValue<? extends Number> ov, Number value, Number new_value) { public void changed(ObservableValue<? extends Number> ov, Number value, Number new_value) {
if (branchChoisBox.getItems().get((int) new_value).toString() == "beta") { if (branchChoisBox.getItems().get((int) new_value).toString() == "beta") {
setUseBeta(true); XMLController.setUseBeta(true);
} else { } else {
setUseBeta(false); XMLController.setUseBeta(false);
} }
main.saveSettings(); xmlController.saveSettings();
} }
}); });
fontsizeSlider.valueProperty().addListener(new ChangeListener<Number>() { fontsizeSlider.valueProperty().addListener(new ChangeListener<Number>() {
@Override @Override
public void changed(ObservableValue<? extends Number> ov, Number old_val, Number new_val) { public void changed(ObservableValue<? extends Number> ov, Number old_val, Number new_val) {
setFontSize(fontsizeSlider.getValue()); XMLController.setFontSize(fontsizeSlider.getValue());
if (!getCurrentTitle().isEmpty()) { if (!getCurrentTitle().isEmpty()) {
dbController.readCache(getCurrentStreamUrl()); dbController.readCache(getCurrentStreamUrl());
} }
main.saveSettings(); xmlController.saveSettings();
} }
}); });
@ -362,7 +357,7 @@ public class MainWindowController {
filmRoot.getChildren().add(new TreeItem<FilmTabelDataType>(filterData.get(i))); // add filtered data to root node after search filmRoot.getChildren().add(new TreeItem<FilmTabelDataType>(filterData.get(i))); // add filtered data to root node after search
} }
if (searchTextField.getText().hashCode() == hashA) { if (searchTextField.getText().hashCode() == hashA) {
setColor("000000"); XMLController.setColor("000000");
colorPicker.setValue(new Color(0, 0, 0, 1)); colorPicker.setValue(new Color(0, 0, 0, 1));
applyColor(); applyColor();
} }
@ -443,7 +438,7 @@ public class MainWindowController {
LOGGER.info("loading from cache: " + getCurrentTitle()); LOGGER.info("loading from cache: " + getCurrentTitle());
dbController.readCache(getCurrentStreamUrl()); dbController.readCache(getCurrentStreamUrl());
} else { } else {
Thread omdbAPIThread = new Thread(new OMDbAPIController(main, dbController, currentTableFilm, omdbAPIKey, true)); Thread omdbAPIThread = new Thread(new OMDbAPIController(dbController, currentTableFilm, XMLController.getOmdbAPIKey(), true));
omdbAPIThread.setName("OMDbAPI"); omdbAPIThread.setName("OMDbAPI");
omdbAPIThread.start(); omdbAPIThread.start();
} }
@ -538,7 +533,7 @@ public class MainWindowController {
private void settingsBtnclicked() { private void settingsBtnclicked() {
if (settingsTrue) { if (settingsTrue) {
settingsScrollPane.setVisible(false); settingsScrollPane.setVisible(false);
main.saveSettings(); xmlController.saveSettings();
settingsTrue = false; settingsTrue = false;
} else { } else {
settingsScrollPane.setVisible(true); settingsScrollPane.setVisible(true);
@ -572,29 +567,29 @@ public class MainWindowController {
@FXML @FXML
private void colorPickerAction() { private void colorPickerAction() {
setColor(colorPicker.getValue().toString().substring(2, 10)); XMLController.setColor(colorPicker.getValue().toString().substring(2, 10));
main.saveSettings(); xmlController.saveSettings();
applyColor(); applyColor();
} }
@FXML @FXML
private void updateBtnAction() { private void updateBtnAction() {
updateController = new UpdateController(this, buildNumber, useBeta); updateController = new UpdateController(this, buildNumber, XMLController.isUseBeta());
Thread updateThread = new Thread(updateController); Thread updateThread = new Thread(updateController);
updateThread.setName("Updater"); updateThread.setName("Updater");
updateThread.start(); updateThread.start();
} }
@FXML @FXML
private void autoUpdateToggleBtnAction(){ private void autoUpdateToggleBtnAction() {
autoUpdate = isAutoUpdate() ? false : true; XMLController.setAutoUpdate(!XMLController.isAutoUpdate());
main.saveSettings(); xmlController.saveSettings();
} }
@FXML @FXML
private void autoplayToggleBtnAction(){ private void autoplayToggleBtnAction(){
autoplay = isAutoplay() ? false : true; XMLController.setAutoplay(!XMLController.isAutoplay());
main.saveSettings(); xmlController.saveSettings();
} }
// refresh the selected child of the root node // refresh the selected child of the root node
@ -652,9 +647,9 @@ public class MainWindowController {
try { try {
// read old array // read old array
File oldSources = new File(main.getDirectory() + "/sources.json"); File oldSources = new File(XMLController.getDirHomeFlix() + "/sources.json");
if (oldSources.exists()) { if (oldSources.exists()) {
newsources = Json.parse(new FileReader(main.getDirectory() + "/sources.json")).asArray(); newsources = Json.parse(new FileReader(XMLController.getDirHomeFlix() + "/sources.json")).asArray();
} else { } else {
newsources = Json.array(); newsources = Json.array();
} }
@ -662,7 +657,7 @@ public class MainWindowController {
// add new source // add new source
source = Json.object().add("path", path).add("mode", mode); source = Json.object().add("path", path).add("mode", mode);
newsources.add(source); newsources.add(source);
Writer writer = new FileWriter(main.getDirectory() + "/sources.json"); Writer writer = new FileWriter(XMLController.getDirHomeFlix() + "/sources.json");
newsources.writeTo(writer); newsources.writeTo(writer);
writer.close(); writer.close();
} catch (IOException e) { } catch (IOException e) {
@ -682,11 +677,11 @@ public class MainWindowController {
*/ */
private void applyColor() { private void applyColor() {
String menuBtnStyle; String menuBtnStyle;
BigInteger usedColor = new BigInteger(getColor(), 16); BigInteger usedColor = new BigInteger(XMLController.getColor(), 16);
BigInteger checkColor = new BigInteger("78909cff", 16); BigInteger checkColor = new BigInteger("78909cff", 16);
if (usedColor.compareTo(checkColor) == -1) { if (usedColor.compareTo(checkColor) == -1) {
btnStyle = "-fx-button-type: RAISED; -fx-background-color: #" + getColor() + "; -fx-text-fill: WHITE;"; btnStyle = "-fx-button-type: RAISED; -fx-background-color: #" + XMLController.getColor() + "; -fx-text-fill: WHITE;";
menuBtnStyle = "-fx-text-fill: WHITE;"; menuBtnStyle = "-fx-text-fill: WHITE;";
playbtn.setGraphic(new ImageView(new Image("icons/ic_play_arrow_white_18dp_1x.png"))); playbtn.setGraphic(new ImageView(new Image("icons/ic_play_arrow_white_18dp_1x.png")));
@ -696,7 +691,7 @@ public class MainWindowController {
menuHam.getStyleClass().clear(); menuHam.getStyleClass().clear();
menuHam.getStyleClass().add("jfx-hamburgerW"); menuHam.getStyleClass().add("jfx-hamburgerW");
} else { } else {
btnStyle = "-fx-button-type: RAISED; -fx-background-color: #" + getColor() + "; -fx-text-fill: BLACK;"; btnStyle = "-fx-button-type: RAISED; -fx-background-color: #" + XMLController.getColor() + "; -fx-text-fill: BLACK;";
menuBtnStyle = "-fx-text-fill: BLACK;"; menuBtnStyle = "-fx-text-fill: BLACK;";
playbtn.setGraphic(new ImageView(new Image("icons/ic_play_arrow_black_18dp_1x.png"))); playbtn.setGraphic(new ImageView(new Image("icons/ic_play_arrow_black_18dp_1x.png")));
@ -708,9 +703,9 @@ public class MainWindowController {
} }
// boxes and TextFields // boxes and TextFields
sideMenuVBox.setStyle("-fx-background-color: #" + getColor() + ";"); sideMenuVBox.setStyle("-fx-background-color: #" + XMLController.getColor() + ";");
topHBox.setStyle("-fx-background-color: #" + getColor() + ";"); topHBox.setStyle("-fx-background-color: #" + XMLController.getColor() + ";");
searchTextField.setFocusColor(Color.valueOf(getColor())); searchTextField.setFocusColor(Color.valueOf(XMLController.getColor()));
// normal buttons // normal buttons
addDirectoryBtn.setStyle(btnStyle); addDirectoryBtn.setStyle(btnStyle);
@ -747,7 +742,7 @@ public class MainWindowController {
* set the local based on the languageChoisBox selection * set the local based on the languageChoisBox selection
*/ */
void setLocalUI() { void setLocalUI() {
switch (getLocal()) { switch (XMLController.getUsrLocal()) {
case "en_US": case "en_US":
setBundle(ResourceBundle.getBundle("locals.HomeFlix-Local", Locale.US)); // us_English setBundle(ResourceBundle.getBundle("locals.HomeFlix-Local", Locale.US)); // us_English
languageChoisBox.getSelectionModel().select(0); languageChoisBox.getSelectionModel().select(0);
@ -785,10 +780,10 @@ public class MainWindowController {
// if AutoUpdate, then check for updates // if AutoUpdate, then check for updates
private void checkAutoUpdate() { private void checkAutoUpdate() {
if (isAutoUpdate()) { if (XMLController.isAutoUpdate()) {
try { try {
LOGGER.info("AutoUpdate: looking for updates on startup ..."); LOGGER.info("AutoUpdate: looking for updates on startup ...");
updateController = new UpdateController(this, buildNumber, useBeta); updateController = new UpdateController(this, buildNumber, XMLController.isUseBeta());
Thread updateThread = new Thread(updateController); Thread updateThread = new Thread(updateController);
updateThread.setName("Updater"); updateThread.setName("Updater");
updateThread.start(); updateThread.start();
@ -824,7 +819,7 @@ public class MainWindowController {
for (FilmTabelDataType entry : dbController.getAllNotCachedEntries()) { for (FilmTabelDataType entry : dbController.getAllNotCachedEntries()) {
System.out.println(entry.getStreamUrl() + " is NOT cached!"); System.out.println(entry.getStreamUrl() + " is NOT cached!");
Runnable OMDbAPIWorker = new OMDbAPIController(main, dbController, entry, omdbAPIKey, false); Runnable OMDbAPIWorker = new OMDbAPIController(dbController, entry, XMLController.getOmdbAPIKey(), false);
executor.execute(OMDbAPIWorker); executor.execute(OMDbAPIWorker);
} }
executor.shutdown(); executor.shutdown();
@ -836,14 +831,6 @@ public class MainWindowController {
public DBController getDbController() { public DBController getDbController() {
return dbController; return dbController;
} }
public String getColor() {
return color;
}
public void setColor(String input) {
this.color = input;
}
public FilmTabelDataType getCurrentTableFilm() { public FilmTabelDataType getCurrentTableFilm() {
return currentTableFilm; return currentTableFilm;
@ -857,14 +844,6 @@ public class MainWindowController {
return currentTableFilm.getStreamUrl(); return currentTableFilm.getStreamUrl();
} }
public Double getFontSize() {
return fontSize;
}
public void setFontSize(Double input) {
this.fontSize = input;
}
public int getIndexTable() { public int getIndexTable() {
return indexTable; return indexTable;
} }
@ -873,46 +852,6 @@ public class MainWindowController {
return indexList; return indexList;
} }
public boolean isAutoUpdate() {
return autoUpdate;
}
public void setAutoUpdate(boolean input) {
this.autoUpdate = input;
}
public boolean isUseBeta() {
return useBeta;
}
public void setUseBeta(boolean useBeta) {
this.useBeta = useBeta;
}
public boolean isAutoplay() {
return autoplay;
}
public void setAutoplay(boolean autoplay) {
this.autoplay = autoplay;
}
public String getLocal() {
return local;
}
public void setLocal(String input) {
this.local = input;
}
public String getOmdbAPIKey() {
return omdbAPIKey;
}
public void setOmdbAPIKey(String omdbAPIKey) {
this.omdbAPIKey = omdbAPIKey;
}
public ObservableList<FilmTabelDataType> getFilmsList() { public ObservableList<FilmTabelDataType> getFilmsList() {
return filmsList; return filmsList;
} }

View File

@ -1,7 +1,7 @@
/** /**
* Project-HomeFlix * Project-HomeFlix
* *
* Copyright 2016-2018 <@Seil0> * Copyright 2016-2019 <@Seil0>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -44,7 +44,6 @@ import javafx.scene.image.ImageView;
import javafx.scene.text.Font; import javafx.scene.text.Font;
import javafx.scene.text.FontWeight; import javafx.scene.text.FontWeight;
import javafx.scene.text.Text; import javafx.scene.text.Text;
import kellerkinder.HomeFlix.application.Main;
import kellerkinder.HomeFlix.application.MainWindowController; import kellerkinder.HomeFlix.application.MainWindowController;
import kellerkinder.HomeFlix.datatypes.DatabaseDataType; import kellerkinder.HomeFlix.datatypes.DatabaseDataType;
import kellerkinder.HomeFlix.datatypes.FilmTabelDataType; import kellerkinder.HomeFlix.datatypes.FilmTabelDataType;
@ -53,7 +52,6 @@ import kellerkinder.HomeFlix.datatypes.OMDbAPIResponseDataType;
public class DBController { public class DBController {
private MainWindowController mainWindowController; private MainWindowController mainWindowController;
private Main main;
private String DB_PATH; private String DB_PATH;
private Image favorite_black = new Image("icons/ic_favorite_black_18dp_1x.png"); private Image favorite_black = new Image("icons/ic_favorite_black_18dp_1x.png");
private Image favorite_border_black = new Image("icons/ic_favorite_border_black_18dp_1x.png"); private Image favorite_border_black = new Image("icons/ic_favorite_border_black_18dp_1x.png");
@ -67,8 +65,7 @@ public class DBController {
* @param main the Main object * @param main the Main object
* @param mainWindowController the MainWindowController object * @param mainWindowController the MainWindowController object
*/ */
public DBController(Main main, MainWindowController mainWindowController) { public DBController(MainWindowController mainWindowController) {
this.main = main;
this.mainWindowController = mainWindowController; this.mainWindowController = mainWindowController;
} }
@ -91,7 +88,7 @@ public class DBController {
* AutoCommit is set to false to prevent some issues, so manual commit is active! * AutoCommit is set to false to prevent some issues, so manual commit is active!
*/ */
private void initDatabaseConnection() { private void initDatabaseConnection() {
DB_PATH = main.getDirectory() + "/Homeflix.db"; DB_PATH = XMLController.getDirHomeFlix() + "/Homeflix.db";
try { try {
// create a database connection // create a database connection
connection = DriverManager.getConnection("jdbc:sqlite:" + DB_PATH); connection = DriverManager.getConnection("jdbc:sqlite:" + DB_PATH);
@ -146,7 +143,7 @@ public class DBController {
* load all sources * load all sources
*/ */
private void loadSources() { private void loadSources() {
SourcesController sourcesController = new SourcesController(main, mainWindowController); SourcesController sourcesController = new SourcesController(mainWindowController);
sourceStreams = sourcesController.loadSources(); sourceStreams = sourcesController.loadSources();
} }
@ -456,7 +453,7 @@ public class DBController {
PreparedStatement ps = connection.prepareStatement("SELECT * FROM cache WHERE streamUrl = ?"); PreparedStatement ps = connection.prepareStatement("SELECT * FROM cache WHERE streamUrl = ?");
ps.setString(1, streamUrl); ps.setString(1, streamUrl);
ResultSet rs = ps.executeQuery(); ResultSet rs = ps.executeQuery();
Font font = Font.font("System", FontWeight.BOLD, (int) Math.round(mainWindowController.getFontSize())); Font font = Font.font("System", FontWeight.BOLD, (int) Math.round(XMLController.getFontSize()));
ObservableList<Node> textFlow = mainWindowController.getTextFlow().getChildren(); ObservableList<Node> textFlow = mainWindowController.getTextFlow().getChildren();
ArrayList<Text> nameText = new ArrayList<Text>(); ArrayList<Text> nameText = new ArrayList<Text>();
@ -513,7 +510,7 @@ public class DBController {
textFlow.addAll(nameText.get(18), new Text(rs.getString("BoxOffice") + "\n")); textFlow.addAll(nameText.get(18), new Text(rs.getString("BoxOffice") + "\n"));
textFlow.addAll(nameText.get(19), new Text(rs.getString("Website") + "\n")); textFlow.addAll(nameText.get(19), new Text(rs.getString("Website") + "\n"));
mainWindowController.getTextFlow().setStyle("-fx-font-size : " + ((int) Math.round(mainWindowController.getFontSize()) + 1) + "px;"); mainWindowController.getTextFlow().setStyle("-fx-font-size : " + ((int) Math.round(XMLController.getFontSize()) + 1) + "px;");
// add the image // add the image
try { try {

View File

@ -1,7 +1,7 @@
/** /**
* Project-HomeFlix * Project-HomeFlix
* *
* Copyright 2018 <@Seil0> * Copyright 2018-2019 <@Seil0>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -19,6 +19,7 @@
* MA 02110-1301, USA. * MA 02110-1301, USA.
* *
*/ */
package kellerkinder.HomeFlix.controller; package kellerkinder.HomeFlix.controller;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
@ -37,14 +38,12 @@ import com.eclipsesource.json.JsonObject;
import com.eclipsesource.json.JsonValue; import com.eclipsesource.json.JsonValue;
import javafx.application.Platform; import javafx.application.Platform;
import kellerkinder.HomeFlix.application.Main;
import kellerkinder.HomeFlix.application.MainWindowController; import kellerkinder.HomeFlix.application.MainWindowController;
import kellerkinder.HomeFlix.datatypes.FilmTabelDataType; import kellerkinder.HomeFlix.datatypes.FilmTabelDataType;
import kellerkinder.HomeFlix.datatypes.OMDbAPIResponseDataType; import kellerkinder.HomeFlix.datatypes.OMDbAPIResponseDataType;
public class OMDbAPIController implements Runnable { public class OMDbAPIController implements Runnable {
private Main main;
private DBController dbController; private DBController dbController;
private FilmTabelDataType currentTableFilm; private FilmTabelDataType currentTableFilm;
private String omdbAPIKey; private String omdbAPIKey;
@ -60,8 +59,7 @@ public class OMDbAPIController implements Runnable {
* @param currentTableFilm the current film object * @param currentTableFilm the current film object
* @param omdbAPIKey the omdbAPI key * @param omdbAPIKey the omdbAPI key
*/ */
public OMDbAPIController(Main main, DBController dbController, FilmTabelDataType currentTableFilm, String omdbAPIKey, boolean refresh) { public OMDbAPIController(DBController dbController, FilmTabelDataType currentTableFilm, String omdbAPIKey, boolean refresh) {
this.main = main;
this.dbController = dbController; this.dbController = dbController;
this.currentTableFilm = currentTableFilm; this.currentTableFilm = currentTableFilm;
this.omdbAPIKey = omdbAPIKey; this.omdbAPIKey = omdbAPIKey;
@ -126,7 +124,7 @@ public class OMDbAPIController implements Runnable {
try { try {
BufferedImage originalImage = ImageIO.read(new URL(object.getString("Poster", ""))); BufferedImage originalImage = ImageIO.read(new URL(object.getString("Poster", "")));
// change path to where file is located // change path to where file is located
omdbResponse.setPoster(main.getPosterCache() + "/" + omdbResponse.getTitle() + ".png"); omdbResponse.setPoster(XMLController.getPosterCache() + "/" + omdbResponse.getTitle() + ".png");
ImageIO.write(originalImage, "png", new File(omdbResponse.getPoster())); ImageIO.write(originalImage, "png", new File(omdbResponse.getPoster()));
LOGGER.info("adding poster to cache: " + omdbResponse.getPoster()); LOGGER.info("adding poster to cache: " + omdbResponse.getPoster());
} catch (Exception e) { } catch (Exception e) {

View File

@ -1,7 +1,7 @@
/** /**
* Project-HomeFlix * Project-HomeFlix
* *
* Copyright 2016-2018 <@Seil0> * Copyright 2016-2019 <@Seil0>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -37,19 +37,16 @@ import com.eclipsesource.json.JsonArray;
import com.eclipsesource.json.JsonObject; import com.eclipsesource.json.JsonObject;
import com.eclipsesource.json.JsonValue; import com.eclipsesource.json.JsonValue;
import kellerkinder.HomeFlix.application.Main;
import kellerkinder.HomeFlix.application.MainWindowController; import kellerkinder.HomeFlix.application.MainWindowController;
import kellerkinder.HomeFlix.datatypes.DatabaseDataType; import kellerkinder.HomeFlix.datatypes.DatabaseDataType;
public class SourcesController { public class SourcesController {
private MainWindowController mainWindowController; private MainWindowController mainWindowController;
private Main main;
private List<DatabaseDataType> sourceStreams = new ArrayList<DatabaseDataType>(); private List<DatabaseDataType> sourceStreams = new ArrayList<DatabaseDataType>();
private static final Logger LOGGER = LogManager.getLogger(SourcesController.class.getName()); private static final Logger LOGGER = LogManager.getLogger(SourcesController.class.getName());
public SourcesController(Main main, MainWindowController mainWindowController) { public SourcesController(MainWindowController mainWindowController) {
this.main = main;
this.mainWindowController = mainWindowController; this.mainWindowController = mainWindowController;
} }
@ -60,7 +57,7 @@ public class SourcesController {
try { try {
// create a JsonArray, containing all sources, add each source to the mwc, get all films from it // create a JsonArray, containing all sources, add each source to the mwc, get all films from it
JsonArray sources = Json.parse(new FileReader(main.getDirectory() + "/sources.json")).asArray(); JsonArray sources = Json.parse(new FileReader(XMLController.getDirHomeFlix() + "/sources.json")).asArray();
for (JsonValue source : sources) { for (JsonValue source : sources) {
String path = source.asObject().getString("path", ""); String path = source.asObject().getString("path", "");
String mode = source.asObject().getString("mode", ""); String mode = source.asObject().getString("mode", "");

View File

@ -1,7 +1,7 @@
/** /**
* Project-HomeFlix * Project-HomeFlix
* *
* Copyright 2018 <@Seil0> * Copyright 2018-2019 <@Seil0>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -18,6 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA. * MA 02110-1301, USA.
*/ */
package kellerkinder.HomeFlix.controller; package kellerkinder.HomeFlix.controller;
import java.io.BufferedReader; import java.io.BufferedReader;

View File

@ -0,0 +1,294 @@
/**
* Project-HomeFlix
*
* Copyright 2016-2019 <@Seil0>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*/
package kellerkinder.HomeFlix.controller;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.util.Properties;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import com.eclipsesource.json.Json;
import com.eclipsesource.json.JsonObject;
public class XMLController {
private static String userHome = System.getProperty("user.home");
private static String userName = System.getProperty("user.name");
private static String osName = System.getProperty("os.name");
private static String osArch = System.getProperty("os.arch");
private static String osVers = System.getProperty("os.version");
private static String javaVers = System.getProperty("java.version");
private static String javaVend = System.getProperty("java.vendor");
private static String sysLocal = System.getProperty("user.language") + "_" + System.getProperty("user.country");
private static String dirHomeFlixPath;
private static File dirHomeFlix;
private static File configFile;
private static File posterCache;
// user settings
private static String color = "ee3523";
private static String usrLocal = sysLocal;
private static boolean autoUpdate = false;
private static boolean useBeta = false;
private static boolean autoplay = false;
private static double fontSize = 17;
// user settings
private static String omdbAPIKey;
private static final Logger LOGGER = LogManager.getLogger(XMLController.class.getName());
private Properties props = new Properties();
/**
* prepare the start up, this is the first thing call by main
*/
public XMLController() {
if (osName.contains("Windows")) {
dirHomeFlixPath = userHome + "/Documents/HomeFlix";
} else {
dirHomeFlixPath = userHome + "/HomeFlix";
}
// set the concrete files
dirHomeFlix = new File(dirHomeFlixPath);
configFile = new File(dirHomeFlix + "/config.xml");
posterCache = new File(dirHomeFlix + "/posterCache");
}
/**
* save the configuration to the config.xml file
*/
public void saveSettings() {
LOGGER.info("saving settings ...");
try {
props.setProperty("color", color);
props.setProperty("autoUpdate", String.valueOf(autoUpdate));
props.setProperty("useBeta", String.valueOf(useBeta));
props.setProperty("autoplay", String.valueOf(autoplay));
props.setProperty("size", Double.toString(fontSize));
props.setProperty("local", usrLocal);
OutputStream outputStream = new FileOutputStream(getConfigFile()); // new output-stream
props.storeToXML(outputStream, "Project HomeFlix settings"); // write new .xml
outputStream.close();
} catch (IOException e) {
LOGGER.error("An error occurred while saving the settings!", e);
}
}
/**
* load the configuration from the config.xml file
* and try to load the API keys from apiKeys.json
*/
public void loadSettings() {
LOGGER.info("loading settings ...");
try {
InputStream inputStream = new FileInputStream(getConfigFile());
props.loadFromXML(inputStream); // new input-stream from .xml
try {
setColor(props.getProperty("color"));
} catch (Exception e) {
LOGGER.error("cloud not load color", e);
setColor("00a8cc");
}
try {
setFontSize(Double.parseDouble(props.getProperty("size")));
} catch (Exception e) {
LOGGER.error("cloud not load fontsize", e);
setFontSize(17.0);
}
try {
setAutoUpdate(Boolean.parseBoolean(props.getProperty("autoUpdate")));
} catch (Exception e) {
LOGGER.error("cloud not load autoUpdate", e);
setAutoUpdate(false);
}
try {
setUseBeta(Boolean.parseBoolean(props.getProperty("useBeta")));
} catch (Exception e) {
LOGGER.error("cloud not load autoUpdate", e);
setUseBeta(false);
}
try {
setAutoplay(Boolean.parseBoolean(props.getProperty("autoplay")));
} catch (Exception e) {
LOGGER.error("cloud not load autoplay", e);
setAutoplay(false);
}
try {
setUsrLocal(props.getProperty("local"));
} catch (Exception e) {
LOGGER.error("cloud not load local", e);
setUsrLocal(System.getProperty("user.language") + "_" + System.getProperty("user.country"));
}
inputStream.close();
} catch (IOException e) {
LOGGER.error("An error occurred while loading the settings!", e);
}
// try loading the omdbAPI key
try {
InputStream in = getClass().getClassLoader().getResourceAsStream("apiKeys.json");
if (in != null) {
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
JsonObject apiKeys = Json.parse(reader).asObject();
setOmdbAPIKey(apiKeys.getString("omdbAPIKey", ""));
reader.close();
in.close();
} else {
LOGGER.warn("Cloud not load apiKeys.json. No such file");
}
} catch (Exception e) {
LOGGER.error("Cloud not load the omdbAPI key. Please contact the developer!", e);
}
}
// getters for application variables
public static String getUserHome() {
return userHome;
}
public static String getUserName() {
return userName;
}
public static String getOsName() {
return osName;
}
public static String getOsArch() {
return osArch;
}
public static String getOsVers() {
return osVers;
}
public static String getJavaVers() {
return javaVers;
}
public static String getJavaVend() {
return javaVend;
}
public static String getSysLocal() {
return sysLocal;
}
public static String getDirHomeFlixPath() {
return dirHomeFlixPath;
}
public static File getDirHomeFlix() {
return dirHomeFlix;
}
public static File getConfigFile() {
return configFile;
}
public static File getPosterCache() {
return posterCache;
}
// getters for user settings
public static String getColor() {
return color;
}
public static void setColor(String color) {
XMLController.color = color;
}
public static String getUsrLocal() {
return usrLocal;
}
public static void setUsrLocal(String usrLocal) {
XMLController.usrLocal = usrLocal;
}
public static boolean isAutoUpdate() {
return autoUpdate;
}
public static void setAutoUpdate(boolean autoUpdate) {
XMLController.autoUpdate = autoUpdate;
}
public static boolean isUseBeta() {
return useBeta;
}
public static void setUseBeta(boolean useBeta) {
XMLController.useBeta = useBeta;
}
public static boolean isAutoplay() {
return autoplay;
}
public static void setAutoplay(boolean autoplay) {
XMLController.autoplay = autoplay;
}
public static double getFontSize() {
return fontSize;
}
public static void setFontSize(double fontSize) {
XMLController.fontSize = fontSize;
}
// getters for APIs
public static String getOmdbAPIKey() {
return omdbAPIKey;
}
private static void setOmdbAPIKey(String omdbAPIKey) {
XMLController.omdbAPIKey = omdbAPIKey;
}
}

View File

@ -1,7 +1,7 @@
/** /**
* Project-HomeFlix * Project-HomeFlix
* *
* Copyright 2016-2018 <@Seil0> * Copyright 2016-2019 <@Seil0>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
/** /**
* Project-HomeFlix * Project-HomeFlix
* *
* Copyright 2016-2018 <@Seil0> * Copyright 2016-2019 <@Seil0>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
/** /**
* Project-HomeFlix * Project-HomeFlix
* *
* Copyright 2018 <@Seil0> * Copyright 2018-2019 <@Seil0>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -19,6 +19,7 @@
* MA 02110-1301, USA. * MA 02110-1301, USA.
* *
*/ */
package kellerkinder.HomeFlix.datatypes; package kellerkinder.HomeFlix.datatypes;
public class OMDbAPIResponseDataType { public class OMDbAPIResponseDataType {

View File

@ -1,7 +1,7 @@
/** /**
* Project-HomeFlix * Project-HomeFlix
* *
* Copyright 2016-2018 <@Seil0> * Copyright 2016-2019 <@Seil0>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
/** /**
* Project-HomeFlix * Project-HomeFlix
* *
* Copyright 2016-2018 <@Seil0> * Copyright 2016-2019 <@Seil0>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -19,6 +19,7 @@
* MA 02110-1301, USA. * MA 02110-1301, USA.
* *
*/ */
package kellerkinder.HomeFlix.player; package kellerkinder.HomeFlix.player;
import javafx.event.EventHandler; import javafx.event.EventHandler;

View File

@ -1,7 +1,7 @@
/** /**
* Project-HomeFlix * Project-HomeFlix
* *
* Copyright 2016-2018 <@Seil0> * Copyright 2016-2019 <@Seil0>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -48,6 +48,7 @@ import javafx.scene.media.MediaPlayer.Status;
import javafx.scene.media.MediaView; import javafx.scene.media.MediaView;
import javafx.util.Duration; import javafx.util.Duration;
import kellerkinder.HomeFlix.application.MainWindowController; import kellerkinder.HomeFlix.application.MainWindowController;
import kellerkinder.HomeFlix.controller.XMLController;
import kellerkinder.HomeFlix.datatypes.FilmTabelDataType; import kellerkinder.HomeFlix.datatypes.FilmTabelDataType;
public class PlayerController { public class PlayerController {
@ -124,7 +125,7 @@ public class PlayerController {
height.bind(Bindings.selectDouble(mediaView.sceneProperty(), "height")); height.bind(Bindings.selectDouble(mediaView.sceneProperty(), "height"));
startTime = mainWCon.getDbController().getCurrentTime(film.getStreamUrl()); startTime = mainWCon.getDbController().getCurrentTime(film.getStreamUrl());
autoplay = mainWCon.isAutoplay(); autoplay = XMLController.isAutoplay();
season = !film.getSeason().isEmpty() ? Integer.parseInt(film.getSeason()) : 0; season = !film.getSeason().isEmpty() ? Integer.parseInt(film.getSeason()) : 0;
episode = !film.getEpisode().isEmpty() ? Integer.parseInt(film.getEpisode()) : 0; episode = !film.getEpisode().isEmpty() ? Integer.parseInt(film.getEpisode()) : 0;

View File

@ -1,7 +1,7 @@
/** /**
* Kellerkinder Framework Alerts * Kellerkinder Framework Alerts
* *
* Copyright 2018 <@Seil0> * Copyright 2018-2019 <@Seil0>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -18,6 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA. * MA 02110-1301, USA.
*/ */
package org.kellerkinder.Alerts; package org.kellerkinder.Alerts;
import com.jfoenix.controls.JFXAlert; import com.jfoenix.controls.JFXAlert;

View File

@ -1,7 +1,7 @@
/** /**
* Kellerkinder Framework Alerts * Kellerkinder Framework Alerts
* *
* Copyright 2018 <@Seil0> * Copyright 2018-2019 <@Seil0>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -18,6 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA. * MA 02110-1301, USA.
*/ */
package org.kellerkinder.Alerts; package org.kellerkinder.Alerts;
import com.jfoenix.controls.JFXAlert; import com.jfoenix.controls.JFXAlert;

View File

@ -32,7 +32,7 @@ columnFavorite = Favorit
#error translations #error translations
vlcNotInstalled = Um einen Film abspielen wird der VLC Media Player ben\u00F6tigt! vlcNotInstalled = Um einen Film abspielen wird der VLC Media Player ben\u00F6tigt!
infoText = \nAutoren: \n \u2022 seil0@mosad.xyz \n \u2022 localhorst@mosad.xyz \n(c) 2016-2018 mosad www.mosad.xyz infoText = \nAutoren: \n \u2022 seil0@mosad.xyz \n \u2022 localhorst@mosad.xyz \n(c) 2016-2019 mosad www.mosad.xyz
#textFlow translations #textFlow translations
title = Titel title = Titel

View File

@ -32,7 +32,7 @@ columnFavorite = Favorite
#error translations #error translations
vlcNotInstalled = VLC Media Player is required to play a movie! vlcNotInstalled = VLC Media Player is required to play a movie!
infoText = \nMaintainers: \n \u2022 seil0@mosad.xyz \n \u2022 localhorst@mosad.xyz \n(c) 2016-2018 mosad www.mosad.xyz infoText = \nMaintainers: \n \u2022 seil0@mosad.xyz \n \u2022 localhorst@mosad.xyz \n(c) 2016-2019 mosad www.mosad.xyz
#textFlow translations #textFlow translations
title = Title title = Title