diff --git a/.classpath b/.classpath
index 75e14fc..e83910a 100644
--- a/.classpath
+++ b/.classpath
@@ -12,7 +12,7 @@
-
+
@@ -22,10 +22,6 @@
-
-
-
-
-
+
diff --git a/src/main/java/kellerkinder/HomeFlix/application/Main.java b/src/main/java/kellerkinder/HomeFlix/application/Main.java
index df4048c..b99bb70 100644
--- a/src/main/java/kellerkinder/HomeFlix/application/Main.java
+++ b/src/main/java/kellerkinder/HomeFlix/application/Main.java
@@ -107,8 +107,7 @@ public class Main extends Application {
// startup checks
if (!configFile.exists()) {
directory.mkdir();
- mainWindowController.setPath(firstStart());
- mainWindowController.setStreamingPath(directory.getAbsolutePath());
+ mainWindowController.addSource(firstStart(), "local");
mainWindowController.setColor("ee3523");
mainWindowController.setSize(FONT_SIZE);
mainWindowController.setAutoUpdate(false);
@@ -143,14 +142,17 @@ public class Main extends Application {
// Method for first Start
private String firstStart(){
- switch(System.getProperty("user.language")+"_"+System.getProperty("user.country")){
- case "en_US": bundle = ResourceBundle.getBundle("locals.HomeFlix-Local", Locale.US); //us_english
- break;
- case "de_DE": bundle = ResourceBundle.getBundle("locals.HomeFlix-Local", Locale.GERMAN); //German
- break;
- default: bundle = ResourceBundle.getBundle("locals.HomeFlix-Local", Locale.US); //default local
- break;
- }
+ switch (System.getProperty("user.language") + "_" + System.getProperty("user.country")) {
+ case "en_US":
+ bundle = ResourceBundle.getBundle("locals.HomeFlix-Local", Locale.US); // us_english
+ break;
+ case "de_DE":
+ bundle = ResourceBundle.getBundle("locals.HomeFlix-Local", Locale.GERMAN); // German
+ break;
+ default:
+ bundle = ResourceBundle.getBundle("locals.HomeFlix-Local", Locale.US); // default local
+ break;
+ }
Alert alert = new Alert(AlertType.CONFIRMATION); //new alert with file-chooser
alert.setTitle("Project HomeFlix");
diff --git a/src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java b/src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java
index 9a2bc43..4a2c61e 100644
--- a/src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java
+++ b/src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java
@@ -27,12 +27,15 @@ import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
+import java.io.Writer;
import java.math.BigInteger;
import java.net.URI;
import java.net.URISyntaxException;
@@ -46,6 +49,9 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import com.cemu_UI.uiElements.JFXInfoDialog;
+import com.eclipsesource.json.Json;
+import com.eclipsesource.json.JsonArray;
+import com.eclipsesource.json.JsonObject;
import com.jfoenix.controls.JFXButton;
import com.jfoenix.controls.JFXColorPicker;
import com.jfoenix.controls.JFXHamburger;
@@ -54,8 +60,6 @@ import com.jfoenix.controls.JFXTextField;
import com.jfoenix.controls.JFXToggleButton;
import com.jfoenix.transitions.hamburger.HamburgerBackArrowBasicTransition;
-import javafx.animation.FadeTransition;
-import javafx.animation.ParallelTransition;
import javafx.animation.TranslateTransition;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
@@ -90,6 +94,7 @@ import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.scene.text.TextFlow;
import javafx.stage.DirectoryChooser;
+import javafx.stage.FileChooser;
import javafx.util.Duration;
import kellerkinder.HomeFlix.controller.DBController;
import kellerkinder.HomeFlix.controller.UpdateController;
@@ -101,9 +106,6 @@ public class MainWindowController {
@FXML
private AnchorPane mainAnchorPane;
- @FXML
- private AnchorPane streamingSettingsAnchorPane;
-
@FXML
private ScrollPane settingsScrollPane;
@@ -120,8 +122,8 @@ public class MainWindowController {
private TreeTableView treeTableViewfilm;
@FXML
- private TableView tableViewStreamingdata;
-
+ private TableView sourcesTable;
+
@FXML
private TextFlow textFlow;
@@ -143,9 +145,6 @@ public class MainWindowController {
@FXML
private JFXButton settingsBtn;
- @FXML
- private JFXButton streamingSettingsBtn;
-
@FXML
private JFXButton switchBtn;
@@ -156,10 +155,10 @@ public class MainWindowController {
public JFXButton updateBtn;
@FXML
- private JFXButton directoryBtn;
+ private JFXButton addDirectoryBtn;
@FXML
- private JFXButton streamingDirectoryBtn;
+ private JFXButton addStreamSourceBtn;
@FXML
private JFXHamburger menuHam;
@@ -167,12 +166,6 @@ public class MainWindowController {
@FXML
private JFXToggleButton autoUpdateToggleBtn;
- @FXML
- public JFXTextField filmDirTextField;
-
- @FXML
- public JFXTextField streamingPathTextField;
-
@FXML
private JFXTextField searchTextField;
@@ -191,9 +184,6 @@ public class MainWindowController {
@FXML
private Label homeflixSettingsLbl;
- @FXML
- private Label filmDirectoryLbl;
-
@FXML
private Label mainColorLbl;
@@ -208,6 +198,9 @@ public class MainWindowController {
@FXML
private Label branchLbl;
+
+ @FXML
+ private Label sourcesLbl;
@FXML
private Label versionLbl;
@@ -218,7 +211,7 @@ public class MainWindowController {
private ImageView imv1;
@FXML
- TreeItem root = new TreeItem<>(new tableData(1, 1, 1, 5.0, "1", "filme", "1", imv1, false));
+ public TreeItem root = new TreeItem<>(new tableData(1, 1, 1, 5.0, "1", "filme", "1", imv1, false));
@FXML
TreeTableColumn columnRating = new TreeTableColumn<>("Rating");
@FXML
@@ -235,15 +228,14 @@ public class MainWindowController {
TreeTableColumn columnEpisode = new TreeTableColumn<>("Episode");
@FXML
- private TreeItem streamingRoot =new TreeItem<>(new tableData(1 ,1 ,1 ,1.0 ,"1" ,"filme" ,"1", imv1, false));
+ public TreeItem streamingRoot =new TreeItem<>(new tableData(1 ,1 ,1 ,1.0 ,"1" ,"filme" ,"1", imv1, false)); // TODO make private
@FXML
- private TableColumn dataNameColumn = new TableColumn<>("Datei Name");
+ private TableColumn sourceColumn;
@FXML
- private TableColumn dataNameEndColumn = new TableColumn<>("Datei Name mit Endung");
+ private TableColumn modeColumn;
private boolean menuTrue = false;
private boolean settingsTrue = false;
- private boolean streamingSettingsTrue = false;
private boolean autoUpdate = false;
private boolean useBeta = false;
private static final Logger LOGGER = LogManager.getLogger(MainWindowController.class.getName());
@@ -262,7 +254,6 @@ public class MainWindowController {
private String errorSave;
private String infoText;
private String vlcNotInstalled;
- private String path;
private String streamingPath;
private String color;
private String name;
@@ -275,8 +266,6 @@ public class MainWindowController {
private int last;
private int selected;
private int next;
- private File selectedFolder;
- private File selectedStreamingFolder;
private ResourceBundle bundle;
private ObservableList filterData = FXCollections.observableArrayList();
@@ -284,7 +273,7 @@ public class MainWindowController {
private ObservableList branches = FXCollections.observableArrayList("stable", "beta");
private ObservableList localFilms = FXCollections.observableArrayList();
private ObservableList streamingFilms = FXCollections.observableArrayList();
- private ObservableList streamingData = FXCollections.observableArrayList();
+ private ObservableList sourcesList = 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"));
@@ -313,11 +302,10 @@ public class MainWindowController {
void init() {
loadSettings();
- loadStreamingSettings();
checkAutoUpdate();
initTabel();
initActions();
- initUI();
+ initUI();
}
//Initialize the tables (treeTableViewfilm and tableViewStreamingdata)
@@ -327,8 +315,6 @@ public class MainWindowController {
columnRating.setMaxWidth(80);
columnTitel.setMaxWidth(260);
columnStreamUrl.setMaxWidth(0);
- dataNameColumn.setPrefWidth(150);
- dataNameEndColumn.setPrefWidth(220);
columnRating.setStyle("-fx-alignment: CENTER;");
treeTableViewfilm.setRoot(root);
@@ -353,119 +339,80 @@ public class MainWindowController {
treeTableViewfilm.getColumns().add(columnSeason);
treeTableViewfilm.getColumns().add(columnEpisode);
treeTableViewfilm.getColumns().get(2).setVisible(false); //hide columnStreamUrl (column with file URL, important for opening a file/stream)
-
- //Change-listener for treeTableViewfilm
- treeTableViewfilm.getSelectionModel().selectedItemProperty().addListener(new ChangeListener