diff --git a/bin/application/MainWindow.css b/bin/application/MainWindow.css
new file mode 100644
index 0000000..cb1165b
--- /dev/null
+++ b/bin/application/MainWindow.css
@@ -0,0 +1,4 @@
+.jfx-hamburgerW StackPane { -fx-background-color: white;
+ -fx-background-radius: 5px; }
+.jfx-hamburgerB StackPane { -fx-background-color: black;
+ -fx-background-radius: 5px; }
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 29fe370..3cf6b06 100644
--- a/pom.xml
+++ b/pom.xml
@@ -47,6 +47,18 @@
sqlite-jdbc
3.20.0
+
+
+ org.apache.logging.log4j
+ log4j-api
+ 2.9.0
+
+
+
+ org.apache.logging.log4j
+ log4j-core
+ 2.9.0
+
diff --git a/src/main/java/org/kellerkinder/Project_HomeFlix/DBController.java b/src/main/java/org/kellerkinder/Project_HomeFlix/DBController.java
index 6d9a943..439f1ad 100644
--- a/src/main/java/org/kellerkinder/Project_HomeFlix/DBController.java
+++ b/src/main/java/org/kellerkinder/Project_HomeFlix/DBController.java
@@ -129,8 +129,8 @@ public class DBController {
}
//getting all entries from the streaming lists
- for(int v=0; v< mainWindowController.streamingData.size(); v++){
- String fileName = mainWindowController.getStreamingPath()+"/"+mainWindowController.streamingData.get(v).getStreamUrl();
+ for(int v=0; v< mainWindowController.getStreamingData().size(); v++){
+ String fileName = mainWindowController.getStreamingPath()+"/"+mainWindowController.getStreamingData().get(v).getStreamUrl();
try {
JsonObject object = Json.parse(new FileReader(fileName)).asObject();
JsonArray items = object.get("entries").asArray();
@@ -181,8 +181,8 @@ public class DBController {
if(mainWindowController.getStreamingPath().equals("")||mainWindowController.getStreamingPath().equals(null)){
System.out.println("Kein Pfad angegeben"); //if path == null or ""
}else{
- for(int i=0; i< mainWindowController.streamingData.size(); i++){
- String fileNamea = mainWindowController.getStreamingPath()+"/"+mainWindowController.streamingData.get(i).getStreamUrl();
+ for(int i=0; i< mainWindowController.getStreamingData().size(); i++){
+ String fileNamea = mainWindowController.getStreamingPath()+"/"+mainWindowController.getStreamingData().get(i).getStreamUrl();
try {
JsonObject object = Json.parse(new FileReader(fileNamea)).asObject();
JsonArray items = object.get("entries").asArray();
@@ -246,9 +246,9 @@ public class DBController {
ResultSet rs = stmt.executeQuery("SELECT * FROM film_local ORDER BY titel");
while (rs.next()) {
if(rs.getString(4).equals("favorite_black")){
- mainWindowController.localFilms.add( new tableData(1, 1, 1, rs.getDouble(1), "1", rs.getString(2), rs.getString(3), new ImageView(favorite_black),rs.getBoolean(5)));
+ mainWindowController.getLocalFilms().add( new tableData(1, 1, 1, rs.getDouble(1), "1", rs.getString(2), rs.getString(3), new ImageView(favorite_black),rs.getBoolean(5)));
}else{
- mainWindowController.localFilms.add( new tableData(1, 1, 1, rs.getDouble(1), "1", rs.getString(2), rs.getString(3), new ImageView(favorite_border_black),rs.getBoolean(5)));
+ mainWindowController.getLocalFilms().add( new tableData(1, 1, 1, rs.getDouble(1), "1", rs.getString(2), rs.getString(3), new ImageView(favorite_border_black),rs.getBoolean(5)));
}
}
stmt.close();
@@ -258,9 +258,9 @@ public class DBController {
rs = stmt.executeQuery("SELECT * FROM film_streaming ORDER BY titel;");
while (rs.next()) {
if(rs.getString(8).equals("favorite_black")){
- mainWindowController.streamingFilms.add(new tableData(rs.getInt(1), rs.getInt(2), rs.getInt(3), rs.getDouble(4), rs.getString(5), rs.getString(6), rs.getString(7), new ImageView(favorite_black),rs.getBoolean(9)));
+ mainWindowController.getStreamingFilms().add(new tableData(rs.getInt(1), rs.getInt(2), rs.getInt(3), rs.getDouble(4), rs.getString(5), rs.getString(6), rs.getString(7), new ImageView(favorite_black),rs.getBoolean(9)));
}else{
- mainWindowController.streamingFilms.add(new tableData(rs.getInt(1), rs.getInt(2), rs.getInt(3), rs.getDouble(4), rs.getString(5), rs.getString(6), rs.getString(7), new ImageView(favorite_border_black),rs.getBoolean(9)));
+ mainWindowController.getStreamingFilms().add(new tableData(rs.getInt(1), rs.getInt(2), rs.getInt(3), rs.getDouble(4), rs.getString(5), rs.getString(6), rs.getString(7), new ImageView(favorite_border_black),rs.getBoolean(9)));
}
}
stmt.close();
@@ -282,9 +282,9 @@ public class DBController {
stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM film_local WHERE titel = \""+name+"\";" );
if(rs.getString(4).equals("favorite_black")){
- mainWindowController.localFilms.set(i, new tableData(1, 1, 1, rs.getDouble(1), "1", rs.getString(2), rs.getString(3), new ImageView(favorite_black),rs.getBoolean(5)));
+ mainWindowController.getLocalFilms().set(i, new tableData(1, 1, 1, rs.getDouble(1), "1", rs.getString(2), rs.getString(3), new ImageView(favorite_black),rs.getBoolean(5)));
}else{
- mainWindowController.localFilms.set(i, new tableData(1, 1, 1, rs.getDouble(1), "1", rs.getString(2), rs.getString(3), new ImageView(favorite_border_black),rs.getBoolean(5)));
+ mainWindowController.getLocalFilms().set(i, new tableData(1, 1, 1, rs.getDouble(1), "1", rs.getString(2), rs.getString(3), new ImageView(favorite_border_black),rs.getBoolean(5)));
}
stmt.close();
rs.close();
@@ -293,9 +293,9 @@ public class DBController {
stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM film_streaming WHERE titel = \""+name+"\";" );
if(rs.getString(8).equals("favorite_black")){
- mainWindowController.streamingFilms.set(i,new tableData(rs.getInt(1), rs.getInt(2), rs.getInt(3), rs.getDouble(4), rs.getString(5), rs.getString(6), rs.getString(7), new ImageView(favorite_black),rs.getBoolean(9)));
+ mainWindowController.getStreamingFilms().set(i,new tableData(rs.getInt(1), rs.getInt(2), rs.getInt(3), rs.getDouble(4), rs.getString(5), rs.getString(6), rs.getString(7), new ImageView(favorite_black),rs.getBoolean(9)));
}else{
- mainWindowController.streamingFilms.set(i,new tableData(rs.getInt(1), rs.getInt(2), rs.getInt(3), rs.getDouble(4), rs.getString(5), rs.getString(6), rs.getString(7), new ImageView(favorite_border_black),rs.getBoolean(9)));
+ mainWindowController.getStreamingFilms().set(i,new tableData(rs.getInt(1), rs.getInt(2), rs.getInt(3), rs.getDouble(4), rs.getString(5), rs.getString(6), rs.getString(7), new ImageView(favorite_border_black),rs.getBoolean(9)));
}
stmt.close();
rs.close();
diff --git a/src/main/java/org/kellerkinder/Project_HomeFlix/Main.java b/src/main/java/org/kellerkinder/Project_HomeFlix/Main.java
index 57d56b4..d3a8d30 100644
--- a/src/main/java/org/kellerkinder/Project_HomeFlix/Main.java
+++ b/src/main/java/org/kellerkinder/Project_HomeFlix/Main.java
@@ -27,6 +27,10 @@ import java.io.IOException;
import java.util.Locale;
import java.util.Optional;
import java.util.ResourceBundle;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
@@ -56,6 +60,7 @@ public class Main extends Application {
private File posterCache;
private String dirWin = System.getProperty("user.home") + "/Documents/HomeFlix"; //Windows: C:/Users/"User"/Documents/HomeFlix
private String dirLinux = System.getProperty("user.home") + "/HomeFlix"; //Linux: /home/"User"/HomeFlix
+ private static Logger LOGGER;
@Override
public void start(Stage primaryStage) throws IOException {
@@ -67,73 +72,77 @@ public class Main extends Application {
private void mainWindow(){
try {
- FXMLLoader loader = new FXMLLoader();
- loader.setLocation(ClassLoader.getSystemResource("fxml/MainWindow.fxml"));
- AnchorPane pane = (AnchorPane) loader.load();
- primaryStage.setMinHeight(600.00);
- primaryStage.setMinWidth(900.00);
- primaryStage.setResizable(false);
- primaryStage.setTitle("Project HomeFlix");
- primaryStage.getIcons().add(new Image(Main.class.getResourceAsStream("/icons/Homeflix_Icon_64x64.png"))); //adds application icon
-
- mainWindowController = loader.getController(); //Link of FXMLController and controller class
- mainWindowController.setAutoUpdate(AUTO_UPDATE); //set auto-update
- mainWindowController.setCurrentWorkingDirectory(currentWorkingDirectory);
- mainWindowController.setMain(this); //call setMain
-
- /**Linux else Windows, check if directory & config exist
- * Windows: config file: C:/Users/"User"/Documents/HomeFlix/config.xml
- * directory: C:/Users/"User"/Documents/HomeFlix
- * Linux: config file: /home/"User"/HomeFlix/config.xml
- * directory: /home/"User"/HomeFlix
- */
- if(System.getProperty("os.name").equals("Linux")) {
- directory = new File(dirLinux);
- settingsFile = new File(dirLinux + "/config.xml");
- } else {
- directory = new File(dirWin);
- settingsFile = new File(dirWin + "/config.xml");
- }
-
- posterCache = new File(directory+"/posterCache");
-
- if(!settingsFile.exists()){
- directory.mkdir();
- mainWindowController.setPath(firstStart());
- mainWindowController.setStreamingPath(directory.getAbsolutePath());
- mainWindowController.setColor(COLOR);
- mainWindowController.setSize(FONT_SIZE);
- mainWindowController.setAutoUpdate(AUTO_UPDATE);
- mainWindowController.setLocal(local);
- mainWindowController.setMode(mode);
- mainWindowController.saveSettings();
- Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //start again (preventing Bugs)
- System.exit(0); //finishes it self
- }
-
- if(!posterCache.exists()) {
- posterCache.mkdir();
- }
-
- mainWindowController.loadSettings();
- mainWindowController.loadStreamingSettings();
- mainWindowController.initUI();
- mainWindowController.initActions();
- mainWindowController.initTabel();
- mainWindowController.setLocalUI();
- mainWindowController.applyColor(); //set theme color
-
- mainWindowController.dbController.main(); //initialize database controller
- mainWindowController.dbController.createDatabase(); //creating the database
- mainWindowController.dbController.loadData(); //loading data from database to mainWindowController
- mainWindowController.addDataUI();
-
- Scene scene = new Scene(pane); //create new scene, append pane to scene
- scene.getStylesheets().add(getClass().getResource("/css/MainWindow.css").toExternalForm());
- primaryStage.setScene(scene); //append scene to stage
- primaryStage.show(); //show stage
+ FXMLLoader loader = new FXMLLoader();
+ loader.setLocation(ClassLoader.getSystemResource("fxml/MainWindow.fxml"));
+ AnchorPane pane = (AnchorPane) loader.load();
+ primaryStage.setMinHeight(600.00);
+ primaryStage.setMinWidth(900.00);
+ primaryStage.setResizable(false);
+ primaryStage.setTitle("Project HomeFlix");
+ primaryStage.getIcons().add(new Image(Main.class.getResourceAsStream("/icons/Homeflix_Icon_64x64.png"))); //adds application icon
+
+ mainWindowController = loader.getController(); //Link of FXMLController and controller class
+ mainWindowController.setAutoUpdate(AUTO_UPDATE); //set auto-update
+ mainWindowController.setCurrentWorkingDirectory(currentWorkingDirectory);
+ mainWindowController.setMain(this); //call setMain
+
+ /**Linux else Windows, check if directory & config exist
+ * Windows: config file: C:/Users/"User"/Documents/HomeFlix/config.xml
+ * directory: C:/Users/"User"/Documents/HomeFlix
+ * Linux: config file: /home/"User"/HomeFlix/config.xml
+ * directory: /home/"User"/HomeFlix
+ */
+ if(System.getProperty("os.name").equals("Linux")) {
+ directory = new File(dirLinux);
+ settingsFile = new File(dirLinux + "/config.xml");
+ } else {
+ directory = new File(dirWin);
+ settingsFile = new File(dirWin + "/config.xml");
+ }
+
+ posterCache = new File(directory+"/posterCache");
+
+ if(!settingsFile.exists()){
+ directory.mkdir();
+ mainWindowController.setPath(firstStart());
+ mainWindowController.setStreamingPath(directory.getAbsolutePath());
+ mainWindowController.setColor(COLOR);
+ mainWindowController.setSize(FONT_SIZE);
+ mainWindowController.setAutoUpdate(AUTO_UPDATE);
+ mainWindowController.setLocal(local);
+ mainWindowController.setMode(mode);
+ mainWindowController.saveSettings();
+ try {
+ Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //start again (preventing Bugs)
+ System.exit(0); //finishes it self
+ } catch (Exception e) {
+ LOGGER.error("error while restarting HomeFlix", e);
+ }
+ }
+
+ if(!posterCache.exists()) {
+ posterCache.mkdir();
+ }
+
+ mainWindowController.loadSettings();
+ mainWindowController.loadStreamingSettings();
+ mainWindowController.initUI();
+ mainWindowController.initActions();
+ mainWindowController.initTabel();
+ mainWindowController.setLocalUI();
+ mainWindowController.applyColor(); //set theme color
+
+ mainWindowController.dbController.main(); //initialize database controller
+ mainWindowController.dbController.createDatabase(); //creating the database
+ mainWindowController.dbController.loadData(); //loading data from database to mainWindowController
+ mainWindowController.addDataUI();
+
+ Scene scene = new Scene(pane); //create new scene, append pane to scene
+ scene.getStylesheets().add(getClass().getResource("/css/MainWindow.css").toExternalForm());
+ primaryStage.setScene(scene); //append scene to stage
+ primaryStage.show(); //show stage
} catch (IOException e) {
- e.printStackTrace();
+ LOGGER.error("", e);
}
}
@@ -168,6 +177,16 @@ public class Main extends Application {
}
public static void main(String[] args) {
+ if(System.getProperty("os.name").equals("Linux")){
+ System.setProperty("logFilename", System.getProperty("user.home") + "/HomeFlix/app.log");
+ File logFile = new File(System.getProperty("user.home") + "/HomeFlix/app.log");
+ logFile.delete();
+ }else{
+ System.setProperty("logFilename", System.getProperty("user.home") + "/Documents/HomeFlix/app.log");
+ File logFile = new File(System.getProperty("user.home") + "/Documents/HomeFlix/app.log");
+ logFile.delete();
+ }
+ LOGGER = LogManager.getLogger(Main.class.getName());
launch(args);
}
diff --git a/src/main/java/org/kellerkinder/Project_HomeFlix/MainWindowController.java b/src/main/java/org/kellerkinder/Project_HomeFlix/MainWindowController.java
index e8caaaf..06260df 100644
--- a/src/main/java/org/kellerkinder/Project_HomeFlix/MainWindowController.java
+++ b/src/main/java/org/kellerkinder/Project_HomeFlix/MainWindowController.java
@@ -40,6 +40,10 @@ import java.util.ArrayList;
import java.util.Locale;
import java.util.Properties;
import java.util.ResourceBundle;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
import com.jfoenix.controls.JFXButton;
import com.jfoenix.controls.JFXColorPicker;
import com.jfoenix.controls.JFXHamburger;
@@ -191,7 +195,8 @@ public class MainWindowController {
private boolean streamingSettingsTrue = false;
private boolean autoUpdate = false;
static boolean firststart = false;
- private int hashA = -2055934614;
+ private static final Logger LOGGER = LogManager.getLogger(MainWindowController.class.getName());
+ private int hashA = -647380320;
private String version = "0.5.2";
private String buildNumber = "129";
private String versionName = "solidify cow";
@@ -217,7 +222,6 @@ public class MainWindowController {
private String name;
private String datPath;
private String mode;
- @SuppressWarnings("unused")
private String ratingSortType;
private String local;
String title;
@@ -246,9 +250,9 @@ public class MainWindowController {
private ObservableList filterData = FXCollections.observableArrayList();
private ObservableList locals = FXCollections.observableArrayList("English (en_US)", "Deutsch (de_DE)");
- ObservableList localFilms = FXCollections.observableArrayList();
- ObservableList streamingFilms = FXCollections.observableArrayList();
- ObservableList streamingData = FXCollections.observableArrayList();
+ private ObservableList localFilms = FXCollections.observableArrayList();
+ private ObservableList streamingFilms = FXCollections.observableArrayList();
+ private ObservableList streamingData = FXCollections.observableArrayList();
private ImageView skip_previous_white = new ImageView(new Image("icons/ic_skip_previous_white_18dp_1x.png"));
private ImageView skip_previous_black = new ImageView(new Image("icons/ic_skip_previous_black_18dp_1x.png"));
private ImageView skip_next_white = new ImageView(new Image("icons/ic_skip_next_white_18dp_1x.png"));
@@ -279,11 +283,11 @@ public class MainWindowController {
}
}).start();
} else {
- System.out.println("Desktop not supported");
+ LOGGER.info("Desktop not supported");
}
}else if (mode.equals("local")) {
if(System.getProperty("os.name").contains("Linux")){
- System.out.println("This is "+System.getProperty("os.name"));
+ LOGGER.info("This is "+System.getProperty("os.name"));
String line;
String output = "";
Process p;
@@ -437,8 +441,7 @@ public class MainWindowController {
Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //start again
System.exit(0); //finishes itself
} catch (IOException e) {
- System.out.println("es ist ein Fehler aufgetreten");
- e.printStackTrace();
+ LOGGER.error("error while restarting HomeFlix", e);
}
}
}
@@ -475,7 +478,7 @@ public class MainWindowController {
private void streamingDirectoryBtnAction(){
selectedStreamingFolder = directoryChooser.showDialog(null);
if(selectedStreamingFolder == null){
- System.out.println("No Directory selected");
+ LOGGER.warn("No Directory selected");
}else{
setStreamingPath(selectedStreamingFolder.getAbsolutePath());
saveSettings();
@@ -484,8 +487,7 @@ public class MainWindowController {
Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //start again
System.exit(0); //finishes itself
} catch (IOException e) {
- System.out.println("es ist ein Fehler aufgetreten");
- e.printStackTrace();
+ LOGGER.error("error while restarting HomeFlix", e);
}
}
}
@@ -548,7 +550,7 @@ public class MainWindowController {
if(mode.equals("local")){
if(localFilms.get(selected).getCached()==true){
- System.out.println("loading from cache: "+name);
+ LOGGER.info("loading from cache: "+name);
dbController.readCache(datPath);
}else{
ApiQuery.startQuery(name,datPath); // start api query
@@ -556,7 +558,7 @@ public class MainWindowController {
}else{
System.out.println(streamingFilms.size());
if(streamingFilms.get(selected).getCached()==true){
- System.out.println("loading from cache: "+name);
+ LOGGER.info("loading from cache: "+name);
dbController.readCache(datPath);
}else{
ApiQuery.startQuery(name,datPath); // start api query
@@ -628,7 +630,7 @@ public class MainWindowController {
for(int i = 0; i < filterData.size(); i++){
root.getChildren().add(new TreeItem(filterData.get(i))); //add filtered data to root node after search
}
- if(tfsearch.getText().hashCode() == hashA){
+ if(tfsearch.getText().hashCode()== hashA){
setColor("000000");
applyColor();
}
@@ -672,11 +674,7 @@ public class MainWindowController {
try {
dbController.refresh(name, selected);
} catch (SQLException e) {
- Alert alert = new Alert(AlertType.ERROR);
- alert.setTitle("Error");
- alert.setHeaderText("");
- alert.setContentText("There should be an error message in future (like-problem).\nIt seems as a cat has stolen the \"like-methode\"!");
- e.printStackTrace();
+ LOGGER.error("(like-problem), it seems as a cat has stolen the \"like-methode\"!", e);
}
refreshTable();
}
@@ -710,7 +708,7 @@ public class MainWindowController {
columnRating.sortTypeProperty().addListener(new ChangeListener() {
@Override
public void changed(ObservableValue extends SortType> paramObservableValue, SortType paramT1, SortType paramT2) {
- System.out.println("NAME Clicked -- sortType = " + paramT1 + ", SortType=" + paramT2);
+ LOGGER.info("NAME Clicked -- sortType = " + paramT1 + ", SortType=" + paramT2);
ArrayList fav_true = new ArrayList();
ArrayList fav_false = new ArrayList();
ObservableList helpData;
@@ -733,7 +731,7 @@ public class MainWindowController {
}
}
if(paramT2.toString().equals("DESCENDING")){
- System.out.println("Absteigend");
+ LOGGER.info("Absteigend"); //Debug, delete?
for(int i = 0;i(filterData.get(i))); //add filtered data to root node after search
@@ -760,7 +758,7 @@ public class MainWindowController {
//initialize UI elements
void initUI(){
- System.out.println("Mode: "+mode); //TODO debugging
+ LOGGER.info("Mode: "+mode); //TODO debugging
debugBtn.setDisable(true); //debugging button for tests
debugBtn.setVisible(false);
@@ -1037,7 +1035,7 @@ public class MainWindowController {
//saves the Settings
public void saveSettings(){
- System.out.println("saving settings ...");
+ LOGGER.info("saving settings ...");
OutputStream outputStream; //new output-stream
try {
props.setProperty("path", getPath()); //writes path into property
@@ -1065,7 +1063,7 @@ public class MainWindowController {
//loads the Settings
public void loadSettings(){
- System.out.println("loading settings ...");
+ LOGGER.info("loading settings ...");
InputStream inputStream;
try {
if(System.getProperty("os.name").equals("Linux")){
@@ -1074,31 +1072,79 @@ public class MainWindowController {
inputStream = new FileInputStream(fileWin);
}
props.loadFromXML(inputStream); //new input-stream from .xml
- path = props.getProperty("path"); //read path from property
- streamingPath = props.getProperty("streamingPath");
- color = props.getProperty("color");
- size = Double.parseDouble(props.getProperty("size"));
- autoUpdate = Boolean.parseBoolean(props.getProperty("autoUpdate"));
- local = props.getProperty("local");
- ratingSortType = props.getProperty("ratingSortType");
- switch (props.getProperty("mode")) {
- case "local":
- mode = "local";
- break;
- case "streaming":
- mode = "streaming";
- break;
- default:
- mode = "local";
- break;
+ try {
+ setPath(props.getProperty("path")); //read path from property
+ } catch (Exception e) {
+ LOGGER.error("cloud not load path", e);
+ setPath("");
}
+ try {
+ setStreamingPath(props.getProperty("streamingPath"));
+ } catch (Exception e) {
+ LOGGER.error("cloud not load streamingPath", e);
+ setStreamingPath("");
+ }
+
+ try {
+ setColor(props.getProperty("color"));
+ } catch (Exception e) {
+ LOGGER.error("cloud not load color", e);
+ setColor("");
+ }
+
+ try {
+ setSize( Double.parseDouble(props.getProperty("size")));
+ } catch (Exception e) {
+ LOGGER.error("cloud not load fontsize", e);
+ setSize(17.0);
+ }
+
+ try {
+ setAutoUpdate(Boolean.parseBoolean(props.getProperty("autoUpdate")));
+ } catch (Exception e) {
+ LOGGER.error("cloud not load autoUpdate", e);
+ setAutoUpdate(false);
+ }
+
+ try {
+ setLocal(props.getProperty("local"));
+ } catch (Exception e) {
+ LOGGER.error("cloud not load local", e);
+ setLocal(System.getProperty("user.language")+"_"+System.getProperty("user.country"));
+ }
+
+ try {
+ setRatingSortType(props.getProperty("ratingSortType"));
+ } catch (Exception e) {
+ LOGGER.error("cloud not load autoUpdate", e);
+ setRatingSortType("");
+ }
+
+ try {
+ switch (props.getProperty("mode")) {
+ case "local":
+ setMode("local");
+ break;
+ case "streaming":
+ setMode("streaming");
+ break;
+ default:
+ setMode("local");
+ break;
+ }
+ } catch (Exception e) {
+ setMode("local");
+ LOGGER.error("cloud not load mode", e);
+ }
+
+
inputStream.close();
} catch (IOException e) {
if(firststart == false){
+ LOGGER.error("faild to load settings", e);
showErrorMsg(errorSave, e);
- e.printStackTrace();
}
// showErrorMsg(errorLoad, e); //TODO This should not be visible at first startup
}
@@ -1176,4 +1222,36 @@ public class MainWindowController {
public void setCurrentWorkingDirectory(String currentWorkingDirectory) {
this.currentWorkingDirectory = currentWorkingDirectory;
}
+
+ public ObservableList getLocalFilms() {
+ return localFilms;
+ }
+
+ public void setLocalFilms(ObservableList localFilms) {
+ this.localFilms = localFilms;
+ }
+
+ public ObservableList getStreamingFilms() {
+ return streamingFilms;
+ }
+
+ public void setStreamingFilms(ObservableList streamingFilms) {
+ this.streamingFilms = streamingFilms;
+ }
+
+ public ObservableList getStreamingData() {
+ return streamingData;
+ }
+
+ public void setStreamingData(ObservableList streamingData) {
+ this.streamingData = streamingData;
+ }
+
+ public String getRatingSortType() {
+ return ratingSortType;
+ }
+
+ public void setRatingSortType(String ratingSortType) {
+ this.ratingSortType = ratingSortType;
+ }
}
diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml
new file mode 100644
index 0000000..b3ad7b2
--- /dev/null
+++ b/src/main/resources/log4j2.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+