diff --git a/.classpath b/.classpath
index e47eadb..18bfe3a 100644
--- a/.classpath
+++ b/.classpath
@@ -3,9 +3,10 @@
-
-
-
-
+
+
+
+
+
diff --git a/.project b/.project
index 5457f9b..b4e5ab5 100644
--- a/.project
+++ b/.project
@@ -19,5 +19,6 @@
org.eclipse.xtext.ui.shared.xtextNatureorg.eclipse.jdt.core.javanature
+ org.eclipse.fx.ide.css.nature
diff --git a/README.md b/README.md
index eaa0cf9..993d9c2 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,6 @@
# Project-HomeFlix
+
Project HomeFlix is a Kellerkinder Project, that alowes you to sort all your local saved movies in clean UI.
This is the master branch, it is **only merged** with dev if a **new release** is out.
diff --git a/bin/application/DBController.class b/bin/application/DBController.class
index 84109e8..4a9c489 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..04ee8bc 100644
Binary files a/bin/application/Main.class and b/bin/application/Main.class differ
diff --git a/bin/application/MainWindow.fxml b/bin/application/MainWindow.fxml
index c2aeb84..a455653 100644
--- a/bin/application/MainWindow.fxml
+++ b/bin/application/MainWindow.fxml
@@ -16,11 +16,13 @@
+
-
+
-
-
+
+
+
@@ -29,7 +31,7 @@
-
+
diff --git a/bin/application/MainWindowController$1.class b/bin/application/MainWindowController$1.class
index 69a2131..68b1b57 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..24ed899 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..05dc50b 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..dbce121 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..1e47f18
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..ea12f4a
Binary files /dev/null and b/bin/application/MainWindowController$6.class differ
diff --git a/bin/application/MainWindowController$7.class b/bin/application/MainWindowController$7.class
new file mode 100644
index 0000000..176f270
Binary files /dev/null and b/bin/application/MainWindowController$7.class differ
diff --git a/bin/application/MainWindowController.class b/bin/application/MainWindowController.class
index 609d3c2..76ac617 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 a6c5ba6..9de2779 100644
Binary files a/bin/application/apiQuery.class and b/bin/application/apiQuery.class differ
diff --git a/bin/application/streamUiData.class b/bin/application/streamUiData.class
index d0821f1..034c7a2 100644
Binary files a/bin/application/streamUiData.class and b/bin/application/streamUiData.class differ
diff --git a/bin/application/updater.class b/bin/application/updater.class
index fc84263..dd8ed1e 100644
Binary files a/bin/application/updater.class and b/bin/application/updater.class differ
diff --git a/bin/libraries/Licenses/Apache_License.txt b/bin/libraries/Licenses/Apache_License.txt
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/bin/libraries/Licenses/Apache_License.txt
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/bin/libraries/Licenses/MIT_License.txt b/bin/libraries/Licenses/MIT_License.txt
new file mode 100644
index 0000000..5e83ac1
--- /dev/null
+++ b/bin/libraries/Licenses/MIT_License.txt
@@ -0,0 +1,19 @@
+Copyright (c) 2013, 2014 EclipseSource
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
\ No newline at end of file
diff --git a/bin/libraries/jfoenix.jar b/bin/libraries/jfoenix-1.1.0.jar
similarity index 73%
rename from bin/libraries/jfoenix.jar
rename to bin/libraries/jfoenix-1.1.0.jar
index 4bf4dd9..759d9d2 100644
Binary files a/bin/libraries/jfoenix.jar and b/bin/libraries/jfoenix-1.1.0.jar differ
diff --git a/bin/libraries/sqlite-jdbc-3.16.1.jar b/bin/libraries/sqlite-jdbc-3.16.1.jar
new file mode 100644
index 0000000..9d4b5bb
Binary files /dev/null and b/bin/libraries/sqlite-jdbc-3.16.1.jar differ
diff --git a/bin/recources/HomeFlix-Local_de_DE.properties b/bin/recources/HomeFlix-Local_de_DE.properties
index c96a9f3..4fb3706 100644
--- a/bin/recources/HomeFlix-Local_de_DE.properties
+++ b/bin/recources/HomeFlix-Local_de_DE.properties
@@ -1,4 +1,4 @@
-# HomeFlix-Local_de_DE.properties German Local
+# HomeFlix-Local_de_DE.properties German Local
info = Info
settings = Einstellungen
streamingSettings = Stream Einst.
@@ -28,7 +28,7 @@ errorSave = Beim speichern der Einstellungen ist ein Fehler aufgetreten!
noFilmFound = Kein Film mit diesem Titel gefunden!
linuxBug = Zurzeit werden unter Linux leider keine Dateien mit Leerzeichen unterst\u00FCtzt!
vlcNotInstalled = Um einen Film abspielen wird der VLC Media Player ben\u00F6tigt!
-infoText = \nMaintainer: seilo@kellerkinder.xyz und \nhendrik.schutter@coptersicht.de \n(c) 2016 Kellerkinder www.kellerkinder.xyz
+infoText = \nMaintainer: seilo@kellerkinder.xyz und \nhendrik.schutter@coptersicht.de \n(c) 2016-2017 Kellerkinder www.kellerkinder.xyz
title = Titel
year = Jahr
rating = Einstufung
@@ -45,3 +45,5 @@ awards = Auszeichnungen
metascore = Metascore
imdbRating = IMDB-Bewertung
type = Type
+firstStartHeader = Es ist kein Stammverzeichnis f\u00FCr Filme angegeben!
+firstStartContent = Stammverzeichniss angeben?
diff --git a/bin/recources/HomeFlix-Local_en_US.properties b/bin/recources/HomeFlix-Local_en_US.properties
index 465d743..41de6ea 100644
--- a/bin/recources/HomeFlix-Local_en_US.properties
+++ b/bin/recources/HomeFlix-Local_en_US.properties
@@ -28,7 +28,7 @@ errorSave = An error occurred while saving the settings!
noFilmFound = No film with this title found!
linuxBug = Currently no files are supported with additional space under Linux unfortunately!
vlcNotInstalled = VLC Media Player is required to play a movie!
-infoText = \nMaintainer: seilo@kellerkinder.xyz and \nhendrik.schutter@coptersicht.de \n(c) 2016 Kellerkinder www.kellerkinder.xyz
+infoText = \nMaintainer: seilo@kellerkinder.xyz and \nhendrik.schutter@coptersicht.de \n(c) 2016-2017 Kellerkinder www.kellerkinder.xyz
title = Title
year = Year
rating = Rating
@@ -45,3 +45,5 @@ awards = Awards
metascore = Metascore
imdbRating = IMDB-Rating
type = Type
+firstStartHeader = There is no root directory for movies!
+firstStartContent = Specify a root directory?
\ No newline at end of file
diff --git a/bin/recources/icons/ic_favorite_black_18dp_1x.png b/bin/recources/icons/ic_favorite_black_18dp_1x.png
new file mode 100644
index 0000000..69be1f5
Binary files /dev/null and b/bin/recources/icons/ic_favorite_black_18dp_1x.png differ
diff --git a/bin/recources/icons/ic_favorite_border_black_18dp_1x.png b/bin/recources/icons/ic_favorite_border_black_18dp_1x.png
new file mode 100644
index 0000000..7edb675
Binary files /dev/null and b/bin/recources/icons/ic_favorite_border_black_18dp_1x.png differ
diff --git a/src/application/DBController.java b/src/application/DBController.java
index 1268921..3dc251a 100644
--- a/src/application/DBController.java
+++ b/src/application/DBController.java
@@ -1,26 +1,31 @@
/**
* DBController for Project HomeFlix
- *
* connection is in manual commit!
+ * TODO arraylists not string -> streamUIData
*/
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.FileNotFoundException;
+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;
+import javafx.scene.image.Image;
+import javafx.scene.image.ImageView;
public class DBController {
@@ -29,18 +34,34 @@ public class DBController {
}
private MainWindowController mainWindowController;
- private String DB_PATH = System.getProperty("user.home") + "\\Documents\\HomeFlix" + "\\" + "Homeflix.db"; // der Pfad der Datenbank-Datei
+ 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();
+ private List filmsdbStreamURL = new ArrayList();
+ private List filmsAll = new ArrayList();
+ private List filmsDir = new ArrayList();
+ private List filmsStream = new ArrayList();
+ private List filmsStreamURL = new ArrayList();
+ private List filmsStreamData = new ArrayList();
Connection connection = null;
public void main() {
+ if (System.getProperty("os.name").equals("Linux")) {
+ DB_PATH = System.getProperty("user.home") + "/HomeFlix/Homeflix.db";
+ }else{
+ DB_PATH = System.getProperty("user.home") + "\\Documents\\HomeFlix" + "\\" + "Homeflix.db";
+ }
try {
// 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!
- 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,177 +77,392 @@ 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;
+
+ 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, favIcon)");
+ stmt.executeUpdate("create table if not exists film_streaming (year, season, episode, rating, resolution, titel, streamUrl, favIcon)");
+ stmt.close();
+ } catch (SQLException e1) {
+ e1.printStackTrace();
+ }
+
+ try {
+ Statement stmt = connection.createStatement();
+ ResultSet rs = stmt.executeQuery("SELECT * FROM film_local");
+ while (rs.next()) {
+ filmsdbLocal.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()) {
+ filmsdbStream.add(rs.getString(6));
+ filmsdbStreamURL.add(rs.getString(7));
+ }
+ stmt.close();
+ rs.close();
+ }catch (SQLException ea){
+ System.err.println("Ups! an error occured!");
+ ea.printStackTrace();
}
-
- 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
+ String[] entries = new File(mainWindowController.getPath()).list();
+ if(mainWindowController.getPath().equals("") || mainWindowController.getPath() == null){
+ System.out.println("Kein Pfad angegeben"); //if path == null or ""
}else{
- for(int i=0; i< mainWindowController.streamingData.size(); i++){
- String fileName = mainWindowController.getStreamingPath()+"/"+mainWindowController.streamingData.get(i).getStreamUrl();
+ System.out.println(entries.length);
+ 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",""));
+ filmsStreamURL.add(item.asObject().getString("streamUrl",""));
+ filmsStreamData.add(fileName);
}
} catch (IOException e) {
- //Auto-generated catch block
e.printStackTrace();
}
+ }
+ filmsAll.addAll(filmsDir);
+ filmsAll.addAll(filmsStream);
+ filmsdbAll.addAll(filmsdbLocal);
+ filmsdbAll.addAll(filmsdbStream);
+ System.out.println("films in directory: "+filmsAll.size());
+ System.out.println("filme in db: "+filmsdbAll.size());
+
+
+ if(filmsdbAll.size() == 0){
+ System.out.println("creating entries ...");
+
+ try{
+ ps = connection.prepareStatement("insert into film_local values (?, ?, ?, ?)");
+ psS = connection.prepareStatement("insert into film_streaming values (?, ?, ?, ?, ?, ?, ?, ?)");
+
+ if(mainWindowController.getPath().equals("") || mainWindowController.getPath() == null){
+ System.out.println("Kein Pfad angegeben"); //if path == null or ""
+ }else{
+ for(int j=0;j!=entries.length;j++) //goes through all the files in the directory
+ {
+ 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(); // add command to prepared statement
+ }
+ }
+
+ 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();
+ 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.setString(8, "favorite_border_black");
+ psS.addBatch(); // add command to prepared statement
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ ps.executeBatch(); //execute statement to write entries into table
+ psS.executeBatch();
+ connection.commit();
+ ps.close();
+ psS.close();
+ }catch (SQLException ea) {
+ System.err.println("Konnte nicht ausgeführt werden");
+ ea.printStackTrace();
+ }
+ }else {
+
+
+ try {
+ try {
+ checkAddEntry();
+ } catch (IOException e) {
+ e.printStackTrace();
+ } //check if added a new file
+ checkRemoveEntry(); //check if removed a file
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ //loading data from database to mainWindowController
+ void loadData(){
+ System.out.println("loading data to mwc ...");
+ try {
+ //load local Data
+ Statement stmt = connection.createStatement();
+ ResultSet rs = stmt.executeQuery("SELECT * FROM film_local");
+ while (rs.next()) {
+ if(rs.getString(4).equals("favorite_black")){
+ mainWindowController.newData.add( new streamUiData(1, 1, 1, rs.getDouble(1), "1", rs.getString(2), rs.getString(3), new ImageView(favorite_black)));
+ }else{
+ mainWindowController.newData.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();
+
+ //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()) {
+ 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)));
+ }
}
-// 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==========>");
+ }
+
+ //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 ...");
+ Statement stmt;
+
+ try {
+ stmt = connection.createStatement();
+ ResultSet rs = stmt.executeQuery("SELECT * FROM film_local WHERE titel = '"+name+"';" );
+ if(rs.getString(4).equals("favorite_black")){
+ mainWindowController.newData.set(i, new streamUiData(1, 1, 1, rs.getDouble(1), "1", rs.getString(2), rs.getString(3), new ImageView(favorite_black)));
+ }else{
+ mainWindowController.newData.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();
+ } catch (SQLException e) {
+ try {
+ 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), 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), new ImageView(favorite_border_black)));
+ }
+ stmt.close();
+ rs.close();
+ } catch (SQLException e1) {
+ System.err.println("Ups! an error occured!");
+ e1.printStackTrace();
+ }
}
}
- public void ausgeben(){
- System.out.println("Einträge ausgeben ... \n");
+ private void checkRemoveEntry() throws SQLException{
+ System.out.println("checking for entrys to remove to DB ...");
+ Statement stmt = connection.createStatement();
+
+ for(int a=0; a
+ * Copyright 2016-2017
*
* 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
@@ -20,13 +20,12 @@
*
*/
package application;
-
+
import java.io.File;
-import java.io.FileInputStream;
import java.io.IOException;
-import java.io.InputStream;
+import java.util.Locale;
import java.util.Optional;
-import java.util.Properties;
+import java.util.ResourceBundle;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
@@ -36,24 +35,26 @@ import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.ButtonType;
import javafx.scene.image.Image;
import javafx.scene.layout.AnchorPane;
-import javafx.scene.paint.Color;
import javafx.stage.DirectoryChooser;
import javafx.stage.Stage;
public class Main extends Application {
- public Stage primaryStage;
+ private Stage primaryStage;
private String path;
- private String streamingPath = System.getProperty("user.home") + "\\Documents\\HomeFlix";
+ private String streamingPathWin = System.getProperty("user.home") + "\\Documents\\HomeFlix";
+ private String streamingPathLinux = System.getProperty("user.home") + "/HomeFlix";
private String color = "ee3523";
private String autoUpdate = "0";
private String mode = "local"; //local or streaming
+ private String local = System.getProperty("user.language")+"_"+System.getProperty("user.country");
private double size = 12;
- private int local = 0;
- private File dir = new File(System.getProperty("user.home") + "/Documents/HomeFlix"); //Windows: C:/Users/"User"/Documents/HomeFlix OSX: has to be tested Linux: has to be tested(shalt not work!)
- private File file = new File(dir + "/config.xml"); //Windows: C:/Users/"User"/Documents/HomeFlix/config.xml OSX: has to be tested Linux: has to be tested(shalt not work!)
- Properties props = new Properties();
+ private ResourceBundle bundle;
private MainWindowController mainWindowController;
+ private File dirWin = new File(System.getProperty("user.home") + "/Documents/HomeFlix"); //Windows: C:/Users/"User"/Documents/HomeFlix
+ private File dirLinux = new File(System.getProperty("user.home") + "/HomeFlix"); //Linux: /home/"User"/HomeFlix
+ private File fileWin = new File(dirWin + "/config.xml"); //Windows: C:/Users/"User"/Documents/HomeFlix/config.xml
+ private File fileLinux = new File(dirLinux + "/config.xml"); //Linux: /home/"User"/HomeFlix/config.xml
@Override
public void start(Stage primaryStage) {
@@ -61,7 +62,7 @@ public class Main extends Application {
mainWindow();
}
- public void mainWindow(){
+ private void mainWindow(){
try {
FXMLLoader loader = new FXMLLoader(Main.class.getResource("MainWindow.fxml"));
@@ -70,64 +71,84 @@ public class Main extends Application {
primaryStage.setMinWidth(900.00);
primaryStage.setResizable(false);
primaryStage.setTitle("Project HomeFlix");
- primaryStage.getIcons().add(new Image(Main.class.getResourceAsStream("/recources/Homeflix_Icon_64x64.png"))); //fügt Anwendungsicon hinzu
+ primaryStage.getIcons().add(new Image(Main.class.getResourceAsStream("/recources/Homeflix_Icon_64x64.png"))); //adds application icon
- mainWindowController = loader.getController(); //verknüpfung von FXMLController und Controller Klasse
- mainWindowController.setAutoUpdate(autoUpdate); //setzt autoupdate
- mainWindowController.setMain(this); //aufruf setMain
+ mainWindowController = loader.getController(); //Link of FXMLController and controller class
+ mainWindowController.setAutoUpdate(autoUpdate); //set auto-update
+ mainWindowController.setMain(this); //call setMain
- //dir exists -> check config.xml TODO nur Windows getestet siehe dir und file
- if(dir.exists() == true){
- if (file.exists() != true) {
+ //Linux if directory exists -> check config.xml
+ if(System.getProperty("os.name").equals("Linux")){
+ if(dirLinux.exists() != true){
+ dirLinux.mkdir();
+ }else if(fileLinux.exists() != true){
mainWindowController.setPath(firstStart());
- mainWindowController.setStreamingPath(streamingPath);
+ mainWindowController.setStreamingPath(streamingPathLinux);
mainWindowController.setColor(color);
mainWindowController.setSize(size);
mainWindowController.setAutoUpdate(autoUpdate);
- mainWindowController.setLoaclUI(local);
+ mainWindowController.setLocal(local);
mainWindowController.setMode(mode);
mainWindowController.saveSettings();
Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //start again (preventing Bugs)
System.exit(0); //finishes itself
- }else{
- loadSettings();
- }
+ }
+ //windows
}else{
- dir.mkdir();
- mainWindowController.setPath(firstStart());
- mainWindowController.setStreamingPath(streamingPath);
- mainWindowController.setColor(color);
- mainWindowController.setSize(size);
- mainWindowController.setAutoUpdate(autoUpdate);
- mainWindowController.setLoaclUI(local);
- mainWindowController.setMode(mode);
- mainWindowController.saveSettings();
- Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //start again (preventing Bugs)
- System.exit(0); //finishes itself
+ if(dirWin.exists() != true){
+ dirWin.mkdir();
+ }else if(fileWin.exists() != true){
+ mainWindowController.setPath(firstStart());
+ mainWindowController.setStreamingPath(streamingPathWin);
+ mainWindowController.setColor(color);
+ mainWindowController.setSize(size);
+ mainWindowController.setAutoUpdate(autoUpdate);
+ mainWindowController.setLocal(local);
+ mainWindowController.setMode(mode);
+ mainWindowController.saveSettings();
+ 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.mainColor.setValue(Color.valueOf(mainWindowController.getColor()));
- mainWindowController.loadData(); //läd die Daten im Controller
+
+ 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); //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
+ //Method for first Start
private String firstStart(){
- Alert alert = new Alert(AlertType.CONFIRMATION); //neuer alert mit filechooser
+ MainWindowController.firststart = true;
+ switch(System.getProperty("user.language")+"_"+System.getProperty("user.country")){
+ case "en_US": bundle = ResourceBundle.getBundle("recources.HomeFlix-Local", Locale.US); //us_english
+ break;
+ case "de_DE": bundle = ResourceBundle.getBundle("recources.HomeFlix-Local", Locale.GERMAN); //German
+ break;
+ default: bundle = ResourceBundle.getBundle("recources.HomeFlix-Local", Locale.US); //default local
+ break;
+ }
+
+ Alert alert = new Alert(AlertType.CONFIRMATION); //new alert with file-chooser
alert.setTitle("Project HomeFlix");
- alert.setHeaderText("Es ist kein Stammverzeichniss für Filme angegeben!"); //TODO translate
- alert.setContentText("Stammverzeichniss angeben?");
+ alert.setHeaderText(bundle.getString("firstStartHeader"));
+ alert.setContentText(bundle.getString("firstStartContent"));
Optional result = alert.showAndWait();
if (result.get() == ButtonType.OK){
@@ -141,26 +162,7 @@ public class Main extends Application {
}
return path;
}
-
- //lädt die einstellungen aus der XML
- public void loadSettings(){
- try {
- InputStream inputStream = new FileInputStream(file);
- props.loadFromXML(inputStream);
- path = props.getProperty("path"); //setzt Propselement in Pfad
- streamingPath = props.getProperty("streamingPath");
- color = props.getProperty("color");
- size = Double.parseDouble(props.getProperty("size"));
- autoUpdate = props.getProperty("autoUpdate");
- local = Integer.parseInt(props.getProperty("local"));
- mode = props.getProperty("mode");
- inputStream.close();
- } catch (IOException e) {
- System.out.println("An error has occurred!");
- e.printStackTrace();
- }
- }
-
+
public static void main(String[] args) {
launch(args);
}
diff --git a/src/application/MainWindow.fxml b/src/application/MainWindow.fxml
index c2aeb84..a455653 100644
--- a/src/application/MainWindow.fxml
+++ b/src/application/MainWindow.fxml
@@ -16,11 +16,13 @@
+
-
+
-
-
+
+
+
@@ -29,7 +31,7 @@
-
+
diff --git a/src/application/MainWindowController.java b/src/application/MainWindowController.java
index 35f68e5..7cc553b 100644
--- a/src/application/MainWindowController.java
+++ b/src/application/MainWindowController.java
@@ -1,7 +1,7 @@
/**
* Project HomeFlix
*
- * Copyright 2016
+ * Copyright 2016-2017
*
* 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
@@ -26,29 +26,25 @@ 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;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
+import java.lang.Thread.State;
import java.math.BigInteger;
import java.net.URI;
import java.net.URISyntaxException;
+import java.sql.SQLException;
+import java.util.ArrayList;
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;
import com.jfoenix.controls.JFXSlider;
import com.jfoenix.controls.JFXTextArea;
import com.jfoenix.controls.JFXTextField;
@@ -57,23 +53,26 @@ import com.jfoenix.controls.JFXToggleButton;
import javafx.animation.FadeTransition;
import javafx.animation.ParallelTransition;
import javafx.animation.TranslateTransition;
-import javafx.beans.property.ReadOnlyObjectWrapper;
-import javafx.beans.property.ReadOnlyStringWrapper;
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.ScrollPane;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.TextArea;
import javafx.scene.control.TreeItem;
import javafx.scene.control.TreeTableColumn;
-import javafx.scene.control.TreeTableColumn.CellDataFeatures;
+import javafx.scene.control.TreeTableColumn.SortType;
import javafx.scene.control.TreeTableView;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
@@ -84,10 +83,11 @@ import javafx.scene.layout.Priority;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
+import javafx.scene.text.TextFlow;
import javafx.stage.DirectoryChooser;
import javafx.util.Duration;
-public class MainWindowController {
+public class MainWindowController {
@FXML
private AnchorPane anpane;
@FXML
@@ -105,6 +105,10 @@ public class MainWindowController {
@FXML
JFXTextArea ta1;
@FXML
+ TextFlow textFlow;
+ @FXML
+ ScrollPane scrollPane;
+ @FXML
private JFXButton menubtn;
@FXML
private JFXButton playbtn;
@@ -141,12 +145,10 @@ public class MainWindowController {
@FXML
public JFXColorPicker mainColor;
@FXML
- public ChoiceBox cbLocal;
+ public ChoiceBox cbLocal = new ChoiceBox<>();
@FXML
public JFXSlider sliderFontSize;
@FXML
- private JFXDialog dialog = new JFXDialog();
- @FXML
private Label versionlbl;
@FXML
private Label sizelbl;
@@ -154,27 +156,27 @@ public class MainWindowController {
private Label aulbl;
@FXML
ImageView image1;
-
+ private ImageView imv1;
@FXML
- TreeItem root = new TreeItem<>(new streamUiData(1, 1, 1, 5.0,"1", "filme","1"));
+ TreeItem root = new TreeItem<>(new streamUiData(1, 1, 1, 5.0,"1", "filme","1", imv1));
@FXML
- TreeTableColumn columnRating = new TreeTableColumn<>("Bewertung");
+ TreeTableColumn columnRating = new TreeTableColumn<>("Rating");
@FXML
- TreeTableColumn columnTitel = new TreeTableColumn<>("Name");
+ TreeTableColumn columnTitel = new TreeTableColumn<>("Titel");
@FXML
- TreeTableColumn columnStreamUrl = new TreeTableColumn<>("Datei Name");
+ TreeTableColumn columnStreamUrl = new TreeTableColumn<>("File Name");
@FXML
- TreeTableColumn columnResolution = new TreeTableColumn<>("Auflösung");
+ TreeTableColumn columnResolution = new TreeTableColumn<>("Resolution");
@FXML
- TreeTableColumn columnYear = new TreeTableColumn<>("Jahr");
+ TreeTableColumn columnYear = new TreeTableColumn<>("Year");
@FXML
- TreeTableColumn columnSeason = new TreeTableColumn<>("Staffel");
+ TreeTableColumn columnSeason = new TreeTableColumn<>("Season");
@FXML
TreeTableColumn columnEpisode = new TreeTableColumn<>("Episode");
@FXML
- private TreeItem streamingRoot =new TreeItem<>(new streamUiData(1 ,1 ,1 ,1.0 ,"1" ,"filme" ,"1"));
+ private TreeItem streamingRoot =new TreeItem<>(new streamUiData(1 ,1 ,1 ,1.0 ,"1" ,"filme" ,"1", imv1));
@FXML
private TableColumn dataNameColumn = new TableColumn<>("Datei Name");
@FXML
@@ -184,20 +186,23 @@ 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";
+ static boolean firststart = false;
+ private int hashA = -2055934614;
+ private String version = "0.5.0";
+ private String buildNumber = "117";
+ private String versionName = "plasma cow";
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");
- private File file = new File(dir + "/config.xml");
+ private File dirWin = new File(System.getProperty("user.home") + "/Documents/HomeFlix");
+ private File dirLinux = new File(System.getProperty("user.home") + "/HomeFlix");
+ private File fileWin = new File(dirWin + "/config.xml");
+ private File fileLinux = new File(dirLinux + "/config.xml");
String errorUpdateD;
String errorUpdateV;
private String errorPlay;
private String errorOpenStream;
private String errorMode;
- @SuppressWarnings("unused")
private String errorLoad;
private String errorSave;
String noFilmFound;
@@ -211,7 +216,10 @@ public class MainWindowController {
private String Name;
private String datPath;
private String autoUpdate;
- private String mode;
+ private String mode;
+ @SuppressWarnings("unused")
+ private String ratingSortType;
+ private String local;
String title;
String year;
String rating;
@@ -232,15 +240,14 @@ public class MainWindowController {
private int last;
private int selected;
private int next;
- private int local;
private File selectedFolder;
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");
+ private ObservableList locals = FXCollections.observableArrayList("english (en_US)", "deutsch (de_DE)");
+ ObservableList newData = FXCollections.observableArrayList(); //TODO rename to localFilms
+ ObservableList streamData = FXCollections.observableArrayList(); //TODO rename to streamingFilms
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,13 +258,15 @@ 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 MenuItem like = new MenuItem("like");
+ private MenuItem dislike = new MenuItem("dislike"); //TODO one option (like or dislike)
+ private ContextMenu menu = new ContextMenu(like, dislike);
Properties props = new Properties();
private updater Updater;
private apiQuery ApiQuery;
- private DBController dbController;
+ DBController dbController;
- //wenn menubtn clicked
/**
* TODO change value of Text-color change
*/
@@ -298,7 +307,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 == ""){
@@ -330,7 +338,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)); //open the streaming Url in browser (TODO other option?)
} catch (URISyntaxException | IOException e) {
showErrorMsg(errorOpenStream, (IOException) e);
}
@@ -345,7 +353,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();
}
@@ -388,7 +396,7 @@ public class MainWindowController {
}
/**
- * TODO zusätzliche infos über die dateien
+ * TODO additional info about the "streaming.json"
*/
@FXML
private void streamingSettingsBtnclicked(){
@@ -419,7 +427,7 @@ public class MainWindowController {
addDataUI();
settingsAnchor.setVisible(false);
streamingSettingsAnchor.setVisible(false);
- sideMenuSlideOut(); //disables sidemenu
+ sideMenuSlideOut(); //disables side-menu
menutrue = false;
settingstrue = false;
streamingSettingsTrue = false;
@@ -427,12 +435,6 @@ public class MainWindowController {
@FXML
private void debugBtnclicked(){
-// dbController.ausgeben();
- dbController.getFavStatus("Zootopia");
- dbController.favorisieren("Zootopia");
- dbController.getFavStatus("Zootopia");
- dbController.defavorisieren("Zootopia");
- dbController.getFavStatus("Zootopia");
//for testing
}
@@ -470,7 +472,13 @@ public class MainWindowController {
@FXML
private void updateBtnAction(){
- Updater.update(buildURL, downloadLink, aktBuildNumber, buildNumber);
+// Updater.update(buildURL, downloadLink, aktBuildNumber, buildNumber);
+ System.out.println(Updater.getState());
+ if(Updater.getState() == State.NEW){
+ Updater.start();
+ }else{
+ Updater.run();
+ }
}
@FXML
@@ -508,138 +516,106 @@ public class MainWindowController {
}
- //"Main" Methode die beim start von der Klasse Main aufgerufen wird, initialiesirung der einzellnen UI-Objekte
- public void setMain(Main main) {
-
- loadSettings();
- initTabel();
- initActions();
-
- Updater = new updater(this);
+ //"Main" Method called in Main.java main() when starting
+ void setMain(Main main) {
+ Updater = new updater(this,buildURL, downloadLink, aktBuildNumber, buildNumber);
ApiQuery = new apiQuery(this);
- dbController = new DBController(this);
-
- System.out.println("Mode: "+mode); //TODO debugging
-
- loadStreamingSettings();
- dbController.main();
-
- debugBtn.setDisable(false); //debugging btn for tests
- debugBtn.setVisible(true);
-
- tfPath.setText(getPath());
-
- sliderFontSize.setValue(getSize());
-
- cbLocal.setItems(locals);
-
- updateBtn.setFont(Font.font("System", 12));
-
- if(autoUpdate.equals("1")){
- autoupdateBtn.setSelected(true);
- Updater.update(buildURL, downloadLink, aktBuildNumber, buildNumber);
- }else{
- autoupdateBtn.setSelected(false);
- }
-
- ta1.setWrapText(true);
- ta1.setEditable(false);
- ta1.setFont(Font.font("System", getSize()));
+ dbController = new DBController(this);
}
- //initialisierung der Tabellen für filme(beide Modi) und Streaming-Settings
- @SuppressWarnings({ "unchecked", "rawtypes" })
- private void initTabel(){
+ //Initialize the tables (treeTableViewfilm and tableViewStreamingdata)
+ @SuppressWarnings({ "unchecked"}) //TODO
+ void initTabel(){
- //filmtabelle
- columnRating.setMaxWidth(120);
- columnTitel.setMaxWidth(240);
+ //film Table
+ columnRating.setMaxWidth(80);
+ columnTitel.setMaxWidth(260);
columnStreamUrl.setMaxWidth(0);
- dataNameColumn.setPrefWidth(130);
+ dataNameColumn.setPrefWidth(150);
dataNameEndColumn.setPrefWidth(170);
+ columnRating.setStyle("-fx-alignment: CENTER;");
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
+ columnTitel.setCellValueFactory(cellData -> cellData.getValue().getValue().titelProperty());
+ columnRating.setCellValueFactory(cellData -> cellData.getValue().getValue().imageProperty());
+ columnStreamUrl.setCellValueFactory(cellData -> cellData.getValue().getValue().streamUrlProperty());
+ columnResolution.setCellValueFactory(cellData -> cellData.getValue().getValue().resolutionProperty());
+ columnYear.setCellValueFactory(cellData -> cellData.getValue().getValue().yearProperty().asObject());
+ columnSeason.setCellValueFactory(cellData -> cellData.getValue().getValue().seasonProperty().asObject());
+ 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
+ //Change-listener for TreeTable
treeTableViewfilm.getSelectionModel().selectedItemProperty().addListener(new ChangeListener