diff --git a/bin/application/DBController.class b/bin/application/DBController.class index d674821..dbf1e3d 100644 Binary files a/bin/application/DBController.class and b/bin/application/DBController.class differ diff --git a/bin/application/MainWindow.fxml b/bin/application/MainWindow.fxml index c2aeb84..eb15ef1 100644 --- a/bin/application/MainWindow.fxml +++ b/bin/application/MainWindow.fxml @@ -17,10 +17,10 @@ - + - - + + @@ -29,7 +29,7 @@ - + diff --git a/bin/application/MainWindowController$1.class b/bin/application/MainWindowController$1.class index 03a46a6..4eeefa5 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 eb38fce..1103180 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 b52778e..d88deed 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 9d64b28..f600c9b 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 index 8d32ae5..ea1cacb 100644 Binary files a/bin/application/MainWindowController$5.class and b/bin/application/MainWindowController$5.class differ diff --git a/bin/application/MainWindowController$6.class b/bin/application/MainWindowController$6.class index d56c5fa..a6b268b 100644 Binary files a/bin/application/MainWindowController$6.class and b/bin/application/MainWindowController$6.class differ diff --git a/bin/application/MainWindowController.class b/bin/application/MainWindowController.class index ac7d7ab..1d86505 100644 Binary files a/bin/application/MainWindowController.class and b/bin/application/MainWindowController.class differ diff --git a/bin/application/apiQuery.class b/bin/application/apiQuery.class index db9a01a..f80cffc 100644 Binary files a/bin/application/apiQuery.class and b/bin/application/apiQuery.class differ diff --git a/src/application/DBController.java b/src/application/DBController.java index 47f3f6e..9844614 100644 --- a/src/application/DBController.java +++ b/src/application/DBController.java @@ -34,9 +34,9 @@ public class DBController { } private MainWindowController mainWindowController; - private String DB_PATH = System.getProperty("user.home") + "\\Documents\\HomeFlix" + "\\" + "Homeflix.db"; // der Pfad der Datenbank-Datei - private ImageView favorite_black = new ImageView(new Image("recources/icons/ic_favorite_black_18dp_1x.png")); - private ImageView favorite_border_black = new ImageView(new Image("recources/icons/ic_favorite_border_black_18dp_1x.png")); + private String DB_PATH = System.getProperty("user.home") + "\\Documents\\HomeFlix" + "\\" + "Homeflix.db"; //path to database file + private Image favorite_black = new Image("recources/icons/ic_favorite_black_18dp_1x.png"); + private Image favorite_border_black = new Image("recources/icons/ic_favorite_border_black_18dp_1x.png"); private List filmsdbAll = new ArrayList(); private List filmsdbLocal = new ArrayList(); private List filmsdbStream = new ArrayList(); @@ -53,9 +53,9 @@ public class DBController { // create a database connection connection = DriverManager.getConnection("jdbc:sqlite:" + DB_PATH); // Statement statement = connection.createStatement(); - // statement.setQueryTimeout(30); // set timeout to 30 sec. TODO don't know wath to do with this + // statement.setQueryTimeout(30); // set timeout to 30 sec. TODO don't know what to do with this - connection.setAutoCommit(false); //Autocommit to false -> manual commit is active + 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 @@ -142,17 +142,17 @@ public class DBController { 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 + for(int j=0;j!=entries.length;j++) //goes through all the files in the directory { - 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.setInt(1, 0); //rating as integer 1. column + ps.setString(2, cutOffEnd(entries[j])); //name as String without ending 2. column + ps.setString(3,entries[j]); //path as String 3. column ps.setString(4, "favorite_border_black"); - ps.addBatch(); // fügt den Eintrag hinzu + ps.addBatch(); // add command to prepared statement } if(mainWindowController.getStreamingPath().equals("")||mainWindowController.getStreamingPath().equals(null)){ - System.out.println("Kein Pfad angegeben"); //falls der Pfad null oder "" ist + 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(); @@ -168,14 +168,14 @@ public class DBController { psS.setString(6, item.asObject().getString("titel","")); psS.setString(7, item.asObject().getString("streamUrl", "")); psS.setString(8, "favorite_border_black"); - psS.addBatch(); // fügt den Eintrag hinzu + psS.addBatch(); // add command to prepared statement } } catch (IOException e) { e.printStackTrace(); } } } - ps.executeBatch(); // scheibt alle Einträge in die Datenbank + ps.executeBatch(); //execute statement to write entries into table psS.executeBatch(); connection.commit(); ps.close(); @@ -208,7 +208,11 @@ public class DBController { Statement stmt = connection.createStatement(); ResultSet rs = stmt.executeQuery("SELECT * FROM film_local"); while (rs.next()) { - mainWindowController.newDaten.add(new streamUiData(1, 1, 1, rs.getDouble(1), "1", rs.getString(2), rs.getString(3), favorite_border_black)); + if(rs.getString(4).equals("favorite_black")){ + mainWindowController.newDaten.add( new streamUiData(1, 1, 1, rs.getDouble(1), "1", rs.getString(2), rs.getString(3), new ImageView(favorite_black))); + }else{ + mainWindowController.newDaten.add( new streamUiData(1, 1, 1, rs.getDouble(1), "1", rs.getString(2), rs.getString(3), new ImageView(favorite_border_black))); + } } stmt.close(); rs.close(); @@ -216,7 +220,11 @@ public class DBController { //load streaming Data TODO check if there are streaming data before loading -> 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), favorite_border_black)); + if(rs.getString(8).equals("favorite_black")){ + 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), new ImageView(favorite_black))); + }else{ + 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), new ImageView(favorite_border_black))); + } } stmt.close(); rs.close(); @@ -227,7 +235,7 @@ public class DBController { System.out.println("<==========finished loading sql==========>"); } - //refreshs the data in mainWindowController.newDaten and mainWindowController.streamData + //Refreshes the data in mainWindowController.newDaten and mainWindowController.streamData //TODO it seems that there is an issue at the moment with streaming refreshing wrong entry if there is more than one with the same name void refresh(String name,int i) throws SQLException{ System.out.println("refresh ..."); @@ -237,9 +245,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.newDaten.set(i, new streamUiData(1, 1, 1, rs.getDouble(1), "1", rs.getString(2), rs.getString(3), favorite_black)); + mainWindowController.newDaten.set(i, new streamUiData(1, 1, 1, rs.getDouble(1), "1", rs.getString(2), rs.getString(3), new ImageView(favorite_black))); }else{ - mainWindowController.newDaten.set(i, new streamUiData(1, 1, 1, rs.getDouble(1), "1", rs.getString(2), rs.getString(3), favorite_border_black)); + mainWindowController.newDaten.set(i, new streamUiData(1, 1, 1, rs.getDouble(1), "1", rs.getString(2), rs.getString(3), new ImageView(favorite_border_black))); } stmt.close(); rs.close(); @@ -248,9 +256,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.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), favorite_black)); + 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), new ImageView(favorite_black))); }else{ - 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), favorite_border_black)); + 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), new ImageView(favorite_border_black))); } stmt.close(); rs.close(); @@ -287,7 +295,7 @@ public class DBController { } - private void checkAddEntry() throws SQLException, FileNotFoundException, IOException{ //müssen noch alphabetisch sortiert werden + private void checkAddEntry() throws SQLException, FileNotFoundException, IOException{ //TODO sort alphabetical System.out.println("checking for entrys to add to DB ..."); String[] entries = new File(mainWindowController.getPath()).list(); Statement stmt = connection.createStatement(); diff --git a/src/application/MainWindow.fxml b/src/application/MainWindow.fxml index c2aeb84..eb15ef1 100644 --- a/src/application/MainWindow.fxml +++ b/src/application/MainWindow.fxml @@ -17,10 +17,10 @@ - + - - + + @@ -29,7 +29,7 @@ - + diff --git a/src/application/MainWindowController.java b/src/application/MainWindowController.java index 6b51bc3..e15517b 100644 --- a/src/application/MainWindowController.java +++ b/src/application/MainWindowController.java @@ -182,9 +182,10 @@ public class MainWindowController { private boolean menutrue = false; //saves the position of menubtn (opened or closed) private boolean settingstrue = false; private boolean streamingSettingsTrue = false; - private String version = "0.4.0"; - private String buildNumber = "104"; - private String versionName = "glowing bucket"; + private int hashA = -2055934614; + private String version = "0.4.99"; + private String buildNumber = "110"; + private String versionName = "plasma cow (pre Release)"; private String buildURL = "https://raw.githubusercontent.com/Seil0/Project-HomeFlix/master/updates/buildNumber.txt"; private String downloadLink = "https://raw.githubusercontent.com/Seil0/Project-HomeFlix/master/updates/downloadLink.txt"; private File dir = new File(System.getProperty("user.home") + "/Documents/HomeFlix"); @@ -250,8 +251,6 @@ public class MainWindowController { private ImageView skip_next_black = new ImageView(new Image("recources/icons/ic_skip_next_black_18dp_1x.png")); 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 ImageView favorite_black = new ImageView(new Image("recources/icons/ic_favorite_black_18dp_1x.png")); - private ImageView favorite_border_black = new ImageView(new Image("recources/icons/ic_favorite_border_black_18dp_1x.png")); private DirectoryChooser directoryChooser = new DirectoryChooser(); private ContextMenu menu = new ContextMenu(); private MenuItem like = new MenuItem("like"); @@ -262,7 +261,6 @@ public class MainWindowController { private apiQuery ApiQuery; DBController dbController; - //wenn menubtn clicked /** * TODO change value of Text-color change */ @@ -303,7 +301,6 @@ public class MainWindowController { System.out.println(output); input.close(); } catch (IOException e1) { - // Auto-generated catch block e1.printStackTrace(); } if(output.contains("which: no vlc")||output == ""){ @@ -335,7 +332,7 @@ public class MainWindowController { } }else if(mode.equals("streaming")){ try { - Desktop.getDesktop().browse(new URI(datPath)); //opens the streaming url in browser (other option?) + Desktop.getDesktop().browse(new URI(datPath)); //opens the streaming url in browser (TODO other option?) } catch (URISyntaxException | IOException e) { showErrorMsg(errorOpenStream, (IOException) e); } @@ -350,7 +347,7 @@ public class MainWindowController { @FXML private void openfolderbtnclicked(){ try { - Desktop.getDesktop().open(new File(getPath())); //öffnet den aktuellen Pfad + Desktop.getDesktop().open(new File(getPath())); //open path when button is clicked } catch (IOException e) { e.printStackTrace(); } @@ -393,7 +390,7 @@ public class MainWindowController { } /** - * TODO zusätzliche infos über die dateien + * TODO additional info about the "streaming.json" */ @FXML private void streamingSettingsBtnclicked(){ @@ -424,7 +421,7 @@ public class MainWindowController { addDataUI(); settingsAnchor.setVisible(false); streamingSettingsAnchor.setVisible(false); - sideMenuSlideOut(); //disables sidemenu + sideMenuSlideOut(); //disables side-menu menutrue = false; settingstrue = false; streamingSettingsTrue = false; @@ -432,7 +429,6 @@ public class MainWindowController { @FXML private void debugBtnclicked(){ - newDaten.get(selected).setImage(favorite_black); //for testing } @@ -508,7 +504,7 @@ public class MainWindowController { } - //"Main" Methode die beim start von der Klasse Main aufgerufen wird, initialiesirung der einzellnen UI-Objekte + //"Main" Method called in Main.java main() when starting, initialize some UI elements public void setMain(Main main) { Updater = new updater(this); ApiQuery = new apiQuery(this); @@ -519,15 +515,16 @@ public class MainWindowController { initActions(); System.out.println("Mode: "+mode); //TODO debugging - -// if(ratingSortType == "DESCENDING"){ //TODO not fully implemented yet + + //TODO implement sort for rating and alphabetical sort for name after new title was added +// if(ratingSortType == "DESCENDING"){ // columnRating.setSortType(TreeTableColumn.SortType.DESCENDING); // }else{ // columnRating.setSortType(TreeTableColumn.SortType.ASCENDING); // } - debugBtn.setDisable(false); //debugging btn for tests - debugBtn.setVisible(true); + debugBtn.setDisable(true); //debugging btn for tests + debugBtn.setVisible(false); tfPath.setText(getPath()); @@ -550,7 +547,7 @@ public class MainWindowController { ta1.setFont(Font.font("System", getSize())); } - //initialisierung der Tabellen für filme(beide Modi) und Streaming-Settings + //Initialize the tables (treeTableViewfilm and tableViewStreamingdata) @SuppressWarnings({ "unchecked"}) private void initTabel(){ @@ -565,31 +562,8 @@ public class MainWindowController { treeTableViewfilm.setRoot(root); treeTableViewfilm.setColumnResizePolicy( TreeTableView.CONSTRAINED_RESIZE_POLICY ); treeTableViewfilm.setShowRoot(false); - - //inhalt in Zelle schreiben -// columnTitel.setCellValueFactory((CellDataFeatures p) -> -// new ReadOnlyStringWrapper(p.getValue().getValue().getTitel())); -// -// columnRating.setCellValueFactory((CellDataFeatures p) -> -// new ReadOnlyObjectWrapper(p.getValue().getValue().getRating())); -// -// columnStreamUrl.setCellValueFactory((CellDataFeatures p) -> -// new ReadOnlyStringWrapper(p.getValue().getValue().getStreamUrl())); -// -// columnResolution.setCellValueFactory((CellDataFeatures p) -> -// new ReadOnlyStringWrapper(p.getValue().getValue().getResolution())); -// -// columnYear.setCellValueFactory((CellDataFeatures p) -> -// new ReadOnlyObjectWrapper(p.getValue().getValue().getYear())); -// -// columnSeason.setCellValueFactory((CellDataFeatures p) -> -// new ReadOnlyObjectWrapper(p.getValue().getValue().getSeason())); -// -// columnEpisode.setCellValueFactory((CellDataFeatures p) -> -// new ReadOnlyObjectWrapper(p.getValue().getValue().getEpisode())); - - //write content into cell (new) + //write content into cell columnTitel.setCellValueFactory(cellData -> cellData.getValue().getValue().titelProperty()); columnRating.setCellValueFactory(cellData -> cellData.getValue().getValue().imageProperty()); columnStreamUrl.setCellValueFactory(cellData -> cellData.getValue().getValue().streamUrlProperty()); @@ -599,21 +573,21 @@ public class MainWindowController { columnEpisode.setCellValueFactory(cellData -> cellData.getValue().getValue().episodeProperty().asObject()); treeTableViewfilm.getColumns().addAll(columnTitel, columnRating, columnStreamUrl, columnResolution, columnYear, columnSeason, columnEpisode); - treeTableViewfilm.getColumns().get(2).setVisible(false); //blendet die Column mit den Dateinamen aus (wichtig um sie abzuspielen) + treeTableViewfilm.getColumns().get(2).setVisible(false); //hide columnStreamUrl (column with file path important for the player) - //Changelistener für TreeTable + //Changelistener for TreeTable treeTableViewfilm.getSelectionModel().selectedItemProperty().addListener(new ChangeListener() { @Override public void changed(ObservableValue observable, Object oldVal, Object newVal) { - // last = selected; //für autoplay - selected = treeTableViewfilm.getSelectionModel().getSelectedIndex(); // holt aktuelles Item + // last = selected; //for auto-play + selected = treeTableViewfilm.getSelectionModel().getSelectedIndex(); //get selected item last = selected - 1; next = selected + 1; - Name = columnTitel.getCellData(selected); // holt Namen des Aktuelle Items aus der ColumnName - datPath = columnStreamUrl.getCellData(selected); // holt den aktuellen Datei Pfad aus der ColumnDatName - ta1.setText(""); // löscht Text in ta1 - ApiQuery.startQuery(Name); // startet die api abfrage - ta1.positionCaret(0); // setzt die startposition des Cursors in ta1 + Name = columnTitel.getCellData(selected); //get name of selected item + datPath = columnStreamUrl.getCellData(selected); //get file path of selected item + ta1.setText(""); //delete text in ta1 + ApiQuery.startQuery(Name); // start api query + ta1.positionCaret(0); //set cursor position in ta1 } }); @@ -649,7 +623,7 @@ public class MainWindowController { for(int i = 0; i < filterData.size(); i++){ root.getChildren().addAll(new TreeItem(filterData.get(i))); //fügt daten zur Rootnode hinzu } - if(tfsearch.getText().equals("Notflix_glowing_cow")){ + if(tfsearch.getText().hashCode() == hashA){ setColor("000000"); applyColor(); } @@ -730,24 +704,24 @@ public class MainWindowController { void addDataUI(){ if(mode.equals("local")){ for(int i = 0; i < newDaten.size(); i++){ - root.getChildren().add(new TreeItem(newDaten.get(i))); //fügt daten zur Rootnode hinzu + root.getChildren().add(new TreeItem(newDaten.get(i))); //add data to root-node } - columnRating.setMaxWidth(80); - columnTitel.setMaxWidth(280); + columnRating.setMaxWidth(90); + columnTitel.setMaxWidth(290); treeTableViewfilm.getColumns().get(3).setVisible(false); treeTableViewfilm.getColumns().get(4).setVisible(false); treeTableViewfilm.getColumns().get(5).setVisible(false); treeTableViewfilm.getColumns().get(6).setVisible(false); }else if(mode.equals("streaming")){ for(int i = 0; i < streamData.size(); i++){ - root.getChildren().add(new TreeItem(streamData.get(i))); //fügt daten zur Rootnode hinzu + root.getChildren().add(new TreeItem(streamData.get(i))); //add data to root-node } columnTitel.setMaxWidth(150); columnResolution.setMaxWidth(65); - columnRating.setMaxWidth(52.5); - columnYear.setMaxWidth(40); - columnSeason.setMaxWidth(52.5); - columnEpisode.setMaxWidth(0); //disabled for ui size reasons + columnRating.setMaxWidth(50); + columnYear.setMaxWidth(43); + columnSeason.setMaxWidth(42); + columnEpisode.setMaxWidth(44); treeTableViewfilm.getColumns().get(3).setVisible(true); treeTableViewfilm.getColumns().get(4).setVisible(true); treeTableViewfilm.getColumns().get(5).setVisible(true); @@ -831,7 +805,7 @@ public class MainWindowController { //das solte weg kann aber hier bleiben wicht ist dass es zum selben zeitpunkt wie aply color ausgeführt wird if(mode.equals("local")){ - switchBtn.setText("streaming"); //TODO translate + switchBtn.setText("streaming"); }else if(mode.equals("streaming")){ switchBtn.setText("local"); } diff --git a/src/application/apiQuery.java b/src/application/apiQuery.java index 80aab0c..a78ea07 100644 --- a/src/application/apiQuery.java +++ b/src/application/apiQuery.java @@ -122,6 +122,7 @@ public class apiQuery{ } } catch (Exception e) { + mainWindowController.ta1.setText(e.toString()); System.out.println(e); } finally { //closes datainputStream, InputStream,Scanner if not already done