63 changed files with 3875 additions and 2318 deletions
@ -1,32 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<classpath> |
||||
<classpathentry kind="src" output="target/classes" path="src/main/java"> |
||||
<attributes> |
||||
<attribute name="optional" value="true"/> |
||||
<attribute name="maven.pomderived" value="true"/> |
||||
</attributes> |
||||
</classpathentry> |
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java"> |
||||
<attributes> |
||||
<attribute name="optional" value="true"/> |
||||
<attribute name="maven.pomderived" value="true"/> |
||||
</attributes> |
||||
</classpathentry> |
||||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"> |
||||
<attributes> |
||||
<attribute name="maven.pomderived" value="true"/> |
||||
</attributes> |
||||
</classpathentry> |
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-9"> |
||||
<attributes> |
||||
<attribute name="module" value="true"/> |
||||
<attribute name="maven.pomderived" value="true"/> |
||||
</attributes> |
||||
</classpathentry> |
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> |
||||
<attributes> |
||||
<attribute name="maven.pomderived" value="true"/> |
||||
</attributes> |
||||
</classpathentry> |
||||
<classpathentry kind="output" path="target/classes"/> |
||||
</classpath> |
@ -1,23 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<projectDescription> |
||||
<name>Project-HomeFlix</name> |
||||
<comment></comment> |
||||
<projects> |
||||
</projects> |
||||
<buildSpec> |
||||
<buildCommand> |
||||
<name>org.eclipse.jdt.core.javabuilder</name> |
||||
<arguments> |
||||
</arguments> |
||||
</buildCommand> |
||||
<buildCommand> |
||||
<name>org.eclipse.m2e.core.maven2Builder</name> |
||||
<arguments> |
||||
</arguments> |
||||
</buildCommand> |
||||
</buildSpec> |
||||
<natures> |
||||
<nature>org.eclipse.jdt.core.javanature</nature> |
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature> |
||||
</natures> |
||||
</projectDescription> |
@ -1,5 +0,0 @@
|
||||
eclipse.preferences.version=1 |
||||
encoding//src/main/java=UTF-8 |
||||
encoding//src/main/resources=UTF-8 |
||||
encoding//src/test/java=UTF-8 |
||||
encoding/<project>=UTF-8 |
@ -1,13 +0,0 @@
|
||||
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=9 |
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve |
||||
org.eclipse.jdt.core.compiler.compliance=9 |
||||
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.problem.forbiddenReference=warning |
||||
org.eclipse.jdt.core.compiler.source=9 |
@ -1,4 +0,0 @@
|
||||
activeProfiles= |
||||
eclipse.preferences.version=1 |
||||
resolveWorkspaceProjects=true |
||||
version=1 |
@ -1,24 +1,18 @@
|
||||
 |
