diff --git a/bin/application/DBController.class b/bin/application/DBController.class index 84109e8..5f9d28e 100644 Binary files a/bin/application/DBController.class and b/bin/application/DBController.class differ diff --git a/bin/application/Main.class b/bin/application/Main.class index 3645d59..60e6aa7 100644 Binary files a/bin/application/Main.class and b/bin/application/Main.class differ diff --git a/bin/application/MainWindowController$1.class b/bin/application/MainWindowController$1.class index 69a2131..4f1de68 100644 Binary files a/bin/application/MainWindowController$1.class and b/bin/application/MainWindowController$1.class differ diff --git a/bin/application/MainWindowController$2.class b/bin/application/MainWindowController$2.class index 6456f45..817f200 100644 Binary files a/bin/application/MainWindowController$2.class and b/bin/application/MainWindowController$2.class differ diff --git a/bin/application/MainWindowController$3.class b/bin/application/MainWindowController$3.class index 065ee4a..e001ad4 100644 Binary files a/bin/application/MainWindowController$3.class and b/bin/application/MainWindowController$3.class differ diff --git a/bin/application/MainWindowController$4.class b/bin/application/MainWindowController$4.class index c0c99b0..8ddea87 100644 Binary files a/bin/application/MainWindowController$4.class and b/bin/application/MainWindowController$4.class differ diff --git a/bin/application/MainWindowController$5.class b/bin/application/MainWindowController$5.class new file mode 100644 index 0000000..09ad93f Binary files /dev/null and b/bin/application/MainWindowController$5.class differ diff --git a/bin/application/MainWindowController$6.class b/bin/application/MainWindowController$6.class new file mode 100644 index 0000000..7a2dbac Binary files /dev/null and b/bin/application/MainWindowController$6.class differ diff --git a/bin/application/MainWindowController.class b/bin/application/MainWindowController.class index 609d3c2..4436699 100644 Binary files a/bin/application/MainWindowController.class and b/bin/application/MainWindowController.class differ diff --git a/src/application/DBController.java b/src/application/DBController.java index 1268921..eb64331 100644 --- a/src/application/DBController.java +++ b/src/application/DBController.java @@ -1,27 +1,28 @@ /** * DBController for Project HomeFlix - * * connection is in manual commit! + * TODO überprüfen ob neue filme hinzu gekommen sind */ package application; -import java.sql.Connection; //für Datenbank -import java.sql.DriverManager; //für Datenbank -import java.sql.PreparedStatement; //für Datenbank -import java.sql.ResultSet; //für Datenbank -import java.sql.SQLException; //für Datenbank -import java.sql.Statement; //für Datenbank +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.List; import com.eclipsesource.json.Json; import com.eclipsesource.json.JsonArray; import com.eclipsesource.json.JsonObject; import com.eclipsesource.json.JsonValue; -import java.io.File; -import java.io.FileReader; -import java.io.IOException; - public class DBController { public DBController(MainWindowController m) { @@ -30,6 +31,11 @@ public class DBController { private MainWindowController mainWindowController; private String DB_PATH = System.getProperty("user.home") + "\\Documents\\HomeFlix" + "\\" + "Homeflix.db"; // der Pfad der Datenbank-Datei + private List filmsdb = new ArrayList(); + private List filmsAll = new ArrayList(); + private List filmsDir = new ArrayList(); + private List filmsStream = new ArrayList(); + private List counter = new ArrayList(); Connection connection = null; public void main() { @@ -39,8 +45,8 @@ public class DBController { // Statement statement = connection.createStatement(); // statement.setQueryTimeout(30); // set timeout to 30 sec. TODO don't know wath to do with this - connection.setAutoCommit(false); //Autocommit to false -> manual commit is active! - fuelleDatenbank(); + connection.setAutoCommit(false); //Autocommit to false -> manual commit is active +// fuelleDatenbank(); } catch (SQLException e) { // if the error message is "out of memory", it probably means no database file is found System.err.println(e.getMessage()); @@ -56,72 +62,239 @@ public class DBController { // } } - public void fuelleDatenbank() { - - try { - System.out.println("Erstelle Einträge local"); + void createDatabase() { + System.out.println("<=====starting loading sql=====>"); + + PreparedStatement ps; + PreparedStatement psS; + String[] entries = new File(mainWindowController.getPath()).list(); + + try { Statement stmt = connection.createStatement(); - Statement stmtS = connection.createStatement(); - stmt.executeUpdate("drop table if exists film_local"); - stmtS.executeUpdate("drop table if exists film_streaming"); - stmt.executeUpdate("create table film_local (rating, titel, streamUrl)"); // Tabelle "filme" und die Spalten "titel", "pfad", "bewertung" erstellen - stmtS.executeUpdate("create table film_streaming (year, season, episode, rating, resolution, titel, streamUrl)"); // Tabelle "filme" und die Spalten "titel", "pfad", "bewertung" erstellen + stmt.executeUpdate("create table if not exists film_local (rating, titel, streamUrl)"); + stmt.executeUpdate("create table if not exists film_streaming (year, season, episode, rating, resolution, titel, streamUrl)"); + stmt.close(); + } catch (SQLException e1) { + e1.printStackTrace(); + } + + try { + Statement stmt = connection.createStatement(); + ResultSet rs = stmt.executeQuery("SELECT * FROM film_local"); + while (rs.next()) { + filmsdb.add(rs.getString(2)); + } + stmt.close(); + rs.close(); - - PreparedStatement ps = connection.prepareStatement("insert into film_local values (?, ?, ?)"); // SQL Befehl - PreparedStatement psS = connection.prepareStatement("insert into film_streaming values (?, ?, ?, ?, ?, ?, ?)"); // SQL Befehl - - String[] entries = new File(mainWindowController.getPath()).list(); - - for(int i=0;i!=entries.length;i++) // Geht alle Dateien im Verzeichniss durch - { - //System.out.println(file[i].getName()); - ps.setInt(1, 0); // definiert Bewertung als Integer in der dritten Spalte - ps.setString(2, ohneEndung(entries[i])); // definiert Name als String in der ersten Spalte - ps.setString(3,entries[i]); // definiert Pfad als String in der zweiten Spalte - ps.addBatch(); // fügt den Eintrag hinzu + rs = stmt.executeQuery("SELECT * FROM film_streaming;"); + while (rs.next()) { + filmsdb.add(rs.getString(6)); + } + stmt.close(); + rs.close(); + }catch (SQLException ea){ + //TODO } - - - System.out.println("Erstelle Einträge streaming \n"); - if(mainWindowController.getStreamingPath().equals("")||mainWindowController.getStreamingPath().equals(null)){ - System.out.println("Kein Pfad angegeben"); //falls der Pfad null oder "" ist - }else{ - for(int i=0; i< mainWindowController.streamingData.size(); i++){ - String fileName = mainWindowController.getStreamingPath()+"/"+mainWindowController.streamingData.get(i).getStreamUrl(); + + System.out.println("filme in db: "+filmsdb.size()); + + for(int i=0;i!=entries.length;i++){ + filmsDir.add(cutOffEnd(entries[i])); + } + + for(int v=0; v< mainWindowController.streamingData.size(); v++){ + String fileName = mainWindowController.getStreamingPath()+"/"+mainWindowController.streamingData.get(v).getStreamUrl(); try { JsonObject object = Json.parse(new FileReader(fileName)).asObject(); JsonArray items = object.get("entries").asArray(); for (JsonValue item : items) { - psS.setInt(1, item.asObject().getInt("year", 0)); - psS.setInt(2, item.asObject().getInt("season", 0)); - psS.setInt(3, item.asObject().getInt("episode", 0)); - psS.setInt(4, 0); - psS.setString(5, item.asObject().getString("resolution", "")); - psS.setString(6, item.asObject().getString("titel","")); - psS.setString(7, item.asObject().getString("streamUrl", "")); - psS.addBatch(); // fügt den Eintrag hinzu + filmsStream.add(item.asObject().getString("titel","")); } } catch (IOException e) { - //Auto-generated catch block e.printStackTrace(); } + } + filmsAll.addAll(filmsDir); + filmsAll.addAll(filmsStream); + System.out.println("films in directory: "+filmsAll.size()); + + + if(filmsdb.size() == 0){ + System.out.println("creating entries ..."); + + try{ + ps = connection.prepareStatement("insert into film_local values (?, ?, ?)"); + psS = connection.prepareStatement("insert into film_streaming values (?, ?, ?, ?, ?, ?, ?)"); + + for(int j=0;j!=entries.length;j++) // Geht alle Dateien im Verzeichniss durch + { + ps.setInt(1, 0); // definiert Bewertung als Integer in der dritten Spalte + ps.setString(2, cutOffEnd(entries[j])); // definiert Name als String in der ersten Spalte + ps.setString(3,entries[j]); // definiert Pfad als String in der zweiten Spalte + ps.addBatch(); // fügt den Eintrag hinzu + } + + if(mainWindowController.getStreamingPath().equals("")||mainWindowController.getStreamingPath().equals(null)){ + System.out.println("Kein Pfad angegeben"); //falls der Pfad null oder "" ist + }else{ + for(int i=0; i< mainWindowController.streamingData.size(); i++){ + String fileNamea = mainWindowController.getStreamingPath()+"/"+mainWindowController.streamingData.get(i).getStreamUrl(); + try { + JsonObject object = Json.parse(new FileReader(fileNamea)).asObject(); + JsonArray items = object.get("entries").asArray(); + for (JsonValue item : items) { + psS.setInt(1, item.asObject().getInt("year", 0)); + psS.setInt(2, item.asObject().getInt("season", 0)); + psS.setInt(3, item.asObject().getInt("episode", 0)); + psS.setInt(4, 0); + psS.setString(5, item.asObject().getString("resolution", "")); + psS.setString(6, item.asObject().getString("titel","")); + psS.setString(7, item.asObject().getString("streamUrl", "")); + psS.addBatch(); // fügt den Eintrag hinzu + } + } catch (IOException e) { + e.printStackTrace(); + } + } + } + ps.executeBatch(); // scheibt alle Einträge in die Datenbank + psS.executeBatch(); + connection.commit(); + ps.close(); + psS.close(); + }catch (SQLException ea) { + System.err.println("Konnte nicht ausgeführt werden"); + ea.printStackTrace(); + } + }else if(filmsdb.size() == filmsAll.size()){ + for(int i=0;i maybe there is an issue now + rs = stmt.executeQuery("SELECT * FROM film_streaming;"); + while (rs.next()) { + mainWindowController.streamData.add(new streamUiData(rs.getInt(1), rs.getInt(2), rs.getInt(3), rs.getDouble(4), rs.getString(5), rs.getString(6), rs.getString(7))); } -// connection.setAutoCommit(false); - ps.executeBatch(); // scheibt alle Einträge in die Datenbank - psS.executeBatch(); - connection.commit(); - ps.close(); - psS.close(); - //connection.close(); - } catch (SQLException ea) { - System.err.println("Konnte nicht ausgeführt werden"); - ea.printStackTrace(); + stmt.close(); + rs.close(); + } catch (SQLException e) { + System.err.println("Ups! an error occured!"); + e.printStackTrace(); + } + System.out.println("<=====finished loading sql=====>"); + } + + //refreshs the data in mainWindowController.newDaten and mainWindowController.streamData + void refresh(String name,int i) throws SQLException{ + System.out.println("refresh ..."); + Statement stmt; + try { + stmt = connection.createStatement(); + ResultSet rs = stmt.executeQuery("SELECT * FROM film_local WHERE titel = '"+name+"';" ); + mainWindowController.newDaten.set(i, new streamUiData(1, 1, 1, rs.getDouble(1), "1", rs.getString(2), rs.getString(3))); + stmt.close(); + rs.close(); + } catch (SQLException e) { + try { + stmt = connection.createStatement(); + ResultSet rs = stmt.executeQuery("SELECT * FROM film_streaming WHERE titel = '"+name+"';" ); + mainWindowController.streamData.set(i,new streamUiData(rs.getInt(1), rs.getInt(2), rs.getInt(3), rs.getDouble(4), rs.getString(5), rs.getString(6), rs.getString(7))); + stmt.close(); + rs.close(); + } catch (SQLException e1) { + System.err.println("Ups! an error occured!"); + e1.printStackTrace(); + } } } - public void ausgeben(){ + private void updateDB(){ + System.out.println("updating DB ..."); + for(int i=0; i check config.xml TODO nur Windows getestet siehe dir und file + //dir exists -> check config.xml if(dir.exists() == true){ if (file.exists() != true) { mainWindowController.setPath(firstStart()); @@ -105,26 +107,31 @@ public class Main extends Application { Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //start again (preventing Bugs) System.exit(0); //finishes itself } -// mainWindowController.loadStreamingSettings(); - mainWindowController.applyColor(); //setzt die Theme Farbe - mainWindowController.cbLocal.getSelectionModel().select(mainWindowController.getLocal()); //setzt local + + mainWindowController.loadStreamingSettings(); + mainWindowController.applyColor(); //set theme color + mainWindowController.cbLocal.getSelectionModel().select(mainWindowController.getLocal()); //set local mainWindowController.mainColor.setValue(Color.valueOf(mainWindowController.getColor())); - mainWindowController.loadData(); //läd die Daten im Controller + + mainWindowController.dbController.main(); //initialize database controller + mainWindowController.dbController.createDatabase(); //creating the database + mainWindowController.dbController.loadData(); //loading data from database to mainWindowController + +// mainWindowController.loadData(); //läd die Daten im Controller mainWindowController.addDataUI(); - Scene scene = new Scene(pane); //neue Scen um inhalt der stage anzuzeigen + Scene scene = new Scene(pane); //create new scene, append pane to scene - primaryStage.setScene(scene); - primaryStage.show(); //zeige scene + primaryStage.setScene(scene); //append scene to stage + primaryStage.show(); //show stage } catch (IOException e) { - // Auto-generated catch block e.printStackTrace(); } } //methode für den erstmaligen Start private String firstStart(){ - Alert alert = new Alert(AlertType.CONFIRMATION); //neuer alert mit filechooser + Alert alert = new Alert(AlertType.CONFIRMATION); //new alert with filechooser alert.setTitle("Project HomeFlix"); alert.setHeaderText("Es ist kein Stammverzeichniss für Filme angegeben!"); //TODO translate alert.setContentText("Stammverzeichniss angeben?"); diff --git a/src/application/MainWindowController.java b/src/application/MainWindowController.java index 35f68e5..1e4eaad 100644 --- a/src/application/MainWindowController.java +++ b/src/application/MainWindowController.java @@ -26,7 +26,6 @@ import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; -import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; @@ -36,16 +35,13 @@ import java.io.StringWriter; import java.math.BigInteger; import java.net.URI; import java.net.URISyntaxException; +import java.sql.SQLException; import java.util.Locale; import java.util.Properties; import java.util.ResourceBundle; import org.apache.commons.lang3.SystemUtils; -import com.eclipsesource.json.Json; -import com.eclipsesource.json.JsonArray; -import com.eclipsesource.json.JsonObject; -import com.eclipsesource.json.JsonValue; import com.jfoenix.controls.JFXButton; import com.jfoenix.controls.JFXColorPicker; import com.jfoenix.controls.JFXDialog; @@ -63,11 +59,15 @@ import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; import javafx.collections.FXCollections; import javafx.collections.ObservableList; +import javafx.event.ActionEvent; +import javafx.event.EventHandler; import javafx.fxml.FXML; import javafx.scene.control.Alert; import javafx.scene.control.Alert.AlertType; import javafx.scene.control.ChoiceBox; +import javafx.scene.control.ContextMenu; import javafx.scene.control.Label; +import javafx.scene.control.MenuItem; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.control.TextArea; @@ -211,7 +211,9 @@ public class MainWindowController { private String Name; private String datPath; private String autoUpdate; - private String mode; + private String mode; + @SuppressWarnings("unused") + private String ratingSortType; String title; String year; String rating; @@ -237,10 +239,10 @@ public class MainWindowController { private File selectedStreamingFolder; ResourceBundle bundle; - private ObservableList newDaten = FXCollections.observableArrayList(); private ObservableList filterData = FXCollections.observableArrayList(); - private ObservableList streamData = FXCollections.observableArrayList(); private ObservableList locals = FXCollections.observableArrayList("english", "deutsch"); + ObservableList newDaten = FXCollections.observableArrayList(); + ObservableList streamData = FXCollections.observableArrayList(); ObservableList streamingData = FXCollections.observableArrayList(); private ImageView menu_icon_black = new ImageView(new Image("recources/icons/menu_icon_black.png")); private ImageView menu_icon_white = new ImageView(new Image("recources/icons/menu_icon_white.png")); @@ -251,11 +253,14 @@ public class MainWindowController { private ImageView play_arrow_white = new ImageView(new Image("recources/icons/ic_play_arrow_white_18dp_1x.png")); private ImageView play_arrow_black = new ImageView(new Image("recources/icons/ic_play_arrow_black_18dp_1x.png")); private DirectoryChooser directoryChooser = new DirectoryChooser(); + private ContextMenu menu = new ContextMenu(); + private MenuItem like = new MenuItem("like"); + private MenuItem dislike = new MenuItem("dislike"); //TODO one option (like or dislike) Properties props = new Properties(); private updater Updater; private apiQuery ApiQuery; - private DBController dbController; + DBController dbController; //wenn menubtn clicked /** @@ -427,12 +432,13 @@ public class MainWindowController { @FXML private void debugBtnclicked(){ -// dbController.ausgeben(); - dbController.getFavStatus("Zootopia"); - dbController.favorisieren("Zootopia"); - dbController.getFavStatus("Zootopia"); - dbController.defavorisieren("Zootopia"); - dbController.getFavStatus("Zootopia"); + System.out.println(columnRating.getSortType()); +// System.out.println(newDaten.get(selected).getTitel()+","+newDaten.get(selected).getRating()); +// dbController.getFavStatus("Zootopia"); +// dbController.like("Zootopia"); +// dbController.getFavStatus("House of Cards"); +// dbController.dislike("Zootopia"); +// dbController.getFavStatus("Zootopia"); //for testing } @@ -510,19 +516,21 @@ public class MainWindowController { //"Main" Methode die beim start von der Klasse Main aufgerufen wird, initialiesirung der einzellnen UI-Objekte public void setMain(Main main) { + Updater = new updater(this); + ApiQuery = new apiQuery(this); + dbController = new DBController(this); loadSettings(); initTabel(); initActions(); - Updater = new updater(this); - ApiQuery = new apiQuery(this); - dbController = new DBController(this); - System.out.println("Mode: "+mode); //TODO debugging - - loadStreamingSettings(); - dbController.main(); + +// if(ratingSortType == "DESCENDING"){ //TODO not fully implemented yet +// columnRating.setSortType(TreeTableColumn.SortType.DESCENDING); +// }else{ +// columnRating.setSortType(TreeTableColumn.SortType.ASCENDING); +// } debugBtn.setDisable(false); //debugging btn for tests debugBtn.setVisible(true); @@ -532,6 +540,7 @@ public class MainWindowController { sliderFontSize.setValue(getSize()); cbLocal.setItems(locals); + menu.getItems().addAll(like,dislike); updateBtn.setFont(Font.font("System", 12)); @@ -544,7 +553,7 @@ public class MainWindowController { ta1.setWrapText(true); ta1.setEditable(false); - ta1.setFont(Font.font("System", getSize())); + ta1.setFont(Font.font("System", getSize())); } //initialisierung der Tabellen für filme(beide Modi) und Streaming-Settings @@ -603,6 +612,9 @@ public class MainWindowController { } }); + //context menu for treetableview + treeTableViewfilm.setContextMenu(menu); + //Streaming-Settings Tabelle dataNameColumn.setCellValueFactory(cellData -> cellData.getValue().titelProperty()); dataNameEndColumn.setCellValueFactory(cellData -> cellData.getValue().streamUrlProperty()); @@ -611,13 +623,13 @@ public class MainWindowController { tableViewStreamingdata.setItems(streamingData); } - //initialisierung der Button Actions + //Initializing the actions + @SuppressWarnings("unchecked") private void initActions(){ //TODO unterscheiden zwischen streaming und local tfsearch.textProperty().addListener(new ChangeListener() { - @SuppressWarnings("unchecked") - @Override + @Override public void changed(ObservableValue observable,String oldValue, String newValue) { int counter = newDaten.size(); filterData.removeAll(filterData); @@ -652,56 +664,90 @@ public class MainWindowController { saveSettings(); } }); + + like.setOnAction(new EventHandler() { + @Override + public void handle(ActionEvent event) { + dbController.like(Name); + dbController.getFavStatus(Name); + try { + dbController.refresh(Name, selected); + } catch (SQLException e) { + // TODO Auto-generated catch block error msg + e.printStackTrace(); + } + refreshTable(); + } + }); + + dislike.setOnAction(new EventHandler() { + @Override + public void handle(ActionEvent event) { + dbController.dislike(Name); + dbController.getFavStatus(Name); + try { + dbController.refresh(Name, selected); + } catch (SQLException e) { + // TODO Auto-generated catch block error msg + e.printStackTrace(); + } + refreshTable(); + } + }); + } + + private void refreshTable(){ + root.getChildren().set(selected, new TreeItem(newDaten.get(selected))); } //lädt die Daten im angegeben Ordner in newDaten - void loadData(){ - //load local Data - if(getPath().equals("")||getPath().equals(null)){ - System.out.println("Kein Pfad angegeben"); //falls der Pfad null oder "" ist - }else{ - String[] entries = new File(getPath()).list(); - for(int i = 0; i < entries.length; i++){ - String titel = ohneEndung(entries[i]); - String data = entries[i]; - newDaten.add(new streamUiData(1, 1, 1, 5.0, "1", titel, data)); - } - } - - //load streaming Data TODO prüfen ob streaming daten vorhanden -> momentan evtl. fehler - String titel = null; - String resolution = null; - String streamUrl = null; - int season; - int episode; - int year; - double rating = 5.0; - if(getStreamingPath().equals("")||getStreamingPath().equals(null)){ - System.out.println("Kein Pfad angegeben"); //falls der Pfad null oder "" ist - }else{ - for(int i=0; i< streamingData.size(); i++){ - String fileName = streamingPath+"/"+streamingData.get(i).getStreamUrl(); - try { - JsonObject object = Json.parse(new FileReader(fileName)).asObject(); - JsonArray items = object.get("entries").asArray(); - - for (JsonValue item : items) { - titel = item.asObject().getString("titel",""); - season = item.asObject().getInt("season", 0); - episode = item.asObject().getInt("episode", 0); - year = item.asObject().getInt("year", 0); - resolution = item.asObject().getString("resolution", ""); - streamUrl = item.asObject().getString("streamUrl", ""); - streamData.add(new streamUiData(year, season, episode, rating, resolution, titel, streamUrl)); - } - - } catch (IOException e) { - //Auto-generated catch block - e.printStackTrace(); - } - } - } - } +// void loadData(){ +// //load local Data +// if(getPath().equals("")||getPath().equals(null)){ +// System.out.println("Kein Pfad angegeben"); //falls der Pfad null oder "" ist +// }else{ +// String[] entries = new File(getPath()).list(); +// for(int i = 0; i < entries.length; i++){ +// String titel = ohneEndung(entries[i]); +// String data = entries[i]; +// newDaten.add(new streamUiData(1, 1, 1, 5.0, "1", titel, data)); +// } +// } +// +// //load streaming Data TODO prüfen ob streaming daten vorhanden -> momentan evtl. fehler +// String titel = null; +// String resolution = null; +// String streamUrl = null; +// int season; +// int episode; +// int year; +// double rating = 5.0; +// if(getStreamingPath().equals("")||getStreamingPath().equals(null)){ +// System.out.println("Kein Pfad angegeben"); //falls der Pfad null oder "" ist +// }else{ +// for(int i=0; i< streamingData.size(); i++){ +// String fileName = streamingPath+"/"+streamingData.get(i).getStreamUrl(); +// try { +// JsonObject object = Json.parse(new FileReader(fileName)).asObject(); +// JsonArray items = object.get("entries").asArray(); +// +// for (JsonValue item : items) { +// titel = item.asObject().getString("titel",""); +// season = item.asObject().getInt("season", 0); +// episode = item.asObject().getInt("episode", 0); +// year = item.asObject().getInt("year", 0); +// resolution = item.asObject().getString("resolution", ""); +// streamUrl = item.asObject().getString("streamUrl", ""); +// streamData.add(new streamUiData(year, season, episode, rating, resolution, titel, streamUrl)); +// } +// +// } catch (IOException e) { +// //Auto-generated catch block +// e.printStackTrace(); +// } +// } +// } +// } void addDataUI(){ if(mode.equals("local")){ @@ -731,7 +777,7 @@ public class MainWindowController { } } - private void loadStreamingSettings(){ + void loadStreamingSettings(){ if(getStreamingPath().equals("")||getStreamingPath().equals(null)){ System.out.println("Kein Pfad angegeben"); //falls der Pfad null oder "" ist }else{ @@ -946,6 +992,7 @@ public class MainWindowController { props.setProperty("local", Integer.toString(getLocal())); props.setProperty("streamingPath", getStreamingPath()); props.setProperty("mode", getMode()); + props.setProperty("ratingSortType", columnRating.getSortType().toString()); OutputStream outputStream = new FileOutputStream(file); //new outputstream props.storeToXML(outputStream, "Project HomeFlix settings"); //writes new .xml outputStream.close(); @@ -967,6 +1014,7 @@ public class MainWindowController { autoUpdate = props.getProperty("autoUpdate"); local = Integer.parseInt(props.getProperty("local")); mode = props.getProperty("mode"); + ratingSortType = props.getProperty("ratingSortType"); inputStream.close(); } catch (IOException e) { // showErrorMsg(errorLoad, e); //TODO das soll beim ersten start nicht erscheinen