diff --git a/.classpath b/.classpath
index bf77390..e83910a 100644
--- a/.classpath
+++ b/.classpath
@@ -1,11 +1,27 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.directory b/.directory
deleted file mode 100644
index 4209d5a..0000000
--- a/.directory
+++ /dev/null
@@ -1,3 +0,0 @@
-[Dolphin]
-Timestamp=2016,8,15,12,18,4
-Version=3
diff --git a/.gitignore b/.gitignore
index 0cf5b30..f8db64b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -47,4 +47,6 @@ Temporary Items
.apdisk
config.xml
.directory
+target/
+apiKeys.json
diff --git a/.project b/.project
index b4e5ab5..01f0bec 100644
--- a/.project
+++ b/.project
@@ -1,6 +1,6 @@
- Project HomeFlix
+ Project-HomeFlix
@@ -11,14 +11,13 @@
- org.eclipse.xtext.ui.shared.xtextBuilder
+ org.eclipse.m2e.core.maven2Builder
- org.eclipse.xtext.ui.shared.xtextNature
org.eclipse.jdt.core.javanature
- org.eclipse.fx.ide.css.nature
+ org.eclipse.m2e.core.maven2Nature
diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..839d647
--- /dev/null
+++ b/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,5 @@
+eclipse.preferences.version=1
+encoding//src/main/java=UTF-8
+encoding//src/main/resources=UTF-8
+encoding//src/test/java=UTF-8
+encoding/=UTF-8
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
index a698e59..4a6c6b8 100644
--- a/.settings/org.eclipse.jdt.core.prefs
+++ b/.settings/org.eclipse.jdt.core.prefs
@@ -1,12 +1,5 @@
eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.8
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.8
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=9
+org.eclipse.jdt.core.compiler.compliance=9
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=9
diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 0000000..f897a7f
--- /dev/null
+++ b/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
new file mode 100644
index 0000000..5b38789
--- /dev/null
+++ b/CODE_OF_CONDUCT.md
@@ -0,0 +1,46 @@
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
+
+## Our Standards
+
+Examples of behavior that contributes to creating a positive environment include:
+
+* Using welcoming and inclusive language
+* Being respectful of differing viewpoints and experiences
+* Gracefully accepting constructive criticism
+* Focusing on what is best for the community
+* Showing empathy towards other community members
+
+Examples of unacceptable behavior by participants include:
+
+* The use of sexualized language or imagery and unwelcome sexual attention or advances
+* Trolling, insulting/derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or electronic address, without explicit permission
+* Other conduct which could reasonably be considered inappropriate in a professional setting
+
+## Our Responsibilities
+
+Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
+
+Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
+
+## Scope
+
+This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at admin@kellerkinder.xyz. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
+
+Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
+
+[homepage]: http://contributor-covenant.org
+[version]: http://contributor-covenant.org/version/1/4/
diff --git a/README.md b/README.md
index c12c841..7a798c0 100644
--- a/README.md
+++ b/README.md
@@ -1,20 +1,24 @@
+![Total Downloads](https://img.shields.io/github/downloads/Seil0/Project-HomeFlix/total.svg?style=flat-square)
+[![Latest](https://img.shields.io/github/release/Seil0/Project-HomeFlix/all.svg?style=flat-square)](https://github.com/Seil0/Project-HomeFlix/releases)
+[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg?style=flat-square)](https://www.gnu.org/licenses/gpl-3.0)
+
# Project-HomeFlix
+Project-HomeFlix is a Kellerkinder Project, that alowes you to sort all your local saved movies in clean UI. Project-HomeFlix is free and open-source software and uses other open-source projects to provied a nice user experience.
+## Installation
+Simply download the Project-HomeFlix.jar from [releases](https://github.com/Seil0/Project-HomeFlix/releases), make sure you have the latest version of java 8 oracle jre/jdk installed, open the .jar file. If you need additional information pleas visit our [wiki](https://github.com/Seil0/Project-HomeFlix/wiki).
-Project HomeFlix is a Kellerkinder Project, that alowes you to sort all your local saved movies in clean UI.
+## Development information
The dev branch is **only merged** into master when a **new release** is released, so **master contains the latest released version**. Please commit all changes to [dev](https://github.com/Seil0/Project-HomeFlix/tree/dev).
-**Due to some changes with the API we use(not provided by us), the query does not work at the moment!**
-
Librarys used in this Project:
JFoenix: https://github.com/jfoenixadmin/JFoenix
minimal-json: https://github.com/ralfstx/minimal-json
sqlite-jdbc: https://github.com/xerial/sqlite-jdbc
apache commons io : https://commons.apache.org/proper/commons-io/
-## Installation
+## screenshots
+![Screenshot](https://github.com/Seil0/Seil0.github.io/blob/master/pictures/Project-HomeFlix_MainWindow.png)
-[wiki](https://github.com/Seil0/Project-HomeFlix/wiki)
-
-Project HomeFlix © 2016-2017 Kellerkinder ([Seil0](https://github.com/Seil0), [Windoofs](https://github.com/Windoofs))
+Project-HomeFlix © 2016-2018 Kellerkinder ([Seil0](https://github.com/Seil0), [Windoofs](https://github.com/Windoofs))
www.kellerkinder.xyz
diff --git a/bin/.gitignore b/bin/.gitignore
deleted file mode 100644
index b42b859..0000000
--- a/bin/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/application/
diff --git a/bin/application/DBController.class b/bin/application/DBController.class
deleted file mode 100644
index fe33f4a..0000000
Binary files a/bin/application/DBController.class and /dev/null differ
diff --git a/bin/application/Main.class b/bin/application/Main.class
deleted file mode 100644
index 7ea09ff..0000000
Binary files a/bin/application/Main.class and /dev/null differ
diff --git a/bin/application/MainWindow.fxml b/bin/application/MainWindow.fxml
deleted file mode 100644
index 032c390..0000000
--- a/bin/application/MainWindow.fxml
+++ /dev/null
@@ -1,115 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/bin/application/MainWindowController$1.class b/bin/application/MainWindowController$1.class
deleted file mode 100644
index 83f39ab..0000000
Binary files a/bin/application/MainWindowController$1.class and /dev/null differ
diff --git a/bin/application/MainWindowController$2.class b/bin/application/MainWindowController$2.class
deleted file mode 100644
index 0598930..0000000
Binary files a/bin/application/MainWindowController$2.class and /dev/null differ
diff --git a/bin/application/MainWindowController$3.class b/bin/application/MainWindowController$3.class
deleted file mode 100644
index d3984f0..0000000
Binary files a/bin/application/MainWindowController$3.class and /dev/null differ
diff --git a/bin/application/MainWindowController$4.class b/bin/application/MainWindowController$4.class
deleted file mode 100644
index 805fc84..0000000
Binary files a/bin/application/MainWindowController$4.class and /dev/null differ
diff --git a/bin/application/MainWindowController$5.class b/bin/application/MainWindowController$5.class
deleted file mode 100644
index cdf339c..0000000
Binary files a/bin/application/MainWindowController$5.class and /dev/null differ
diff --git a/bin/application/MainWindowController$6.class b/bin/application/MainWindowController$6.class
deleted file mode 100644
index e7f5c3d..0000000
Binary files a/bin/application/MainWindowController$6.class and /dev/null differ
diff --git a/bin/application/MainWindowController$7.class b/bin/application/MainWindowController$7.class
deleted file mode 100644
index 0fed876..0000000
Binary files a/bin/application/MainWindowController$7.class and /dev/null differ
diff --git a/bin/application/MainWindowController.class b/bin/application/MainWindowController.class
deleted file mode 100644
index 9aca2d1..0000000
Binary files a/bin/application/MainWindowController.class and /dev/null differ
diff --git a/bin/application/apiQuery.class b/bin/application/apiQuery.class
deleted file mode 100644
index 83ad53e..0000000
Binary files a/bin/application/apiQuery.class and /dev/null differ
diff --git a/bin/application/tableData.class b/bin/application/tableData.class
deleted file mode 100644
index 76223fc..0000000
Binary files a/bin/application/tableData.class and /dev/null differ
diff --git a/bin/application/updater.class b/bin/application/updater.class
deleted file mode 100644
index 53dccc4..0000000
Binary files a/bin/application/updater.class and /dev/null differ
diff --git a/bin/libraries/commons-io-2.5.jar b/bin/libraries/commons-io-2.5.jar
deleted file mode 100644
index 107b061..0000000
Binary files a/bin/libraries/commons-io-2.5.jar and /dev/null differ
diff --git a/bin/libraries/jfoenix-1.4.0.jar b/bin/libraries/jfoenix-1.4.0.jar
deleted file mode 100644
index 789ef3b..0000000
Binary files a/bin/libraries/jfoenix-1.4.0.jar and /dev/null differ
diff --git a/bin/libraries/minimal-json-0.9.4.jar b/bin/libraries/minimal-json-0.9.4.jar
deleted file mode 100644
index 14c0633..0000000
Binary files a/bin/libraries/minimal-json-0.9.4.jar and /dev/null differ
diff --git a/bin/libraries/sqlite-jdbc-3.18.0.jar b/bin/libraries/sqlite-jdbc-3.18.0.jar
deleted file mode 100644
index 8e9dce1..0000000
Binary files a/bin/libraries/sqlite-jdbc-3.18.0.jar and /dev/null differ
diff --git a/bin/resources/HomeFlix-Local_de_DE.properties b/bin/resources/HomeFlix-Local_de_DE.properties
deleted file mode 100644
index aa9c214..0000000
--- a/bin/resources/HomeFlix-Local_de_DE.properties
+++ /dev/null
@@ -1,63 +0,0 @@
-#HomeFlix-Local_de_DE.properties German Local
-
-#main window translations
-info = Info
-settings = Einstellungen
-streamingSettings = Stream Einst.
-tfSearch = Suche...
-openFolder = Ordner \u00F6ffnen
-
-#settings translations
-settingsHead1Label = HomeFlix Einstellungen
-tfPath = Pfad...
-chooseFolder = Ordner ausw\u00E4hlen
-mainColorLabel = Hauptfarbe:
-fontsizeLabel = Schriftgr\u00F6\u00DFe:
-localLabel = Sprache:
-checkUpdates = Auf Update pr\u00FCfen
-checkingUpdates = Es wird nach Updates gesucht...
-updateBtnavail = Update verf\u00FCgbar
-updateBtnNotavail = Kein Update verf\u00FCgbar
-autoUpdateLabel = beim Start nach Updates suchen:
-version = Version:
-
-#column translations
-columnName = Name
-columnRating = Bewertung
-columnStreamUrl = Datei Name
-columnResolution = Aufl\u00F6sung
-columnSeason = Staffel
-columnYear = Jahr
-
-#error translations
-errorUpdateV = Beim ausf\u00FChren des Updates ist ein Fehler aufgetreten! \nError: could not check update version (nvc)\nWeitere Hilfe erhalten sie unter www.kellerkinder.xyz \noder wenden sie sich an support@kellerkinder.xyz
-errorUpdateD = Beim ausf\u00FChren des Updates ist ein Fehler aufgetreten! \nError: could not download update files (ndf)\nWeitere Hilfe erhalten sie unter www.kellerkinder.xyz \noder wenden sie sich an support@kellerkinder.xyz
-errorPlay = Beim \u00F6ffnen der Datei ist ein Fehler aufgetreten! \nError: could not open file (nof) \nWeitere Hilfe erhalten sie unter www.kellerkinder.xyz \noder wenden sie sich an support@kellerkinder.xyz
-errorMode = Oh, da lief etwas falsch! Da hat jemand einen falschen Modus verwendet. \nError: mode unknow (muk)\nWeitere Hilfe erhalten sie unter www.kellerkinder.xyz \noder wenden sie sich an support@kellerkinder.xyz
-errorOpenStream = Beim \u00F6ffnen des Streams ist ein Fehler aufgetreten!
-errorLoad = Beim laden der Einstellungen ist ein Fehler aufgetreten!
-errorSave = Beim speichern der Einstellungen ist ein Fehler aufgetreten!
-noFilmFound = Kein Film mit diesem Titel gefunden!
-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-2017 Kellerkinder www.kellerkinder.xyz
-
-#textFlow translations
-title = Titel
-year = Jahr
-rating = Einstufung
-publishedOn = Ver\u00F6ffentlicht am
-duration = Laufzeit
-genre = Gener
-director = Regisseur
-writer = Autor
-actors = Schauspieler
-plot = Beschreibung
-language = Original Sprache
-country = Produktionsland
-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/resources/HomeFlix-Local_en_US.properties b/bin/resources/HomeFlix-Local_en_US.properties
deleted file mode 100644
index d166f04..0000000
--- a/bin/resources/HomeFlix-Local_en_US.properties
+++ /dev/null
@@ -1,63 +0,0 @@
-#HomeFlix-Local_en_US.properties US-English Local and default
-
-#main window translations
-info = Info
-settings = Settings
-streamingSettings = Stream Settings
-tfSearch = Search...
-openFolder = open Folder
-
-#settings translations
-settingsHead1Label = HomeFlix Settings
-tfPath = Path...
-chooseFolder = choose Directory
-mainColorLabel = main color:
-fontsizeLabel = font size:
-localLabel = local:
-checkUpdates = check for updates
-checkingUpdates = checking for updates...
-updateBtnavail = update available
-updateBtnNotavail = no update available
-autoUpdateLabel = check at startup for updates:
-version = Version:
-
-#column translations
-columnName = Name
-columnRating = Rating
-columnStreamUrl = File Name
-columnResolution = Resolution
-columnSeason = Season
-columnYear = Year
-
-#error translations
-errorUpdateV = An error has occurred during update! \nError: could not check update version (nvc) \nTo get help, visit www.kellerkinder.xyz \nor contcat support@kellerkinder.xyz
-errorUpdateD = An error has occurred during update! \nError: could not download update files (ndf) \nTo get help, visit www.kellerkinder.xyz \nor contcat support@kellerkinder.xyz
-errorPlay = An error has occurred during opening the file! \nError: could not open file (nof) \nTo get help, visit www.kellerkinder.xyz \nor contcat support@kellerkinder.xyz
-errorMode = Oh, something went wrong! It seems someone has used a wrong mode. \nError: mode unknow (muk) \nTo get help, visit www.kellerkinder.xyz \nor contcat support@kellerkinder.xyz
-errorOpenStream = An error has occurred during opening the stream!
-errorLoad = An error occurred while loading the settings!
-errorSave = An error occurred while saving the settings!
-noFilmFound = No film with this title found!
-vlcNotInstalled = VLC Media Player is required to play a movie!
-infoText = \nMaintainer: seilo@kellerkinder.xyz and \nhendrik.schutter@coptersicht.de \n(c) 2016-2017 Kellerkinder www.kellerkinder.xyz
-
-#textFlow translations
-title = Title
-year = Year
-rating = Rating
-publishedOn = published on
-duration = Duration
-genre = Gener
-director = Director
-writer = Writer
-actors = Actors
-plot = Plot
-language = Language
-country = Country
-awards = Awards
-metascore = Metascore
-imdbRating = IMDB-Rating
-type = Type
-
-firstStartHeader = There is no root directory for movies!
-firstStartContent = Specify a root directory?
diff --git a/build.fxbuild b/build.fxbuild
deleted file mode 100644
index a7511ff..0000000
--- a/build.fxbuild
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..b5a8a73
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,103 @@
+
+ 4.0.0
+
+ org.kellerkinder
+ Project-HomeFlix
+ 0.6.0
+ jar
+
+ Project-HomeFlix
+ http://www.kellerkinder.xyz
+
+
+ UTF-8
+
+
+
+
+
+ junit
+ junit
+ 4.11
+ test
+
+
+
+ commons-io
+ commons-io
+ 2.6
+
+
+
+ com.jfoenix
+ jfoenix
+ 9.0.2
+
+
+
+ com.eclipsesource.minimal-json
+ minimal-json
+ 0.9.5
+
+
+
+ org.xerial
+ sqlite-jdbc
+ 3.21.0.1
+
+
+
+ org.apache.logging.log4j
+ log4j-api
+ 2.10.0
+
+
+
+ org.apache.logging.log4j
+ log4j-core
+ 2.10.0
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.7.0
+
+
+ 9
+ true
+ true
+
+
+
+
+ org.apache.maven.plugins
+ maven-shade-plugin
+ 3.1.0
+
+
+ package
+
+ shade
+
+
+ true
+
+
+ kellerkinder.HomeFlix.application.Main
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/application/DBController.java b/src/application/DBController.java
deleted file mode 100644
index 3b841a1..0000000
--- a/src/application/DBController.java
+++ /dev/null
@@ -1,634 +0,0 @@
-/**
- * @author Jannik
- * DBController for Project HomeFlix
- * connection is in manual commit!
- */
-
-package application;
-
-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 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, 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("resources/icons/ic_favorite_black_18dp_1x.png");
- private Image favorite_border_black = new Image("resources/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);
- connection.setAutoCommit(false); //AutoCommit to false -> manual commit is active
- } 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)
-// connection.close();
-// } catch (SQLException e) {
-// // connection close failed.
-// System.err.println(e);
-// }
-// }
- }
-
- void createDatabase() {
- System.out.println("<==========starting loading sql==========>");
-
- PreparedStatement ps;
- PreparedStatement psS;
-
- try {
- Statement stmt = connection.createStatement();
- 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();
- }
-
- 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();
-
- 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();
- }
-
- //getting all files from the selected directory TODO rework
- 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 if(new File(mainWindowController.getPath()).exists()) {
- System.out.println(entries.length);
- for(int i=0;i!=entries.length;i++){
- filmsDir.add(cutOffEnd(entries[i]));
- }
- } else {
- System.out.println(mainWindowController.getPath() + "dosen't exist!");
- }
-
- //getting all entries from the streaming lists
- 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) {
- filmsStream.add(item.asObject().getString("titel",""));
- filmsStreamURL.add(item.asObject().getString("streamUrl",""));
- filmsStreamData.add(fileName);
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- //add all entries to filmsAll and filmsdbAl, for later comparing
- 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 database is empty, we need to fill it
- * else check if there is something to remove or to add
- * TODO separate local and streaming for better error handling
- */
- 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 if(new File(mainWindowController.getPath()).exists()){
- 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.setBoolean(5, false);
- 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.setBoolean(9, false);
- 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("Ups! an error occured!");
- ea.printStackTrace();
- }
- }else {
- try {
- try {
- checkAddEntry(); //check if added a new file
- } catch (IOException e) {
- e.printStackTrace();
- }
- 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
- 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 ORDER BY titel");
- while (rs.next()) {
- if(rs.getString(4).equals("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.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 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.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.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();
- 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
- //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;
-
- try {
- stmt = connection.createStatement();
- ResultSet rs = stmt.executeQuery("SELECT * FROM film_local WHERE titel = \""+name+"\";" );
- if(rs.getString(4).equals("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.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();
- } 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.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.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();
- } catch (SQLException e1) {
- System.err.println("Ups! an error occured!");
- e1.printStackTrace();
- }
- }
- }
- /**
- * 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();
-
- 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
- *
- * 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
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- */
-
-package application;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Locale;
-import java.util.Optional;
-import java.util.ResourceBundle;
-import javafx.application.Application;
-import javafx.fxml.FXMLLoader;
-import javafx.scene.Scene;
-import javafx.scene.control.Alert;
-import javafx.scene.control.Alert.AlertType;
-import javafx.scene.control.ButtonType;
-import javafx.scene.image.Image;
-import javafx.scene.layout.AnchorPane;
-import javafx.stage.DirectoryChooser;
-import javafx.stage.Stage;
-
-public class Main extends Application {
-
- Stage primaryStage;
- private String path;
- String currentWorkingDirectory;
- private String COLOR = "ee3523";
- private String FONT_FAMILY = "System";
- private String mode = "local"; //local or streaming TODO
- private String local = System.getProperty("user.language")+"_"+System.getProperty("user.country");
- private boolean AUTO_UPDATE = false;
- private double FONT_SIZE = 17;
- private ResourceBundle bundle;
- private MainWindowController mainWindowController;
- private File directory;
- private File settingsFile;
- private File posterCache;
- private String dirWin = System.getProperty("user.home") + "/Documents/HomeFlix"; //Windows: C:/Users/"User"/Documents/HomeFlix
- private String dirLinux = System.getProperty("user.home") + "/HomeFlix"; //Linux: /home/"User"/HomeFlix
-
- @Override
- public void start(Stage primaryStage) throws IOException {
- currentWorkingDirectory = new java.io.File( "." ).getCanonicalPath();
- this.primaryStage = primaryStage;
- mainWindow();
- }
-
- private void mainWindow(){
-
- try {
- FXMLLoader loader = new FXMLLoader(Main.class.getResource("MainWindow.fxml"));
- AnchorPane pane = loader.load();
- primaryStage.setMinHeight(600.00);
- primaryStage.setMinWidth(900.00);
- primaryStage.setResizable(false);
- primaryStage.setTitle("Project HomeFlix");
- primaryStage.getIcons().add(new Image(Main.class.getResourceAsStream("/resources/Homeflix_Icon_64x64.png"))); //adds application icon
-
- mainWindowController = loader.getController(); //Link of FXMLController and controller class
- mainWindowController.setAutoUpdate(AUTO_UPDATE); //set auto-update
- mainWindowController.setCurrentWorkingDirectory(currentWorkingDirectory);
- mainWindowController.setMain(this); //call setMain
-
- /**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();
- 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); //create new scene, append pane to scene
- scene.getStylesheets().add(Main.class.getResource("MainWindow.css").toExternalForm());
- primaryStage.setScene(scene); //append scene to stage
- primaryStage.show(); //show stage
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- //Method for first Start
- private String firstStart(){
- MainWindowController.firststart = true;
- switch(System.getProperty("user.language")+"_"+System.getProperty("user.country")){
- case "en_US": bundle = ResourceBundle.getBundle("resources.HomeFlix-Local", Locale.US); //us_english
- break;
- case "de_DE": bundle = ResourceBundle.getBundle("resources.HomeFlix-Local", Locale.GERMAN); //German
- break;
- default: bundle = ResourceBundle.getBundle("resources.HomeFlix-Local", Locale.US); //default local
- break;
- }
-
- Alert alert = new Alert(AlertType.CONFIRMATION); //new alert with file-chooser
- alert.setTitle("Project HomeFlix");
- alert.setHeaderText(bundle.getString("firstStartHeader"));
- alert.setContentText(bundle.getString("firstStartContent"));
-
- Optional result = alert.showAndWait();
- if (result.get() == ButtonType.OK){
- DirectoryChooser directoryChooser = new DirectoryChooser();
- File selectedDirectory =
- directoryChooser.showDialog(primaryStage);
- path = selectedDirectory.getAbsolutePath();
-
- } else {
- path = "";
- }
- return path;
- }
-
- 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.css b/src/application/MainWindow.css
deleted file mode 100644
index cb1165b..0000000
--- a/src/application/MainWindow.css
+++ /dev/null
@@ -1,4 +0,0 @@
-.jfx-hamburgerW StackPane { -fx-background-color: white;
- -fx-background-radius: 5px; }
-.jfx-hamburgerB StackPane { -fx-background-color: black;
- -fx-background-radius: 5px; }
\ No newline at end of file
diff --git a/src/application/MainWindow.fxml b/src/application/MainWindow.fxml
deleted file mode 100644
index 032c390..0000000
--- a/src/application/MainWindow.fxml
+++ /dev/null
@@ -1,115 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/application/MainWindowController.java b/src/application/MainWindowController.java
deleted file mode 100644
index 1b72bb1..0000000
--- a/src/application/MainWindowController.java
+++ /dev/null
@@ -1,1163 +0,0 @@
-/**
- * Project HomeFlix
- *
- * 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
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- */
-package application;
-
-import java.awt.Desktop;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-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.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 com.jfoenix.controls.JFXButton;
-import com.jfoenix.controls.JFXColorPicker;
-import com.jfoenix.controls.JFXHamburger;
-import com.jfoenix.controls.JFXSlider;
-import com.jfoenix.controls.JFXTextField;
-import com.jfoenix.controls.JFXToggleButton;
-import com.jfoenix.transitions.hamburger.HamburgerBackArrowBasicTransition;
-
-import javafx.animation.FadeTransition;
-import javafx.animation.ParallelTransition;
-import javafx.animation.TranslateTransition;
-import javafx.beans.value.ChangeListener;
-import javafx.beans.value.ObservableValue;
-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.SortType;
-import javafx.scene.control.TreeTableView;
-import javafx.scene.image.Image;
-import javafx.scene.image.ImageView;
-import javafx.scene.input.MouseEvent;
-import javafx.scene.layout.AnchorPane;
-import javafx.scene.layout.GridPane;
-import javafx.scene.layout.HBox;
-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 {
- @FXML
- private AnchorPane anpane;
- @FXML
- private AnchorPane settingsAnchor;
- @FXML
- private AnchorPane streamingSettingsAnchor;
- @FXML
- private HBox topHBox;
- @FXML
- private VBox sideMenuVBox;
- @FXML
- private TreeTableView treeTableViewfilm;
- @FXML
- private TableView tableViewStreamingdata;
- @FXML
- TextFlow textFlow;
- @FXML
- ScrollPane scrollPane;
- @FXML
- private JFXButton playbtn;
- @FXML
- private JFXButton openfolderbtn;
- @FXML
- private JFXButton returnBtn;
- @FXML
- private JFXButton forwardBtn;
- @FXML
- private JFXButton infoBtn;
- @FXML
- private JFXButton settingsBtn;
- @FXML
- private JFXButton streamingSettingsBtn;
- @FXML
- private JFXButton switchBtn;
- @FXML
- private JFXButton debugBtn;
- @FXML
- public JFXButton updateBtn;
- @FXML
- private JFXButton directoryBtn;
- @FXML
- private JFXButton streamingDirectoryBtn;
- @FXML
- private JFXHamburger menuHam;
- @FXML
- private JFXToggleButton autoupdateBtn;
- @FXML
- public JFXTextField tfPath;
- @FXML
- public JFXTextField tfStreamingPath;
- @FXML
- private JFXTextField tfsearch;
- @FXML
- public JFXColorPicker mainColor;
- @FXML
- public ChoiceBox cbLocal = new ChoiceBox<>();
- @FXML
- public JFXSlider sliderFontSize;
- @FXML
- private Label versionLabel;
- @FXML
- private Label fontsizeLabel;
- @FXML
- private Label autoUpdateLabel;
- @FXML
- private Label settingsHead1Label;
- @FXML
- private Label mainColorLabel;
- @FXML
- private Label localLabel;
- @FXML
- ImageView image1;
-
- private ImageView imv1;
-
- @FXML
- TreeItem root = new TreeItem<>(new tableData(1, 1, 1, 5.0,"1", "filme","1", imv1, false));
- @FXML
- TreeTableColumn columnRating = new TreeTableColumn<>("Rating");
- @FXML
- TreeTableColumn columnTitel = new TreeTableColumn<>("Titel");
- @FXML
- TreeTableColumn columnStreamUrl = new TreeTableColumn<>("File Name");
- @FXML
- TreeTableColumn columnResolution = new TreeTableColumn<>("Resolution");
- @FXML
- TreeTableColumn columnYear = new TreeTableColumn<>("Year");
- @FXML
- TreeTableColumn columnSeason = new TreeTableColumn<>("Season");
- @FXML
- TreeTableColumn columnEpisode = new TreeTableColumn<>("Episode");
-
- @FXML
- 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");
- @FXML
- private TableColumn dataNameEndColumn = new TableColumn<>("Datei Name mit Endung");
-
- 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.2";
- private String buildNumber = "129";
- private String versionName = "solidify cow";
- 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;
- String noFilmFound;
- private String errorPlay;
- private String errorOpenStream;
- private String errorMode;
- private String errorLoad;
- private String errorSave;
- private String infoText;
- private String vlcNotInstalled;
- private String currentWorkingDirectory;
- private String path;
- private String streamingPath;
- private String color;
- private String name;
- private String datPath;
- private String mode;
- @SuppressWarnings("unused")
- private String ratingSortType;
- private String local;
- String title;
- String year;
- String rating;
- String publishedOn;
- String duration;
- String genre;
- String director;
- String writer;
- String actors;
- String plot;
- String language;
- String country;
- String awards;
- String metascore;
- String imdbRating;
- String type;
- double size;
- private int last;
- private int selected;
- private int next;
- private File selectedFolder;
- private File selectedStreamingFolder;
- ResourceBundle bundle;
-
- 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 skip_previous_white = new ImageView(new Image("resources/icons/ic_skip_previous_white_18dp_1x.png"));
- private ImageView skip_previous_black = new ImageView(new Image("resources/icons/ic_skip_previous_black_18dp_1x.png"));
- private ImageView skip_next_white = new ImageView(new Image("resources/icons/ic_skip_next_white_18dp_1x.png"));
- private ImageView skip_next_black = new ImageView(new Image("resources/icons/ic_skip_next_black_18dp_1x.png"));
- private ImageView play_arrow_white = new ImageView(new Image("resources/icons/ic_play_arrow_white_18dp_1x.png"));
- private ImageView play_arrow_black = new ImageView(new Image("resources/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 Main main;
- private updater Updater;
- private apiQuery ApiQuery;
- DBController dbController;
-
- @FXML
- private void playbtnclicked(){
- 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;
- try {
- p = Runtime.getRuntime().exec("which vlc");
- BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
- while ((line = input.readLine()) != null) {
- output = line;
- }
- System.out.println(output);
- input.close();
- } catch (IOException e1) {
- e1.printStackTrace();
- }
- if(output.contains("which: no vlc")||output == ""){
- Alert alert = new Alert(AlertType.INFORMATION);
- alert.setHeaderText("");
- alert.setTitle("Info");
- alert.setContentText(vlcNotInstalled);
- alert.showAndWait();
- }else{
- try {
- Runtime.getRuntime().exec(new String[] { "vlc", getPath()+"/"+ datPath});
- } catch (IOException e) {
- showErrorMsg(errorPlay,e);
- }
- }
- }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));
- } catch (IOException e) {
- showErrorMsg(errorPlay,e);
- }
- }else if(mode.equals("streaming")){
- try {
- Desktop.getDesktop().browse(new URI(datPath)); //open the streaming URL in browser
- } catch (URISyntaxException | IOException e) {
- showErrorMsg(errorOpenStream, (IOException) e);
- }
- }else{
- IOException e = new IOException("error");
- showErrorMsg(errorMode, e);
-
- }
- }
- }
-
- @FXML
- private void openfolderbtnclicked(){
- try {
- Desktop.getDesktop().open(new File(getPath())); //open path when button is clicked
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- @FXML
- private void returnBtnclicked(){
- treeTableViewfilm.getSelectionModel().select(last);
- }
-
- @FXML
- private void forwardBtnclicked(){
- treeTableViewfilm.getSelectionModel().select(next);
- }
-
- @FXML
- private void infoBtnclicked(){
- Alert alert = new Alert(AlertType.INFORMATION);
- alert.setTitle("Info");
- alert.setHeaderText("Project HomeFlix");
- alert.setContentText(infoText);
- alert.initOwner(main.primaryStage);
- alert.showAndWait();
- }
-
- @FXML
- private void settingsBtnclicked(){
- if(settingsTrue == false){
- if(streamingSettingsTrue == true){
- streamingSettingsAnchor.setVisible(false);
- streamingSettingsTrue = false;
- }
- settingsAnchor.setVisible(true);
- settingsTrue = true;
- }else{
- settingsAnchor.setVisible(false);
- setPath(tfPath.getText());
- saveSettings();
- settingsTrue = false;
- }
- }
-
- /**
- * TODO additional info about the "streaming.json"
- */
- @FXML
- private void streamingSettingsBtnclicked(){
- if(streamingSettingsTrue == false){
- if(settingsTrue == true){
- settingsAnchor.setVisible(false);
- settingsTrue = false;
- }
- streamingSettingsAnchor.setVisible(true);
- streamingSettingsTrue = true;
- }else{
- streamingSettingsAnchor.setVisible(false);
- streamingSettingsTrue = false;
- }
- }
-
- @FXML
- private void switchBtnclicked(){
- if(mode.equals("local")){ //switch to streaming mode
- setMode("streaming");
- switchBtn.setText("local");
- }else if(mode.equals("streaming")){ //switch to local mode
- setMode("local");
- switchBtn.setText("streaming");
- }
- saveSettings();
- root.getChildren().remove(0,root.getChildren().size());
- addDataUI();
- settingsAnchor.setVisible(false);
- streamingSettingsAnchor.setVisible(false);
- sideMenuSlideOut(); //disables side-menu
- menuTrue = false;
- settingsTrue = false;
- streamingSettingsTrue = false;
- }
-
- @FXML
- private void debugBtnclicked(){
- //for testing
- }
-
-
- @FXML
- private void tfPathAction(){
- setPath(tfPath.getText());
- saveSettings();
- }
-
- @FXML
- private void directoryBtnAction(){
- selectedFolder = directoryChooser.showDialog(null);
- if(selectedFolder == null){
- System.out.println("No Directory selected");
- }else{
- setPath(selectedFolder.getAbsolutePath());
- saveSettings();
- tfPath.setText(getPath());
- try {
- Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //start again
- System.exit(0); //finishes itself
- } catch (IOException e) {
- System.out.println("es ist ein Fehler aufgetreten");
- e.printStackTrace();
- }
- }
- }
-
- @FXML
- private void mainColorAction(){
- editColor(mainColor.getValue().toString());
- applyColor();
- }
-
- @FXML
- private void updateBtnAction(){
- Thread updateThread = new Thread(Updater);
- updateThread.setName("Updater");
- updateThread.start();
- }
-
- @FXML
- private void autoupdateBtnAction(){
- if(autoUpdate){
- setAutoUpdate(false);
- }else{
- setAutoUpdate(true);
- }
- saveSettings();
- }
-
- @FXML
- private void tfStreamingPathAction(){
- //
- }
-
- @FXML
- private void streamingDirectoryBtnAction(){
- selectedStreamingFolder = directoryChooser.showDialog(null);
- if(selectedStreamingFolder == null){
- System.out.println("No Directory selected");
- }else{
- setStreamingPath(selectedStreamingFolder.getAbsolutePath());
- saveSettings();
- tfStreamingPath.setText(getStreamingPath());
- try {
- Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //start again
- System.exit(0); //finishes itself
- } catch (IOException e) {
- System.out.println("es ist ein Fehler aufgetreten");
- e.printStackTrace();
- }
- }
- }
-
-
- /**"Main" Method called in Main.java main() when starting
- * Initialize other objects: Updater, dbController and ApiQuery
- */
- void setMain(Main main) {
- this.main = main;
- Updater = new updater(this, buildNumber);
- dbController = new DBController(this, this.main);
- ApiQuery = new apiQuery(this, dbController, this.main);
- }
-
- //Initialize the tables (treeTableViewfilm and tableViewStreamingdata)
- @SuppressWarnings({ "unchecked"}) //TODO
- void initTabel(){
-
- //film Table
- columnRating.setMaxWidth(80);
- columnTitel.setMaxWidth(260);
- columnStreamUrl.setMaxWidth(0);
- dataNameColumn.setPrefWidth(150);
- dataNameEndColumn.setPrefWidth(220);
- columnRating.setStyle("-fx-alignment: CENTER;");
-
- treeTableViewfilm.setRoot(root);
- treeTableViewfilm.setColumnResizePolicy( TreeTableView.CONSTRAINED_RESIZE_POLICY );
- treeTableViewfilm.setShowRoot(false);
-
- //write content into cell
- 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());
- 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); //hide columnStreamUrl (column with file path important for the player)
-
- //Change-listener for TreeTable
- treeTableViewfilm.getSelectionModel().selectedItemProperty().addListener(new ChangeListener