diff --git a/.classpath b/.classpath
index 0f49fcb..4174765 100644
--- a/.classpath
+++ b/.classpath
@@ -4,8 +4,8 @@
-
-
+
+
diff --git a/.gitignore b/.gitignore
index cb76115..0cf5b30 100644
--- a/.gitignore
+++ b/.gitignore
@@ -46,4 +46,5 @@ Network Trash Folder
Temporary Items
.apdisk
config.xml
+.directory
diff --git a/DB_PATH b/DB_PATH
deleted file mode 100644
index 9e5295d..0000000
Binary files a/DB_PATH and /dev/null differ
diff --git a/README.md b/README.md
index 0507d9f..dbfa37a 100644
--- a/README.md
+++ b/README.md
@@ -6,13 +6,12 @@ The dev branch is **only merged** into master when a **new release** is released
Librarys used in this Project:
JFoenix: https://github.com/jfoenixadmin/JFoenix
-minimal-json: https://github.com/ralfstx/minimal-json
-Commons Lang: https://commons.apache.org/proper/commons-lang/
+minimal-json: https://github.com/ralfstx/minimal-json
sqlite-jdbc: https://github.com/xerial/sqlite-jdbc
## Installation
[wiki](https://github.com/Seil0/Project-HomeFlix/wiki)
-Project HomeFlix © 2016-2017 Software Development Kellerkinder (SDK)
+Project HomeFlix © 2016-2017 Kellerkinder ([Seil0](https://github.com/Seil0), [Windoofs](https://github.com/Windoofs))
www.kellerkinder.xyz
diff --git a/bin/.gitignore b/bin/.gitignore
new file mode 100644
index 0000000..b42b859
--- /dev/null
+++ b/bin/.gitignore
@@ -0,0 +1 @@
+/application/
diff --git a/bin/application/DBController.class b/bin/application/DBController.class
index 4a9c489..9f604cf 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 04ee8bc..9a4b3ac 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 a455653..803f728 100644
--- a/bin/application/MainWindow.fxml
+++ b/bin/application/MainWindow.fxml
@@ -3,11 +3,11 @@
-
+
@@ -20,9 +20,12 @@
-
-
-
+
+
+
+
+
+
@@ -31,7 +34,7 @@
-
+
@@ -78,8 +81,8 @@
-
-
+
+
diff --git a/bin/application/MainWindowController$1.class b/bin/application/MainWindowController$1.class
index 68b1b57..c392df7 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 24ed899..d6a1ab4 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 05dc50b..fc86b80 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 dbce121..66c3735 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 1e47f18..64a6d23 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 ea12f4a..5f0c70e 100644
Binary files a/bin/application/MainWindowController$6.class and b/bin/application/MainWindowController$6.class differ
diff --git a/bin/application/MainWindowController$7.class b/bin/application/MainWindowController$7.class
index 176f270..9f1378c 100644
Binary files a/bin/application/MainWindowController$7.class and b/bin/application/MainWindowController$7.class differ
diff --git a/bin/application/MainWindowController.class b/bin/application/MainWindowController.class
index 76ac617..bd3b673 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 9de2779..3979347 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
deleted file mode 100644
index 034c7a2..0000000
Binary files a/bin/application/streamUiData.class and /dev/null differ
diff --git a/bin/application/tableData.class b/bin/application/tableData.class
new file mode 100644
index 0000000..76223fc
Binary files /dev/null and b/bin/application/tableData.class differ
diff --git a/bin/application/updater.class b/bin/application/updater.class
index dd8ed1e..2185f2c 100644
Binary files a/bin/application/updater.class and b/bin/application/updater.class differ
diff --git a/bin/libraries/commons-io-2.5.jar b/bin/libraries/commons-io-2.5.jar
new file mode 100644
index 0000000..107b061
Binary files /dev/null and b/bin/libraries/commons-io-2.5.jar differ
diff --git a/bin/libraries/commons-lang3-3.5.jar b/bin/libraries/commons-lang3-3.5.jar
deleted file mode 100644
index 6328c8d..0000000
Binary files a/bin/libraries/commons-lang3-3.5.jar and /dev/null differ
diff --git a/bin/libraries/jfoenix-1.2.0.jar b/bin/libraries/jfoenix-1.2.0.jar
deleted file mode 100644
index 550230d..0000000
Binary files a/bin/libraries/jfoenix-1.2.0.jar and /dev/null differ
diff --git a/bin/libraries/jfoenix-1.3.0.jar b/bin/libraries/jfoenix-1.3.0.jar
new file mode 100644
index 0000000..37e7860
Binary files /dev/null and b/bin/libraries/jfoenix-1.3.0.jar differ
diff --git a/bin/recources/HomeFlix-Local_de_DE.properties b/bin/recources/HomeFlix-Local_de_DE.properties
index 4fb3706..bfa591e 100644
--- a/bin/recources/HomeFlix-Local_de_DE.properties
+++ b/bin/recources/HomeFlix-Local_de_DE.properties
@@ -8,6 +8,7 @@ openFolder = Ordner \u00F6ffnen
chooseFolder = Ordner ausw\u00E4hlen
fontSize = Schriftgr\u00F6\u00DFe:
checkUpdates = Auf Update pr\u00FCfen
+checkingUpdates = Es wird nach Updates gesucht...
updateBtnavail = Update verf\u00FCgbar
updateBtnNotavail = Kein Update verf\u00FCgbar
autoUpdate = beim Start nach Updates suchen:
diff --git a/bin/recources/HomeFlix-Local_en_US.properties b/bin/recources/HomeFlix-Local_en_US.properties
index 41de6ea..e221122 100644
--- a/bin/recources/HomeFlix-Local_en_US.properties
+++ b/bin/recources/HomeFlix-Local_en_US.properties
@@ -8,6 +8,7 @@ openFolder = open Folder
chooseFolder = choose Directory
fontSize = font size:
checkUpdates = check for updates
+checkingUpdates = checking for updates...
updateBtnavail = update available
updateBtnNotavail = no update available
autoUpdate = check at startup for updates:
diff --git a/src/application/DBController.java b/src/application/DBController.java
index 3dc251a..9e0be27 100644
--- a/src/application/DBController.java
+++ b/src/application/DBController.java
@@ -1,7 +1,7 @@
/**
+ * @author Jannik
* DBController for Project HomeFlix
* connection is in manual commit!
- * TODO arraylists not string -> streamUIData
*/
package application;
@@ -23,17 +23,21 @@ import com.eclipsesource.json.Json;
import com.eclipsesource.json.JsonArray;
import com.eclipsesource.json.JsonObject;
import com.eclipsesource.json.JsonValue;
-
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
+import javafx.scene.text.Font;
+import javafx.scene.text.FontWeight;
+import javafx.scene.text.Text;
public class DBController {
- public DBController(MainWindowController m) {
+ public DBController(MainWindowController m, Main main) {
mainWindowController = m;
+ this.main = main;
}
private MainWindowController mainWindowController;
+ private Main main;
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");
@@ -57,15 +61,13 @@ public class DBController {
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 what to do with this
-
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());
}
+
+ //close connection -> at the moment this kills the program
// finally {
// try {
// if (connection != null)
@@ -85,8 +87,8 @@ public class DBController {
try {
Statement stmt = connection.createStatement();
- 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.executeUpdate("create table if not exists film_local (rating, titel, streamUrl, favIcon, cached)");
+ stmt.executeUpdate("create table if not exists film_streaming (year, season, episode, rating, resolution, titel, streamUrl, favIcon, cached)");
stmt.close();
} catch (SQLException e1) {
e1.printStackTrace();
@@ -144,13 +146,12 @@ public class DBController {
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 (?, ?, ?, ?, ?, ?, ?, ?)");
+ 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 ""
@@ -161,7 +162,8 @@ public class DBController {
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
+ ps.setBoolean(5, false);
+ ps.addBatch(); // add command to prepared statement
}
}
@@ -182,6 +184,7 @@ public class DBController {
psS.setString(6, item.asObject().getString("titel",""));
psS.setString(7, item.asObject().getString("streamUrl", ""));
psS.setString(8, "favorite_border_black");
+ psS.setBoolean(9, false);
psS.addBatch(); // add command to prepared statement
}
} catch (IOException e) {
@@ -189,7 +192,7 @@ public class DBController {
}
}
}
- ps.executeBatch(); //execute statement to write entries into table
+ ps.executeBatch(); //execute statement to write entries into table
psS.executeBatch();
connection.commit();
ps.close();
@@ -203,15 +206,26 @@ public class DBController {
try {
try {
- checkAddEntry();
+ checkAddEntry(); //check if added a new file
} catch (IOException e) {
e.printStackTrace();
- } //check if added a new file
- checkRemoveEntry(); //check if removed a file
+ }
+ checkRemoveEntry(); //check if removed a file
} catch (SQLException e) {
e.printStackTrace();
}
}
+
+ //start of cache-table
+ try {
+ Statement stmt = connection.createStatement();
+ stmt.executeUpdate( "create table if not exists cache (streamUrl, Title, Year, Rated, Released, Runtime, Genre, Director, Writer," //streamUrl is primary key
+ +" Actors, Plot, Language, Country, Awards, Metascore, imdbRating, imdbVotes, imdbID, Type, Poster, Response)");
+ stmt.close();
+ } catch (SQLException e1) {
+ e1.printStackTrace();
+ }
+
}
//loading data from database to mainWindowController
@@ -220,24 +234,24 @@ public class DBController {
try {
//load local Data
Statement stmt = connection.createStatement();
- ResultSet rs = stmt.executeQuery("SELECT * FROM film_local");
+ ResultSet rs = stmt.executeQuery("SELECT * FROM film_local ORDER BY titel");
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)));
+ mainWindowController.localFilms.add( new tableData(1, 1, 1, rs.getDouble(1), "1", rs.getString(2), rs.getString(3), new ImageView(favorite_black),rs.getBoolean(5)));
}else{
- mainWindowController.newData.add( new streamUiData(1, 1, 1, rs.getDouble(1), "1", rs.getString(2), rs.getString(3), new ImageView(favorite_border_black)));
+ mainWindowController.localFilms.add( new tableData(1, 1, 1, rs.getDouble(1), "1", rs.getString(2), rs.getString(3), new ImageView(favorite_border_black),rs.getBoolean(5)));
}
}
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;");
+ //load streaming Data FIXME check if there are streaming data before loading -> maybe there is an issue now
+ rs = stmt.executeQuery("SELECT * FROM film_streaming ORDER BY titel;");
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)));
+ mainWindowController.streamingFilms.add(new tableData(rs.getInt(1), rs.getInt(2), rs.getInt(3), rs.getDouble(4), rs.getString(5), rs.getString(6), rs.getString(7), new ImageView(favorite_black),rs.getBoolean(9)));
}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)));
+ mainWindowController.streamingFilms.add(new tableData(rs.getInt(1), rs.getInt(2), rs.getInt(3), rs.getDouble(4), rs.getString(5), rs.getString(6), rs.getString(7), new ImageView(favorite_border_black),rs.getBoolean(9)));
}
}
stmt.close();
@@ -250,7 +264,7 @@ public class DBController {
}
//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
+ //FIXME 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;
@@ -259,9 +273,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.newData.set(i, new streamUiData(1, 1, 1, rs.getDouble(1), "1", rs.getString(2), rs.getString(3), new ImageView(favorite_black)));
+ mainWindowController.localFilms.set(i, new tableData(1, 1, 1, rs.getDouble(1), "1", rs.getString(2), rs.getString(3), new ImageView(favorite_black),rs.getBoolean(5)));
}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)));
+ mainWindowController.localFilms.set(i, new tableData(1, 1, 1, rs.getDouble(1), "1", rs.getString(2), rs.getString(3), new ImageView(favorite_border_black),rs.getBoolean(5)));
}
stmt.close();
rs.close();
@@ -270,9 +284,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), new ImageView(favorite_black)));
+ mainWindowController.streamingFilms.set(i,new tableData(rs.getInt(1), rs.getInt(2), rs.getInt(3), rs.getDouble(4), rs.getString(5), rs.getString(6), rs.getString(7), new ImageView(favorite_black),rs.getBoolean(9)));
}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)));
+ mainWindowController.streamingFilms.set(i,new tableData(rs.getInt(1), rs.getInt(2), rs.getInt(3), rs.getDouble(4), rs.getString(5), rs.getString(6), rs.getString(7), new ImageView(favorite_border_black),rs.getBoolean(9)));
}
stmt.close();
rs.close();
@@ -282,7 +296,10 @@ public class DBController {
}
}
}
-
+ /**
+ * check if there are any entries that have been removed from the film-directory
+ * @throws SQLException
+ */
private void checkRemoveEntry() throws SQLException{
System.out.println("checking for entrys to remove to DB ...");
Statement stmt = connection.createStatement();
@@ -309,17 +326,25 @@ public class DBController {
}
- private void checkAddEntry() throws SQLException, FileNotFoundException, IOException{ //TODO sort alphabetical
+ /**
+ * check if there are new films in the film-directory
+ * @throws SQLException
+ * @throws FileNotFoundException
+ * @throws IOException
+ * if lastName != filmsStreamData.get(b) then set i = 0, file changed
+ */
+ private void checkAddEntry() throws SQLException, FileNotFoundException, IOException{
+ String lastName = "";
System.out.println("checking for entrys to add to DB ...");
String[] entries = new File(mainWindowController.getPath()).list();
Statement stmt = connection.createStatement();
- PreparedStatement ps = connection.prepareStatement("insert into film_streaming values (?, ?, ?, ?, ?, ?, ?, ?)");;
+ PreparedStatement ps = connection.prepareStatement("insert into film_streaming values (?, ?, ?, ?, ?, ?, ?, ?, ?)");
int i=0;
for(int a=0; a nameText = new ArrayList();
+ ArrayList responseText = new ArrayList();
+ String fontFamily = main.getFONT_FAMILY();
+ Image im;
+ int fontSize = (int) Math.round(mainWindowController.size);
+ int j=2;
+
+ nameText.add(0, new Text(mainWindowController.title+": "));
+ nameText.add(1, new Text(mainWindowController.year+": "));
+ nameText.add(2, new Text(mainWindowController.rating+": "));
+ nameText.add(3, new Text(mainWindowController.publishedOn+": "));
+ nameText.add(4, new Text(mainWindowController.duration+": "));
+ nameText.add(5, new Text(mainWindowController.genre+": "));
+ nameText.add(6, new Text(mainWindowController.director+": "));
+ nameText.add(7, new Text(mainWindowController.writer+": "));
+ nameText.add(8, new Text(mainWindowController.actors+": "));
+ nameText.add(9, new Text(mainWindowController.plot+": "));
+ nameText.add(10, new Text(mainWindowController.language+": "));
+ nameText.add(11, new Text(mainWindowController.country+": "));
+ nameText.add(12, new Text(mainWindowController.awards+": "));
+ nameText.add(13, new Text(mainWindowController.metascore+": "));
+ nameText.add(14, new Text(mainWindowController.imdbRating+": "));
+ nameText.add(15, new Text(mainWindowController.type+": "));
+
+ for(int i=0; i<15; i++){
+ responseText.add(new Text(rs.getString(j)+"\n"));
+ j++;
+ }
+ responseText.add(new Text(rs.getString(19)+"\n"));
+ im = new Image(new File(rs.getString(20)).toURI().toString());
+
+ stmt.close();
+ rs.close();
+
+ for(int i=0; i 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(streamingPathLinux);
- 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
- }
- //windows
- }else{
- 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
- }
+ /**Linux else Windows, check if directory & config exist
+ * Windows: config file: C:/Users/"User"/Documents/HomeFlix/config.xml
+ * directory: C:/Users/"User"/Documents/HomeFlix
+ * Linux: config file: /home/"User"/HomeFlix/config.xml
+ * directory: /home/"User"/HomeFlix
+ */
+ if(System.getProperty("os.name").equals("Linux")) {
+ directory = new File(dirLinux);
+ settingsFile = new File(dirLinux + "/config.xml");
+ } else {
+ directory = new File(dirWin);
+ settingsFile = new File(dirWin + "/config.xml");
+ }
+
+ posterCache = new File(directory+"/posterCache");
+
+ if(!settingsFile.exists()){
+ directory.mkdir();
+ mainWindowController.setPath(firstStart());
+ mainWindowController.setStreamingPath(directory.getAbsolutePath());
+ mainWindowController.setColor(COLOR);
+ mainWindowController.setSize(FONT_SIZE);
+ mainWindowController.setAutoUpdate(AUTO_UPDATE);
+ mainWindowController.setLocal(local);
+ mainWindowController.setMode(mode);
+ mainWindowController.saveSettings();
+ Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //start again (preventing Bugs)
+ System.exit(0); //finishes it self
+ }
+
+ if(!posterCache.exists()) {
+ posterCache.mkdir();
}
mainWindowController.loadSettings();
@@ -166,4 +170,20 @@ public class Main extends Application {
public static void main(String[] args) {
launch(args);
}
+
+ public String getFONT_FAMILY() {
+ return FONT_FAMILY;
+ }
+
+ public void setFONT_FAMILY(String FONT_FAMILY) {
+ this.FONT_FAMILY = FONT_FAMILY;
+ }
+
+ public File getPosterCache() {
+ return posterCache;
+ }
+
+ public void setPosterCache(File posterCache) {
+ this.posterCache = posterCache;
+ }
}
\ No newline at end of file
diff --git a/src/application/MainWindow.fxml b/src/application/MainWindow.fxml
index a455653..803f728 100644
--- a/src/application/MainWindow.fxml
+++ b/src/application/MainWindow.fxml
@@ -3,11 +3,11 @@
-
+
@@ -20,9 +20,12 @@
-
-
-
+
+
+
+
+
+
@@ -31,7 +34,7 @@
-
+
@@ -78,8 +81,8 @@
-
-
+
+
diff --git a/src/application/MainWindowController.java b/src/application/MainWindowController.java
index 7cc553b..14131af 100644
--- a/src/application/MainWindowController.java
+++ b/src/application/MainWindowController.java
@@ -41,12 +41,9 @@ import java.util.ArrayList;
import java.util.Locale;
import java.util.Properties;
import java.util.ResourceBundle;
-import org.apache.commons.lang3.SystemUtils;
-
import com.jfoenix.controls.JFXButton;
import com.jfoenix.controls.JFXColorPicker;
import com.jfoenix.controls.JFXSlider;
-import com.jfoenix.controls.JFXTextArea;
import com.jfoenix.controls.JFXTextField;
import com.jfoenix.controls.JFXToggleButton;
@@ -99,17 +96,15 @@ public class MainWindowController {
@FXML
private VBox sideMenuVBox;
@FXML
- private TreeTableView treeTableViewfilm;
+ private TreeTableView treeTableViewfilm;
@FXML
- private TableView tableViewStreamingdata;
- @FXML
- JFXTextArea ta1;
+ private TableView tableViewStreamingdata;
@FXML
TextFlow textFlow;
@FXML
ScrollPane scrollPane;
@FXML
- private JFXButton menubtn;
+ private JFXButton menubtn; //TODO switch to hamburger menu
@FXML
private JFXButton playbtn;
@FXML
@@ -159,37 +154,37 @@ public class MainWindowController {
private ImageView imv1;
@FXML
- TreeItem root = new TreeItem<>(new streamUiData(1, 1, 1, 5.0,"1", "filme","1", imv1));
+ TreeItem root = new TreeItem<>(new tableData(1, 1, 1, 5.0,"1", "filme","1", imv1, false));
@FXML
- TreeTableColumn columnRating = new TreeTableColumn<>("Rating");
+ TreeTableColumn columnRating = new TreeTableColumn<>("Rating");
@FXML
- TreeTableColumn columnTitel = new TreeTableColumn<>("Titel");
+ TreeTableColumn columnTitel = new TreeTableColumn<>("Titel");
@FXML
- TreeTableColumn columnStreamUrl = new TreeTableColumn<>("File Name");
+ TreeTableColumn columnStreamUrl = new TreeTableColumn<>("File Name");
@FXML
- TreeTableColumn columnResolution = new TreeTableColumn<>("Resolution");
+ TreeTableColumn columnResolution = new TreeTableColumn<>("Resolution");
@FXML
- TreeTableColumn columnYear = new TreeTableColumn<>("Year");
+ TreeTableColumn columnYear = new TreeTableColumn<>("Year");
@FXML
- TreeTableColumn columnSeason = new TreeTableColumn<>("Season");
+ TreeTableColumn columnSeason = new TreeTableColumn<>("Season");
@FXML
- TreeTableColumn columnEpisode = new TreeTableColumn<>("Episode");
+ TreeTableColumn columnEpisode = new TreeTableColumn<>("Episode");
@FXML
- private TreeItem streamingRoot =new TreeItem<>(new streamUiData(1 ,1 ,1 ,1.0 ,"1" ,"filme" ,"1", imv1));
+ private TreeItem streamingRoot =new TreeItem<>(new tableData(1 ,1 ,1 ,1.0 ,"1" ,"filme" ,"1", imv1, false));
@FXML
- private TableColumn dataNameColumn = new TableColumn<>("Datei Name");
+ private TableColumn dataNameColumn = new TableColumn<>("Datei Name");
@FXML
- private TableColumn dataNameEndColumn = new TableColumn<>("Datei Name mit Endung");
-
+ private TableColumn dataNameEndColumn = new TableColumn<>("Datei Name mit Endung");
- private boolean menutrue = false; //saves the position of menubtn (opened or closed)
+ private boolean menutrue = false; //saves the position of menuBtn (opened or closed)
private boolean settingstrue = false;
private boolean streamingSettingsTrue = false;
+ private boolean autoUpdate = false;
static boolean firststart = false;
private int hashA = -2055934614;
- private String version = "0.5.0";
- private String buildNumber = "117";
+ private String version = "0.5.1";
+ private String buildNumber = "125";
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";
@@ -200,22 +195,21 @@ public class MainWindowController {
String errorUpdateD;
String errorUpdateV;
+ String noFilmFound;
private String errorPlay;
private String errorOpenStream;
private String errorMode;
private String errorLoad;
private String errorSave;
- String noFilmFound;
private String infoText;
private String linuxBugText;
private String vlcNotInstalled;
- private String aktBuildNumber;
+ private String currentWorkingDirectory;
private String path;
private String streamingPath;
private String color;
- private String Name;
+ private String name;
private String datPath;
- private String autoUpdate;
private String mode;
@SuppressWarnings("unused")
private String ratingSortType;
@@ -236,7 +230,7 @@ public class MainWindowController {
String metascore;
String imdbRating;
String type;
- private double size;
+ double size;
private int last;
private int selected;
private int next;
@@ -244,11 +238,11 @@ public class MainWindowController {
private File selectedStreamingFolder;
ResourceBundle bundle;
- private ObservableList filterData = FXCollections.observableArrayList();
- 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 ObservableList filterData = FXCollections.observableArrayList();
+ private ObservableList locals = FXCollections.observableArrayList("English (en_US)", "Deutsch (de_DE)");
+ ObservableList localFilms = FXCollections.observableArrayList();
+ ObservableList streamingFilms = FXCollections.observableArrayList();
+ ObservableList streamingData = FXCollections.observableArrayList();
private 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"));
private ImageView skip_previous_white = new ImageView(new Image("recources/icons/ic_skip_previous_white_18dp_1x.png"));
@@ -263,6 +257,7 @@ public class MainWindowController {
private ContextMenu menu = new ContextMenu(like, dislike);
Properties props = new Properties();
+ private Main main;
private updater Updater;
private apiQuery ApiQuery;
DBController dbController;
@@ -293,8 +288,9 @@ public class MainWindowController {
@FXML
private void playbtnclicked(){
- if(SystemUtils.IS_OS_LINUX){
- System.out.println("This is Linux");
+ System.out.println(System.getProperty("os.name"));
+ if(System.getProperty("os.name").contains("Linux")){
+ System.out.println("This is "+System.getProperty("os.name"));
String line;
String output = "";
Process p;
@@ -320,6 +316,7 @@ public class MainWindowController {
alert.setHeaderText("");
alert.setTitle("Info");
alert.setContentText(linuxBugText);
+ alert.initOwner(main.primaryStage);
alert.showAndWait();
}else{
try {
@@ -328,8 +325,8 @@ public class MainWindowController {
showErrorMsg(errorPlay,e);
}
}
- }else if(SystemUtils.IS_OS_WINDOWS || SystemUtils.IS_OS_MAC_OSX){
- System.out.println("This is Windows or Mac OSX");
+ }else if(System.getProperty("os.name").contains("Windows") || System.getProperty("os.name").contains("Mac OS X")){
+ System.out.println("This is "+System.getProperty("os.name"));
if(mode.equals("local")){
try {
Desktop.getDesktop().open(new File(getPath()+"\\"+ datPath));
@@ -338,7 +335,7 @@ public class MainWindowController {
}
}else if(mode.equals("streaming")){
try {
- Desktop.getDesktop().browse(new URI(datPath)); //open the streaming Url in browser (TODO 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);
}
@@ -375,6 +372,7 @@ public class MainWindowController {
alert.setTitle("Info");
alert.setHeaderText("Project HomeFlix");
alert.setContentText(infoText);
+ alert.initOwner(main.primaryStage);
alert.showAndWait();
}
@@ -472,21 +470,21 @@ public class MainWindowController {
@FXML
private void updateBtnAction(){
-// Updater.update(buildURL, downloadLink, aktBuildNumber, buildNumber);
System.out.println(Updater.getState());
if(Updater.getState() == State.NEW){
Updater.start();
}else{
Updater.run();
}
+
}
@FXML
private void autoupdateBtnAction(){
- if(autoUpdate.equals("0")){
- setAutoUpdate("1");
+ if(autoUpdate){
+ setAutoUpdate(false);
}else{
- setAutoUpdate("0");
+ setAutoUpdate(true);
}
saveSettings();
}
@@ -516,11 +514,14 @@ public class MainWindowController {
}
- //"Main" Method called in Main.java main() when starting
+ /**"Main" Method called in Main.java main() when starting
+ * Initialize other objects: Updater, dbController and ApiQuery
+ */
void setMain(Main main) {
- Updater = new updater(this,buildURL, downloadLink, aktBuildNumber, buildNumber);
- ApiQuery = new apiQuery(this);
- dbController = new DBController(this);
+ this.main = main;
+ Updater = new updater(this,buildURL, downloadLink, buildNumber);
+ dbController = new DBController(this, this.main);
+ ApiQuery = new apiQuery(this, dbController, this.main);
}
//Initialize the tables (treeTableViewfilm and tableViewStreamingdata)
@@ -532,7 +533,7 @@ public class MainWindowController {
columnTitel.setMaxWidth(260);
columnStreamUrl.setMaxWidth(0);
dataNameColumn.setPrefWidth(150);
- dataNameEndColumn.setPrefWidth(170);
+ dataNameEndColumn.setPrefWidth(220);
columnRating.setStyle("-fx-alignment: CENTER;");
treeTableViewfilm.setRoot(root);
@@ -540,7 +541,7 @@ public class MainWindowController {
treeTableViewfilm.setShowRoot(false);
//write content into cell
- columnTitel.setCellValueFactory(cellData -> cellData.getValue().getValue().titelProperty());
+ columnTitel.setCellValueFactory(cellData -> cellData.getValue().getValue().titleProperty());
columnRating.setCellValueFactory(cellData -> cellData.getValue().getValue().imageProperty());
columnStreamUrl.setCellValueFactory(cellData -> cellData.getValue().getValue().streamUrlProperty());
columnResolution.setCellValueFactory(cellData -> cellData.getValue().getValue().resolutionProperty());
@@ -554,16 +555,30 @@ public class MainWindowController {
//Change-listener for TreeTable
treeTableViewfilm.getSelectionModel().selectedItemProperty().addListener(new ChangeListener