||||
[](https://github.com/Seil0/Project-HomeFlix/releases) |
||||
[](https://git.mosad.xyz/Seil0/Project-HomeFlix/releases) |
||||
[](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). |
||||
Simply download the Project-HomeFlix.jar from [releases](https://git.mosad.xyz/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://git.mosad.xyz/Seil0/Project-HomeFlix/wiki). |
||||
|
||||
## 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). |
||||
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://git.mosad.xyz/Seil0/Project-HomeFlix/src/branch/dev). |
||||
|
||||
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/ |
||||
[Libraries used in this Project](https://git.mosad.xyz/Seil0/Project-HomeFlix/wiki/Documentation#used-libraries-and-apis) |
||||
|
||||
## screenshots |
||||
 |
||||
## Screenshots |
||||
 |
||||
|
||||
Project-HomeFlix ยฉ 2016-2018 Kellerkinder ([Seil0](https://github.com/Seil0), [Windoofs](https://github.com/Windoofs)) |
||||
www.kellerkinder.xyz |
||||
Project-HomeFlix ยฉ 2016-2019 mosad www.mosad.xyz, Project by [@Seil0](https://git.mosad.xyz/Seil0) and [@localhorst](https://git.mosad.xyz/localhorst) |
||||
|
@ -1,103 +1,141 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
<modelVersion>4.0.0</modelVersion> |
||||
|
||||
<groupId>org.kellerkinder</groupId> |
||||
<artifactId>Project-HomeFlix</artifactId> |
||||
<version>0.7.0</version> |
||||
<packaging>jar</packaging> |
||||
|
||||
<name>Project-HomeFlix</name> |
||||
<url>http://www.kellerkinder.xyz</url> |
||||
|
||||
<properties> |
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
||||
</properties> |
||||
|
||||
<dependencies> |
||||
|
||||
<dependency> |
||||
<groupId>junit</groupId> |
||||
<artifactId>junit</artifactId> |
||||
<version>4.12</version> |
||||
<scope>test</scope> |
||||
</dependency> |
||||
|
||||
<dependency> |
||||
<groupId>commons-io</groupId> |
||||
<artifactId>commons-io</artifactId> |
||||
<version>2.6</version> |
||||
</dependency> |
||||
|
||||
<dependency> |
||||
<groupId>com.jfoenix</groupId> |
||||
<artifactId>jfoenix</artifactId> |
||||
<version>9.0.3</version> |
||||
</dependency> |
||||
|
||||
<dependency> |
||||
<groupId>com.eclipsesource.minimal-json</groupId> |
||||
<artifactId>minimal-json</artifactId> |
||||
<version>0.9.5</version> |
||||
</dependency> |
||||
|
||||
<dependency> |
||||
<groupId>org.xerial</groupId> |
||||
<artifactId>sqlite-jdbc</artifactId> |
||||
<version>3.21.0.1</version> |
||||
</dependency> |
||||
|
||||
<dependency> |
||||
<groupId>org.apache.logging.log4j</groupId> |
||||
<artifactId>log4j-api</artifactId> |
||||
<version>2.11.0</version> |
||||
</dependency> |
||||
|
||||
<dependency> |
||||
<groupId>org.apache.logging.log4j</groupId> |
||||
<artifactId>log4j-core</artifactId> |
||||
<version>2.11.0</version> |
||||
</dependency> |
||||
</dependencies> |
||||
|
||||
<build> |
||||
<plugins> |
||||
|
||||
<plugin> |
||||
<groupId>org.apache.maven.plugins</groupId> |
||||
<artifactId>maven-compiler-plugin</artifactId> |
||||
<version>3.7.0</version> |
||||
<configuration> |
||||
<source>9</source> |
||||
<target>9</target> |
||||
<showWarnings>true</showWarnings> |
||||
<showDeprecation>true</showDeprecation> |
||||
</configuration> |
||||
</plugin> |
||||
|
||||
<plugin> |
||||
<groupId>org.apache.maven.plugins</groupId> |
||||
<artifactId>maven-shade-plugin</artifactId> |
||||
<version>3.1.1</version> |
||||
<configuration> |
||||
<shadedArtifactAttached>true</shadedArtifactAttached> |
||||
<transformers> |
||||
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> |
||||
<mainClass>kellerkinder.HomeFlix.application.Main</mainClass> |
||||
</transformer> |
||||
</transformers> |
||||
</configuration> |
||||
<executions> |
||||
<execution> |
||||
<phase>package</phase> |
||||
<goals> |
||||
<goal>shade</goal> |
||||
</goals> |
||||
</execution> |
||||
</executions> |
||||
</plugin> |
||||
|
||||
</plugins> |
||||
</build> |
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
<modelVersion>4.0.0</modelVersion> |
||||
|
||||
<groupId>org.kellerkinder</groupId> |
||||
<artifactId>Project-HomeFlix</artifactId> |
||||
<version>0.7.0</version> |
||||
<packaging>jar</packaging> |
||||
|
||||
<name>Project-HomeFlix</name> |
||||
<url>http://www.mosad.xyz</url> |
||||
|
||||
<properties> |
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
||||
</properties> |
||||
|
||||
<dependencies> |
||||
|
||||
<dependency> |
||||
<groupId>junit</groupId> |
||||
<artifactId>junit</artifactId> |
||||
<version>4.12</version> |
||||
<scope>test</scope> |
||||
</dependency> |
||||
|
||||
<dependency> |
||||
<groupId>org.openjfx</groupId> |
||||
<artifactId>javafx-controls</artifactId> |
||||
<version>12.0.1</version> |
||||
</dependency> |
||||
|
||||
<dependency> |
||||
<groupId>org.openjfx</groupId> |
||||
<artifactId>javafx-fxml</artifactId> |
||||
<version>12.0.1</version> |
||||
</dependency> |
||||
|
||||
<dependency> |
||||
<groupId>org.openjfx</groupId> |
||||
<artifactId>javafx-media</artifactId> |
||||
<version>12.0.1</version> |
||||
</dependency> |
||||
|
||||
<dependency> |
||||
<groupId>commons-io</groupId> |
||||
<artifactId>commons-io</artifactId> |
||||
<version>2.6</version> |
||||
</dependency> |
||||
|
||||
<dependency> |
||||
<groupId>com.jfoenix</groupId> |
||||
<artifactId>jfoenix</artifactId> |
||||
<version>9.0.9</version> |
||||
</dependency> |
||||
|
||||
<dependency> |
||||
<groupId>com.eclipsesource.minimal-json</groupId> |
||||
<artifactId>minimal-json</artifactId> |
||||
<version>0.9.5</version> |
||||
</dependency> |
||||
|
||||
<dependency> |
||||
<groupId>org.xerial</groupId> |
||||
<artifactId>sqlite-jdbc</artifactId> |
||||
<version>3.27.2.1</version> |
||||
</dependency> |
||||
|
||||
<dependency> |
||||
<groupId>org.apache.logging.log4j</groupId> |
||||
<artifactId>log4j-api</artifactId> |
||||
<version>2.11.2</version> |
||||
</dependency> |
||||
|
||||
<dependency> |
||||
<groupId>org.apache.logging.log4j</groupId> |
||||
<artifactId>log4j-core</artifactId> |
||||
<version>2.11.2</version> |
||||
</dependency> |
||||
</dependencies> |
||||
|
||||
<build> |
||||
<plugins> |
||||
|
||||
<plugin> |
||||
<groupId>org.apache.maven.plugins</groupId> |
||||
<artifactId>maven-compiler-plugin</artifactId> |
||||
<version>3.8.0</version> |
||||
<configuration> |
||||
<source>11</source> |
||||
<target>11</target> |
||||
<!--<release>11</release> --> |
||||
<showWarnings>true</showWarnings> |
||||
<showDeprecation>true</showDeprecation> |
||||
</configuration> |
||||
</plugin> |
||||
|
||||
<plugin> |
||||
<groupId>org.codehaus.mojo</groupId> |
||||
<artifactId>exec-maven-plugin</artifactId> |
||||
<version>1.6.0</version> |
||||
<executions> |
||||
<execution> |
||||
<goals> |
||||
<goal>java</goal> |
||||
</goals> |
||||
</execution> |
||||
</executions> |
||||
<configuration> |
||||
<mainClass>kellerkinder.HomeFlix.application.Main</mainClass> |
||||
</configuration> |
||||
</plugin> |
||||
|
||||
<plugin> |
||||
<groupId>org.apache.maven.plugins</groupId> |
||||
<artifactId>maven-shade-plugin</artifactId> |
||||
<version>3.2.1</version> |
||||
<configuration> |
||||
<finalName>Project-HomeFlix</finalName> |
||||
<shadedArtifactAttached>true</shadedArtifactAttached> |
||||
<transformers> |
||||
<transformer |
||||
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> |
||||
<mainClass>kellerkinder.HomeFlix.application.JavaFX11Main</mainClass> |
||||
</transformer> |
||||
</transformers> |
||||
</configuration> |
||||
<executions> |
||||
<execution> |
||||
<phase>package</phase> |
||||
<goals> |
||||
<goal>shade</goal> |
||||
</goals> |
||||
</execution> |
||||
</executions> |
||||
</plugin> |
||||
|
||||
</plugins> |
||||
</build> |
||||
|
||||
</project> |
||||
|
@ -0,0 +1,226 @@
|
||||
/** |
||||
* Project-HomeFlix |
||||
* |
||||
* Copyright 2016-2019 <@Seil0> |
||||
* |
||||
* 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 kellerkinder.HomeFlix.application; |
||||
|
||||
import java.awt.Desktop; |
||||
import java.io.File; |
||||
import java.io.IOException; |
||||
|
||||
import org.apache.logging.log4j.LogManager; |
||||
import org.apache.logging.log4j.Logger; |
||||
|
||||
import com.jfoenix.controls.JFXButton; |
||||
|
||||
import javafx.animation.FadeTransition; |
||||
import javafx.fxml.FXML; |
||||
import javafx.scene.control.Label; |
||||
import javafx.scene.image.Image; |
||||
import javafx.scene.image.ImageView; |
||||
import javafx.scene.layout.AnchorPane; |
||||
import javafx.scene.text.Text; |
||||
import javafx.util.Duration; |
||||
import kellerkinder.HomeFlix.controller.DBController; |
||||
import kellerkinder.HomeFlix.controller.XMLController; |
||||
import kellerkinder.HomeFlix.player.Player; |
||||
|
||||
public class FilmDetailView { |
||||
|
||||
@FXML private AnchorPane filmDVPane; |
||||
|
||||
@FXML private Label lblTitle; |
||||
@FXML private Label lblYear; |
||||
@FXML private Label lblScore; |
||||
|
||||
@FXML private Label lblCrew; |
||||
@FXML private Label lblDirectors; |
||||
@FXML private Label lblDirectorsInfo; |
||||
@FXML private Label lblWriters; |
||||
@FXML private Label lblWritersInfo; |
||||
@FXML private Label lblActors; |
||||
@FXML private Label lblActorsInfo; |
||||
|
||||
@FXML private Label lblInfo; |
||||
@FXML private Label lblRuntimeInfo; |
||||
@FXML private Label lblRuntime; |
||||
@FXML private Label lblLanguageInfo; |
||||
@FXML private Label lblLanguage; |
||||
@FXML private Label lblRevenueInfo; |
||||
@FXML private Label lblRevenue; |
||||
@FXML private Label lblRatingInfo; |
||||
@FXML private Label lblRating; |
||||
|
||||
@FXML private JFXButton btnWishlist; |
||||
@FXML private JFXButton btnFavourite; |
||||
@FXML private JFXButton btnHide; |
||||
@FXML private JFXButton btnPlay; |
||||
@FXML private JFXButton btnDirectory; |
||||
|
||||
@FXML private ImageView wishlistIcon; |
||||
@FXML private ImageView favoriteIcon; |
||||
@FXML private ImageView imgPoster; |
||||
|
||||
@FXML private Text textPlot; |
||||
|
||||
private DBController dbController; |
||||
private static final Logger LOGGER = LogManager.getLogger(FilmDetailView.class.getName()); |
||||
private String currentStreamURL; |
||||
|
||||
public void initialize() { |
||||
dbController = DBController.getInstance(); |
||||
filmDVPane.setStyle("-fx-background-color: rgba(89,89,89,0.9);"); |
||||
} |
||||
|
||||
@FXML |
||||
private void btnWishlistAction() { |
||||
|
||||
} |
||||
|
||||
@FXML |
||||
private void btnFavouriteAction() { |
||||
dbController.toggleFavoriteState(currentStreamURL); |
||||
|
||||
// update the favorite icon
|
||||
if(dbController.getFavoriteState(currentStreamURL) == 1) { |
||||
favoriteIcon.setImage(new Image("icons/baseline_favorite_black_48dp.png")); |
||||
} else { |
||||
favoriteIcon.setImage(new Image("icons/baseline_favorite_border_black_48dp.png")); |
||||
} |
||||
} |
||||
|
||||
@FXML |
||||
private void btnHideAction() { |
||||
hidePane(); |
||||
} |
||||
|
||||
@FXML |
||||
private void btnPlayAction() { |
||||
playFilm(); |
||||
} |
||||
|
||||
@FXML |
||||
private void btnDirectoryAction() { |
||||
File dest = new File(currentStreamURL).getParentFile(); |
||||
|
||||
if (!System.getProperty("os.name").contains("Linux")) { |
||||
try { |
||||
Desktop.getDesktop().open(dest); |
||||
} catch (IOException e) { |
||||
e.printStackTrace(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* set the cached data of a stream to the FilmDetailView |
||||
* @param streamURL URL of the stream |
||||
*/ |
||||
public void setFilm(String streamURL) { |
||||
currentStreamURL = streamURL; |
||||
String[] cacheInfo = dbController.readCache(streamURL); // get the cache data from the database
|
||||
|
||||
// add the cache data to the GUI
|
||||
lblTitle.setText(cacheInfo[0]); |
||||
lblYear.setText("(" + cacheInfo[1] + ")"); |
||||
lblScore.setText(XMLController.getLocalBundle().getString("score") + ": " + cacheInfo[15] + "%"); |
||||
|
||||
textPlot.setText(cacheInfo[11]); |
||||
|
||||
lblDirectors.setText(cacheInfo[8]); |
||||
lblWriters.setText(cacheInfo[9]); |
||||
lblActors.setText(cacheInfo[10]); |
||||
|
||||
lblRuntime.setText(cacheInfo[6]); |
||||
lblLanguage.setText(cacheInfo[12]); |
||||
lblRevenue.setText(cacheInfo[18]); |
||||
lblRating.setText(cacheInfo[2]); |
||||
|
||||
try { |
||||
if (new File(cacheInfo[20]).isFile()) { |
||||
imgPoster.setImage(new Image(new File(cacheInfo[20]).toURI().toString())); |
||||
} else { |
||||
imgPoster.setImage(new Image(cacheInfo[20])); |
||||
} |
||||
} catch (Exception e) { |
||||
imgPoster.setImage(new Image("icons/Homeflix_Poster.png")); |
||||
LOGGER.error("No Poster found, useing default."); |
||||
} |
||||
|
||||
// set the favorite correct icon
|
||||
if(dbController.getFavoriteState(streamURL) == 1) { |
||||
favoriteIcon.setImage(new Image("icons/baseline_favorite_black_48dp.png")); |
||||
} else { |
||||
favoriteIcon.setImage(new Image("icons/baseline_favorite_border_black_48dp.png")); |
||||
} |
||||
|
||||
} |
||||
|
||||
/** |
||||
* update the text of all static GUI elements of FilmDeatilView |
||||
*/ |
||||
public void updateGUILocal() { |
||||
lblCrew.setText(XMLController.getLocalBundle().getString("crew")); |
||||
lblDirectorsInfo.setText(XMLController.getLocalBundle().getString("directors")); |
||||
lblWritersInfo.setText(XMLController.getLocalBundle().getString("writers")); |
||||
lblActorsInfo.setText(XMLController.getLocalBundle().getString("actors")); |
||||
|
||||
lblInfo.setText(XMLController.getLocalBundle().getString("info")); |
||||
lblRuntimeInfo.setText(XMLController.getLocalBundle().getString("runtime")); |
||||
lblLanguageInfo.setText(XMLController.getLocalBundle().getString("language")); |
||||
lblRevenueInfo.setText(XMLController.getLocalBundle().getString("boxOffice")); |
||||
lblRatingInfo.setText(XMLController.getLocalBundle().getString("rated")); |
||||
} |
||||
|
||||
/** |
||||
* show the FilmDVpane |
||||
*/ |
||||
public void showPane() { |
||||
filmDVPane.setVisible(true); |
||||
FadeTransition fadeIn = new FadeTransition(Duration.millis(300), filmDVPane); |
||||
fadeIn.setFromValue(0.3); |
||||
fadeIn.setToValue(1.0); |
||||
fadeIn.play(); |
||||
} |
||||
|
||||
/** |
||||
* hide the FilmDVpane |
||||
*/ |
||||
private void hidePane() { |
||||
FadeTransition fadeOut = new FadeTransition(Duration.millis(200), filmDVPane); |
||||
fadeOut.setFromValue(1.0); |
||||
fadeOut.setToValue(0.3); |
||||
fadeOut.play(); |
||||
|
||||
filmDVPane.setVisible(false); |
||||
|
||||
MainWindowController.getInstance().disableBlur(); // disable blur
|
||||
} |
||||
|
||||
private void playFilm() { |
||||
if(new File(currentStreamURL).isDirectory()) { |
||||
return; |
||||
} |
||||
|
||||
new Player(currentStreamURL); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,8 @@
|
||||
package kellerkinder.HomeFlix.application; |
||||
|
||||
public class JavaFX11Main { |
||||
|
||||
public static void main(String[] args) { |
||||
Main.main(args); |
||||
} |
||||
} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,239 @@
|
||||
/** |
||||
* Project-HomeFlix |
||||
* |
||||
* Copyright 2016-2019 <@Seil0> |
||||
* |
||||
* 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 kellerkinder.HomeFlix.application; |
||||
|
||||
import java.awt.Desktop; |
||||
import java.io.File; |
||||
import java.io.IOException; |
||||
|
||||
import org.apache.logging.log4j.LogManager; |
||||
import org.apache.logging.log4j.Logger; |
||||
|
||||
import com.jfoenix.controls.JFXButton; |
||||
|
||||
import javafx.animation.FadeTransition; |
||||
import javafx.collections.FXCollections; |
||||
import javafx.collections.ObservableList; |
||||
import javafx.fxml.FXML; |
||||
import javafx.scene.control.ChoiceBox; |
||||
import javafx.scene.control.Label; |
||||
import javafx.scene.control.ScrollPane; |
||||
import javafx.scene.control.ScrollPane.ScrollBarPolicy; |
||||
import javafx.scene.image.Image; |
||||
import javafx.scene.image.ImageView; |
||||
import javafx.scene.layout.AnchorPane; |
||||
import javafx.scene.layout.HBox; |
||||
import javafx.scene.text.Text; |
||||
import javafx.util.Duration; |
||||
import kellerkinder.HomeFlix.controller.DBController; |
||||
import kellerkinder.HomeFlix.controller.XMLController; |
||||
import kellerkinder.HomeFlix.datatypes.SeriresDVEpisode; |
||||
import kellerkinder.HomeFlix.player.Player; |
||||
|
||||
public class SeriesDetailView { |
||||
|
||||
@FXML private AnchorPane seriesDVPane; |
||||
@FXML private ScrollPane scrollPaneEpisodes; |
||||
|
||||
@FXML private HBox hBoxEpisodes; |
||||
|
||||
@FXML private Label lblTitle; |
||||
@FXML private Label lblYear; |
||||
@FXML private Label lblScore; |
||||
|
||||
@FXML private Label lblCrew; |
||||
@FXML private Label lblDirectors; |
||||
@FXML private Label lblDirectorsInfo; |
||||
@FXML private Label lblWriters; |
||||
@FXML private Label lblWritersInfo; |
||||
@FXML private Label lblActors; |
||||
@FXML private Label lblActorsInfo; |
||||
|
||||
@FXML private JFXButton btnWishlist; |
||||
@FXML private JFXButton btnFavourite; |
||||
@FXML private JFXButton btnHide; |
||||
@FXML private JFXButton btnPlay; |
||||
@FXML private JFXButton btnDirectory; |
||||
|
||||
@FXML private ImageView wishlistIcon; |
||||
@FXML private ImageView favoriteIcon; |
||||
@FXML private ImageView imgPoster; |
||||
|
||||
@FXML private Text textPlot; |
||||
|
||||
@FXML private ChoiceBox<String> cbSeason; |
||||
|
||||
private DBController dbController; |
||||
private static final Logger LOGGER = LogManager.getLogger(SeriesDetailView.class.getName()); |
||||
private String currentStreamURL; |
||||
|
||||
public void initialize() { |
||||
dbController = DBController.getInstance(); |
||||
seriesDVPane.setStyle("-fx-background-color: rgba(89,89,89,0.9);"); |
||||
scrollPaneEpisodes.setStyle("-fx-background-color: transparent;"); |
||||
scrollPaneEpisodes.setHbarPolicy(ScrollBarPolicy.ALWAYS); |
||||
|
||||
cbSeason.getSelectionModel().selectedIndexProperty().addListener((e, oldValue, newValue) -> { |
||||
addEpisodes(newValue.intValue() + 1); |
||||
}); |
||||
} |
||||
|
||||
@FXML |
||||
private void btnWishlistAction() { |
||||
|
||||
} |
||||
|
||||
@FXML |
||||
private void btnFavouriteAction() { |
||||
dbController.toggleFavoriteState(currentStreamURL); |
||||
|
||||
// update the favorite icon
|
||||
if(dbController.getFavoriteState(currentStreamURL) == 1) { |
||||
favoriteIcon.setImage(new Image("icons/baseline_favorite_black_48dp.png")); |
||||
} else { |
||||
favoriteIcon.setImage(new Image("icons/baseline_favorite_border_black_48dp.png")); |
||||
} |
||||
} |
||||
|
||||
@FXML |
||||
private void btnHideAction() { |
||||
hidePane(); |
||||
} |
||||
|
||||
@FXML |
||||
private void btnPlayAction() { |
||||
new Player(dbController.getLastWatchedEpisode(currentStreamURL)); |
||||
} |
||||
|
||||
@FXML |
||||
private void btnDirectoryAction() { |
||||
File dest = new File(currentStreamURL).getParentFile(); |
||||
|
||||
if (!System.getProperty("os.name").contains("Linux")) { |
||||
try { |
||||
Desktop.getDesktop().open(dest); |
||||
} catch (IOException e) { |
||||
e.printStackTrace(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* set the cached data of a series to the SeriesDetailView |
||||
* @param streamURL URL of the series root directory |
||||
*/ |
||||
public void setSeries(String streamURL) { |
||||
currentStreamURL = streamURL; |
||||
String[] cacheInfo = dbController.readCache(streamURL); // get the cache data from the database
|
||||
|
||||
// add the cache data to the GUI
|
||||
lblTitle.setText(cacheInfo[0]); |
||||
lblYear.setText("(" + cacheInfo[1] + ")"); |
||||
lblScore.setText(XMLController.getLocalBundle().getString("score") + ": " + cacheInfo[15] + "%"); |
||||
|
||||
textPlot.setText(cacheInfo[11]); |
||||
|
||||
lblDirectors.setText(cacheInfo[8]); |
||||
lblWriters.setText(cacheInfo[9]); |
||||
lblActors.setText(cacheInfo[10]); |
||||
|
||||
try { |
||||
imgPoster.setImage(new Image(new File(cacheInfo[20]).toURI().toString())); |
||||
} catch (Exception e) { |
||||
imgPoster.setImage(new Image("icons/Homeflix_Poster.png")); |
||||
LOGGER.error("No Poster found, useing default."); |
||||
} |
||||
|
||||
// set the favorite correct icon
|
||||
if(dbController.getFavoriteState(streamURL) == 1) { |
||||
favoriteIcon.setImage(new Image("icons/baseline_favorite_black_48dp.png")); |
||||
} else { |
||||
favoriteIcon.setImage(new Image("icons/baseline_favorite_border_black_48dp.png")); |
||||
} |
||||
|
||||
// add all seasons to the ChoiceBox
|
||||
ObservableList<String> seasons = FXCollections.observableArrayList(); |
||||
for (int i = 1; i <= new File(currentStreamURL).listFiles().length; i++) { |
||||
seasons.add("Season " + i); |
||||
} |
||||
cbSeason.getItems().clear(); |
||||
cbSeason.setItems(seasons); |
||||
cbSeason.getSelectionModel().select(0); |
||||
|
||||
// add all episodes for season 1
|
||||
addEpisodes(1); |
||||
} |
||||
|
||||
/** |
||||
* update the text of all static GUI elements of FilmDeatilView |
||||
*/ |
||||
public void updateGUILocal() { |
||||
lblCrew.setText(XMLController.getLocalBundle().getString("crew")); |
||||
lblDirectorsInfo.setText(XMLController.getLocalBundle().getString("directors")); |
||||
lblWritersInfo.setText(XMLController.getLocalBundle().getString("writers")); |
||||
lblActorsInfo.setText(XMLController.getLocalBundle().getString("actors")); |
||||
} |
||||
|
||||
/** |
||||
* show the FilmDVpane |
||||
*/ |
||||
public void showPane() { |
||||
seriesDVPane.setVisible(true); |
||||
FadeTransition fadeIn = new FadeTransition(Duration.millis(300), seriesDVPane); |
||||
fadeIn.setFromValue(0.3); |
||||
fadeIn.setToValue(1.0); |
||||
fadeIn.play(); |
||||
} |
||||
|
||||
/** |
||||
* hide the FilmDVpane |
||||
*/ |
||||
private void hidePane() { |
||||
FadeTransition fadeOut = new FadeTransition(Duration.millis(200), seriesDVPane); |
||||
fadeOut.setFromValue(1.0); |
||||
fadeOut.setToValue(0.3); |
||||
fadeOut.play(); |
||||
|
||||
seriesDVPane.setVisible(false); |
||||
|
||||
MainWindowController.getInstance().disableBlur(); // disable blur
|
||||
} |
||||
|
||||
/** |
||||
* add all episodes of one season to the ScrollPane |
||||
* @param season the season to add |
||||
*/ |
||||
private void addEpisodes(int season) { |
||||
hBoxEpisodes.getChildren().clear(); |
||||
for (String[] episodePoster : dbController.getEpisodes(new File(currentStreamURL).getName(), season)) { |
||||
Image poster; |
||||
try { |
||||
poster = new Image(episodePoster[2].length() > 0 ? new File(episodePoster[2]).toURI().toString() : "icons/Homeflix_Poster.png"); |
||||
} catch (Exception e) { |
||||
poster = new Image("icons/Homeflix_Poster.png"); |
||||
} |
||||
hBoxEpisodes.getChildren().add(new SeriresDVEpisode(episodePoster[0], episodePoster[1], poster)); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,308 @@
|
||||
/** |
||||
* Project-HomeFlix |
||||
* |
||||
* Copyright 2016-2019 <@Seil0> |
||||
* |
||||
* 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 kellerkinder.HomeFlix.application; |
||||
|
||||
import java.io.File; |
||||
import java.io.FileReader; |
||||
import java.io.FileWriter; |
||||
import java.io.IOException; |
||||
import java.io.Writer; |
||||
|
||||
import org.apache.logging.log4j.LogManager; |
||||
import org.apache.logging.log4j.Logger; |
||||
|
||||
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.JFXSlider; |
||||
import com.jfoenix.controls.JFXToggleButton; |
||||
|
||||
import javafx.collections.FXCollections; |
||||
import javafx.collections.ObservableList; |
||||
import javafx.event.ActionEvent; |
||||
import javafx.fxml.FXML; |
||||
import javafx.scene.control.ChoiceBox; |
||||
import javafx.scene.control.Label; |
||||
import javafx.scene.control.ScrollPane; |
||||
import javafx.scene.control.ScrollPane.ScrollBarPolicy; |
||||
import javafx.scene.control.TableColumn; |
||||
import javafx.scene.control.TableView; |
||||
import javafx.scene.layout.AnchorPane; |
||||
import javafx.scene.paint.Color; |
||||
import javafx.stage.DirectoryChooser; |
||||
import javafx.stage.FileChooser; |
||||
import kellerkinder.HomeFlix.controller.DBController; |
||||
import kellerkinder.HomeFlix.controller.UpdateController; |
||||
import kellerkinder.HomeFlix.controller.XMLController; |
||||
import kellerkinder.HomeFlix.datatypes.SourceDataType; |
||||
|
||||
public class SettingsView { |
||||
|
||||
@FXML private ScrollPane settingsScrollPane; |
||||
@FXML private AnchorPane settingsAnchorPane; |
||||
|
||||
@FXML private Label homeflixSettingsLbl; |
||||
@FXML private Label mainColorLbl; |
||||
@FXML private Label fontsizeLbl; |
||||
@FXML private Label languageLbl; |
||||
@FXML private Label updateLbl; |
||||
@FXML private Label branchLbl; |
||||
@FXML private Label versionLbl; |
||||
@FXML private Label PlayerLbl; |
||||
@FXML private Label sourcesLbl; |
||||
|
||||
@FXML private JFXColorPicker colorPicker; |
||||
@FXML private JFXSlider fontsizeSlider; |
||||
|
||||
@FXML private ChoiceBox<String> languageChoisBox; |
||||
@FXML private ChoiceBox<String> branchChoisBox; |
||||
|
||||
@FXML private JFXButton updateBtn; |
||||
@FXML private JFXButton addStreamSourceBtn; |
||||
@FXML private JFXButton addDirectoryBtn; |
||||
|
||||
@FXML private JFXToggleButton autoUpdateToggleBtn; |
||||
@FXML private JFXToggleButton autoplayToggleBtn; |
||||
|
||||
@FXML private TableView<SourceDataType> sourcesTable; |
||||
@FXML private TableColumn<SourceDataType, String> sourceColumn; |
||||
@FXML private TableColumn<SourceDataType, String> modeColumn; |
||||
|
||||
private XMLController xmlController; |
||||
private static final Logger LOGGER = LogManager.getLogger(FilmDetailView.class.getName()); |
||||
private ObservableList<String> languages = FXCollections.observableArrayList("English (en_US)", "Deutsch (de_DE)"); |
||||
private ObservableList<String> branches = FXCollections.observableArrayList("stable", "beta"); |
||||
private static ObservableList<SourceDataType> sourcesList = FXCollections.observableArrayList(); |
||||
|
||||
public void initialize() { |
||||
xmlController = new XMLController(); |
||||
|
||||
// initialize the GUI elements
|
||||
settingsScrollPane.setVbarPolicy(ScrollBarPolicy.ALWAYS); |
||||
versionLbl.setText("Version: " + Main.version + " (Build: " + Main.buildNumber + ")"); |
||||
fontsizeSlider.setValue(XMLController.getFontSize()); |
||||
colorPicker.setValue(Color.valueOf(XMLController.getColor())); |
||||
|
||||
autoUpdateToggleBtn.setSelected(XMLController.isAutoUpdate()); |
||||
autoplayToggleBtn.setSelected(XMLController.isAutoplay()); |
||||
languageChoisBox.setItems(languages); |
||||
branchChoisBox.setItems(branches); |
||||
|
||||
branchChoisBox.getSelectionModel().select(XMLController.isUseBeta() ? 1 : 0); |
||||
// TODO switch expressions
|
||||
switch (XMLController.getUsrLocal()) { |
||||
case "en_US": |
||||
languageChoisBox.getSelectionModel().select(0); |
||||
break; |
||||
case "de_DE": |
||||
languageChoisBox.getSelectionModel().select(1); |
||||
break; |
||||
default: |
||||
languageChoisBox.getSelectionModel().select(0); |
||||
break; |
||||
} |
||||
|
||||
// initialize the sources table
|
||||
sourceColumn.setCellValueFactory(cellData -> cellData.getValue().pathProperty()); |
||||
modeColumn.setCellValueFactory(cellData -> cellData.getValue().modeProperty()); |
||||
sourcesTable.setItems(sourcesList); |
||||
|
||||
initActions(); |
||||
loadInitSources(); |
||||
} |
||||
|
||||
private void initActions() { |
||||
languageChoisBox.getSelectionModel().selectedIndexProperty().addListener((e, oldValue, newValue) -> { |
||||
String local = languageChoisBox.getItems().get((int) newValue).toString(); |
||||
local = local.substring(local.length() - 6, local.length() - 1); // reading only en_US from English (en_US)
|
||||
|
||||
XMLController.setUsrLocal(local); |
||||
xmlController.saveSettings(); |
||||
MainWindowController.getInstance().setLocalUI(); |
||||
}); |
||||
|
||||
branchChoisBox.getSelectionModel().selectedIndexProperty().addListener((e, oldValue, newValue) -> { |
||||
if (branchChoisBox.getItems().get((int) newValue).toString() == "beta") { |
||||
XMLController.setUseBeta(true); |
||||
} else { |
||||
XMLController.setUseBeta(false); |
||||
} |
||||
xmlController.saveSettings(); |
||||
}); |
||||
|
||||
fontsizeSlider.valueProperty().addListener(e -> { |
||||
XMLController.setFontSize(fontsizeSlider.getValue()); |
||||
xmlController.saveSettings(); |
||||
|
||||
// TODO add functionality for postermode
|
||||
}); |
||||
} |
||||
|
||||
@FXML |
||||
private void addDirectoryBtnAction(ActionEvent event) { |
||||
DirectoryChooser directoryChooser = new DirectoryChooser(); |
||||
directoryChooser.setTitle(XMLController.getLocalBundle().getString("addDirectory")); |
||||
File selectedFolder = directoryChooser.showDialog(settingsScrollPane.getScene().getWindow()); |
||||
if (selectedFolder != null && selectedFolder.exists()) { |
||||
addSource(selectedFolder.getPath(), "local"); |
||||
} else { |
||||
LOGGER.error("The selected folder dosen't exist!"); |
||||
} |
||||
} |
||||
|
||||
@FXML |
||||
private void addStreamSourceBtnAction(ActionEvent event) { |
||||
FileChooser fileChooser = new FileChooser(); |
||||
fileChooser.setTitle(XMLController.getLocalBundle().getString("addStreamSource")); |
||||
File selectedFile = fileChooser.showOpenDialog(settingsScrollPane.getScene().getWindow()); |
||||
if (selectedFile != null && selectedFile.exists()) { |
||||
addSource(selectedFile.getPath(), "stream"); |
||||
} else { |
||||
LOGGER.error("The selected file dosen't exist!"); |
||||
} |
||||
} |
||||
|
||||
@FXML |
||||
private void autoUpdateToggleBtnAction(ActionEvent event) { |
||||
XMLController.setAutoUpdate(!XMLController.isAutoUpdate()); |
||||
xmlController.saveSettings(); |
||||
} |
||||
|
||||
@FXML |
||||
private void autoplayToggleBtnAction(ActionEvent event) { |
||||
XMLController.setAutoplay(!XMLController.isAutoplay()); |
||||
xmlController.saveSettings(); |
||||
} |
||||
|
||||
@FXML |
||||
private void colorPickerAction(ActionEvent event) { |
||||
XMLController.setColor(colorPicker.getValue().toString().substring(2, 10)); |
||||
xmlController.saveSettings(); |
||||
MainWindowController.getInstance().applyColor(); |
||||
} |
||||
|
||||
@FXML |
||||
private void updateBtnAction(ActionEvent event) { |
||||
|
||||
|
||||
new UpdateController(); |
||||
if (UpdateController.isUpdateAvailable()) { |
||||
updateBtn.setText(XMLController.getLocalBundle().getString("updateBtnUpdateAvailable")); |
||||
UpdateController.update(); |
||||
} else { |
||||
updateBtn.setText(XMLController.getLocalBundle().getString("updateBtnNoUpdateAvailable")); |
||||
} |
||||
|
||||
} |
||||
|
||||
/** TODO can this be done async? |
||||
* add a source to the sources file and load all new streams |
||||
* @param path to the source |
||||
* @param mode of the source (local or streaming) |
||||
*/ |
||||
void addSource(String path, String mode) { |
||||
JsonArray newsources = null; |
||||
|
||||
try {settingsScrollPane.setVbarPolicy(ScrollBarPolicy.ALWAYS); |
||||
// read old array
|
||||
File oldSources = new File(XMLController.getDirHomeFlix() + "/sources.json"); |
||||
newsources = oldSources.exists() ? Json.parse(new FileReader(XMLController.getDirHomeFlix() + "/sources.json")).asArray() : Json.array(); |
||||
|
||||
// add new source
|
||||
JsonObject source = Json.object().add("path", path).add("mode", mode); |
||||
newsources.add(source); |
||||
Writer writer = new FileWriter(XMLController.getDirHomeFlix() + "/sources.json"); |
||||
newsources.writeTo(writer); |
||||
writer.close(); |
||||
} catch (IOException e) { |
||||
LOGGER.error(e); |
||||
} |
||||
|
||||
// update the sourcesTable
|
||||
sourcesList.add(new SourceDataType(path, mode)); |
||||
|
||||
DBController.getInstance().refreshDataBase(); // refreshes the database after a source path was added
|
||||
MainWindowController.getInstance().checkAllPosters(); // check if there is anything new to cache
|
||||
MainWindowController.getInstance().addAllPosters(); |
||||