Compare commits
38 Commits
Author | SHA1 | Date | |
---|---|---|---|
a77ed0b8e2 | |||
8283620620 | |||
59bfe126c5 | |||
ae525f6c49 | |||
70a6485a36 | |||
2c92af45c9 | |||
49588e40e8 | |||
c6f51fbc76 | |||
0aca3b964a | |||
888a2c5014 | |||
43ef370596 | |||
29517f5604 | |||
e53d1d1176 | |||
43a31d0682 | |||
fd59384d1b | |||
edcbe4b278 | |||
86c84479d8 | |||
0a5234e46a | |||
96d0412919 | |||
8786b8edef | |||
853daafe34 | |||
d8383b98d6 | |||
cccbca06bd | |||
726a788876 | |||
10a640a34c | |||
32e5d829cc | |||
df448e321d | |||
4d3c402553 | |||
0f5d0b859f | |||
131c8a491b | |||
d91ef3aeac | |||
bef90522ca | |||
8dcb737e4d | |||
6524b3e139 | |||
0cf8905125 | |||
c49714f641 | |||
16d324fdf1 | |||
8029d4294f |
@ -1,12 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" path="src"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.8.0_131"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.fx.ide.jdt.core.JAVAFX_CONTAINER"/>
|
<classpathentry kind="con" path="org.eclipse.fx.ide.jdt.core.JAVAFX_CONTAINER"/>
|
||||||
<classpathentry kind="lib" path="src/libraries/minimal-json-0.9.4.jar"/>
|
<classpathentry kind="lib" path="src/libraries/minimal-json-0.9.4.jar"/>
|
||||||
<classpathentry kind="lib" path="src/libraries/commons-lang3-3.5.jar"/>
|
<classpathentry kind="lib" path="src/libraries/commons-io-2.5.jar"/>
|
||||||
<classpathentry kind="lib" path="src/libraries/jfoenix-1.1.0.jar"/>
|
<classpathentry kind="lib" path="src/libraries/jfoenix-1.4.0.jar"/>
|
||||||
<classpathentry kind="lib" path="src/libraries/sqlite-jdbc-3.16.1.jar"/>
|
<classpathentry kind="lib" path="src/libraries/sqlite-jdbc-3.18.0.jar"/>
|
||||||
<classpathentry kind="lib" path="C:/Users/Jannik/Downloads/flow-8.0.7.jar"/>
|
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
1
.gitignore
vendored
@ -46,4 +46,5 @@ Network Trash Folder
|
|||||||
Temporary Items
|
Temporary Items
|
||||||
.apdisk
|
.apdisk
|
||||||
config.xml
|
config.xml
|
||||||
|
.directory
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
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.targetPlatform=1.8
|
||||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||||
|
@ -2,17 +2,19 @@
|
|||||||
|
|
||||||
|
|
||||||
Project HomeFlix is a Kellerkinder Project, that alowes you to sort all your local saved movies in clean UI.
|
Project HomeFlix is a Kellerkinder Project, that alowes you to sort all your local saved movies in clean UI.
|
||||||
This is the master branch, it is **only merged** with dev if a **new release** is out.
|
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:
|
Librarys used in this Project:
|
||||||
JFoenix: https://github.com/jfoenixadmin/JFoenix
|
JFoenix: https://github.com/jfoenixadmin/JFoenix
|
||||||
minimal-json: https://github.com/ralfstx/minimal-json
|
minimal-json: https://github.com/ralfstx/minimal-json
|
||||||
Commons Lang: https://commons.apache.org/proper/commons-lang/
|
|
||||||
sqlite-jdbc: https://github.com/xerial/sqlite-jdbc
|
sqlite-jdbc: https://github.com/xerial/sqlite-jdbc
|
||||||
|
apache commons io : https://commons.apache.org/proper/commons-io/
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
[wiki](https://github.com/Seil0/Project-HomeFlix/wiki)
|
[wiki](https://github.com/Seil0/Project-HomeFlix/wiki)
|
||||||
|
|
||||||
Project HomeFlix © 2016-2017 Software Development Kellerkinder (SDK)
|
Project HomeFlix © 2016-2017 Kellerkinder ([Seil0](https://github.com/Seil0), [Windoofs](https://github.com/Windoofs))
|
||||||
www.kellerkinder.xyz
|
www.kellerkinder.xyz
|
||||||
|
1
bin/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/application/
|
@ -2,12 +2,14 @@
|
|||||||
|
|
||||||
<?import com.jfoenix.controls.JFXButton?>
|
<?import com.jfoenix.controls.JFXButton?>
|
||||||
<?import com.jfoenix.controls.JFXColorPicker?>
|
<?import com.jfoenix.controls.JFXColorPicker?>
|
||||||
|
<?import com.jfoenix.controls.JFXHamburger?>
|
||||||
<?import com.jfoenix.controls.JFXSlider?>
|
<?import com.jfoenix.controls.JFXSlider?>
|
||||||
<?import com.jfoenix.controls.JFXTextArea?>
|
|
||||||
<?import com.jfoenix.controls.JFXTextField?>
|
<?import com.jfoenix.controls.JFXTextField?>
|
||||||
<?import com.jfoenix.controls.JFXToggleButton?>
|
<?import com.jfoenix.controls.JFXToggleButton?>
|
||||||
|
<?import javafx.geometry.Insets?>
|
||||||
<?import javafx.scene.control.ChoiceBox?>
|
<?import javafx.scene.control.ChoiceBox?>
|
||||||
<?import javafx.scene.control.Label?>
|
<?import javafx.scene.control.Label?>
|
||||||
|
<?import javafx.scene.control.ScrollPane?>
|
||||||
<?import javafx.scene.control.TableView?>
|
<?import javafx.scene.control.TableView?>
|
||||||
<?import javafx.scene.control.TreeTableView?>
|
<?import javafx.scene.control.TreeTableView?>
|
||||||
<?import javafx.scene.image.Image?>
|
<?import javafx.scene.image.Image?>
|
||||||
@ -20,9 +22,12 @@
|
|||||||
|
|
||||||
<AnchorPane fx:id="anpane" prefHeight="600.0" prefWidth="950.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="application.MainWindowController">
|
<AnchorPane fx:id="anpane" prefHeight="600.0" prefWidth="950.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="application.MainWindowController">
|
||||||
<children>
|
<children>
|
||||||
<TreeTableView fx:id="treeTableViewfilm" layoutX="14.0" layoutY="88.0" prefHeight="400.0" prefWidth="360.0" AnchorPane.bottomAnchor="12.0" AnchorPane.leftAnchor="12.0" AnchorPane.rightAnchor="553.0" AnchorPane.topAnchor="88.0" />
|
<ScrollPane fx:id="scrollPane" fitToWidth="true" layoutX="408.0" layoutY="44.0" prefHeight="544.0" prefWidth="320.0" AnchorPane.bottomAnchor="12.0" AnchorPane.leftAnchor="408.0" AnchorPane.rightAnchor="222.0" AnchorPane.topAnchor="44.0">
|
||||||
<JFXTextArea fx:id="ta1" layoutX="385.0" layoutY="42.0" maxWidth="503.0" minWidth="275.0" prefHeight="546.0" prefWidth="293.0" AnchorPane.bottomAnchor="12.0" AnchorPane.leftAnchor="410.0" AnchorPane.rightAnchor="222.0" AnchorPane.topAnchor="44.0" />
|
<content>
|
||||||
<TextFlow fx:id="textFlow" layoutX="496.0" layoutY="131.0" prefHeight="200.0" prefWidth="200.0" visible="false" AnchorPane.bottomAnchor="15.0" AnchorPane.leftAnchor="410.0" AnchorPane.rightAnchor="220.0" AnchorPane.topAnchor="44.0" />
|
<TextFlow fx:id="textFlow" accessibleRole="TEXT_AREA" maxHeight="544.0" maxWidth="320.0" visible="true" />
|
||||||
|
</content>
|
||||||
|
</ScrollPane>
|
||||||
|
<TreeTableView fx:id="treeTableViewfilm" layoutX="14.0" layoutY="88.0" prefHeight="500.0" prefWidth="375.0" AnchorPane.bottomAnchor="12.0" AnchorPane.leftAnchor="12.0" AnchorPane.rightAnchor="568.0" AnchorPane.topAnchor="88.0" />
|
||||||
<JFXButton fx:id="playbtn" contentDisplay="CENTER" layoutX="690.0" layoutY="363.0" onAction="#playbtnclicked" prefHeight="25.0" prefWidth="198.0" AnchorPane.bottomAnchor="212.0" AnchorPane.rightAnchor="12.0">
|
<JFXButton fx:id="playbtn" contentDisplay="CENTER" layoutX="690.0" layoutY="363.0" onAction="#playbtnclicked" prefHeight="25.0" prefWidth="198.0" AnchorPane.bottomAnchor="212.0" AnchorPane.rightAnchor="12.0">
|
||||||
<font>
|
<font>
|
||||||
<Font name="System Bold" size="14.0" />
|
<Font name="System Bold" size="14.0" />
|
||||||
@ -31,22 +36,26 @@
|
|||||||
<font>
|
<font>
|
||||||
<Font name="System Bold" size="14.0" />
|
<Font name="System Bold" size="14.0" />
|
||||||
</font></JFXButton>
|
</font></JFXButton>
|
||||||
<JFXTextField fx:id="tfsearch" layoutX="12.0" layoutY="44.0" maxWidth="477.0" minWidth="359.0" prefHeight="31.0" prefWidth="359.0" promptText="Suche ..." AnchorPane.leftAnchor="12.0" AnchorPane.rightAnchor="553.0" AnchorPane.topAnchor="44.0">
|
<JFXTextField fx:id="tfsearch" layoutX="12.0" layoutY="44.0" maxWidth="477.0" minWidth="359.0" prefHeight="31.0" prefWidth="370.0" promptText="Suche ..." AnchorPane.leftAnchor="12.0" AnchorPane.rightAnchor="568.0" AnchorPane.topAnchor="44.0">
|
||||||
<font>
|
<font>
|
||||||
<Font name="Arial" size="12.0" />
|
<Font name="Arial" size="12.0" />
|
||||||
</font></JFXTextField>
|
</font></JFXTextField>
|
||||||
<ImageView fx:id="image1" fitHeight="297.0" fitWidth="198.0" layoutX="481.0" layoutY="46.0" pickOnBounds="true" preserveRatio="true" AnchorPane.rightAnchor="12.0" AnchorPane.topAnchor="44.0">
|
<ImageView fx:id="image1" fitHeight="297.0" fitWidth="198.0" layoutX="481.0" layoutY="46.0" pickOnBounds="true" preserveRatio="true" AnchorPane.rightAnchor="12.0" AnchorPane.topAnchor="44.0">
|
||||||
<image>
|
<image>
|
||||||
<Image url="@../recources/Homeflix_Poster.png" />
|
<Image url="@../resources/Homeflix_Poster.png" />
|
||||||
</image></ImageView>
|
</image></ImageView>
|
||||||
<JFXButton fx:id="returnBtn" contentDisplay="CENTER" layoutX="690.0" layoutY="443.0" onAction="#returnBtnclicked" prefHeight="25.0" prefWidth="90.0" AnchorPane.bottomAnchor="132.0" AnchorPane.rightAnchor="120.0" />
|
<JFXButton fx:id="returnBtn" contentDisplay="CENTER" layoutX="690.0" layoutY="443.0" onAction="#returnBtnclicked" prefHeight="25.0" prefWidth="90.0" AnchorPane.bottomAnchor="132.0" AnchorPane.rightAnchor="120.0" />
|
||||||
<JFXButton fx:id="forwardBtn" contentDisplay="CENTER" layoutX="798.0" layoutY="443.0" onAction="#forwardBtnclicked" prefHeight="25.0" prefWidth="90.0" AnchorPane.bottomAnchor="132.0" AnchorPane.rightAnchor="12.0" />
|
<JFXButton fx:id="forwardBtn" contentDisplay="CENTER" layoutX="798.0" layoutY="443.0" onAction="#forwardBtnclicked" prefHeight="25.0" prefWidth="90.0" AnchorPane.bottomAnchor="132.0" AnchorPane.rightAnchor="12.0" />
|
||||||
<HBox fx:id="topHBox" layoutY="12.0" prefHeight="32.0" prefWidth="900.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
<HBox fx:id="topHBox" layoutY="12.0" prefHeight="32.0" prefWidth="900.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||||
<children>
|
<children>
|
||||||
<JFXButton fx:id="menubtn" onAction="#menubtnclicked" prefHeight="32.0" prefWidth="32.0" />
|
<JFXHamburger fx:id="menuHam">
|
||||||
|
<padding>
|
||||||
|
<Insets left="3.0" />
|
||||||
|
</padding>
|
||||||
|
</JFXHamburger>
|
||||||
</children>
|
</children>
|
||||||
</HBox>
|
</HBox>
|
||||||
<VBox fx:id="sideMenuVBox" layoutY="32.0" prefHeight="660.0" prefWidth="150.0" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="38.0">
|
<VBox fx:id="sideMenuVBox" layoutY="32.0" prefHeight="660.0" prefWidth="150.0" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="32.0">
|
||||||
<children>
|
<children>
|
||||||
<JFXButton fx:id="infoBtn" onAction="#infoBtnclicked" prefHeight="32.0" prefWidth="150.0" textAlignment="CENTER">
|
<JFXButton fx:id="infoBtn" onAction="#infoBtnclicked" prefHeight="32.0" prefWidth="150.0" textAlignment="CENTER">
|
||||||
<font>
|
<font>
|
||||||
@ -78,21 +87,28 @@
|
|||||||
<AnchorPane fx:id="streamingSettingsAnchor" layoutX="138.0" layoutY="33.0" prefHeight="566.0" prefWidth="760.0" style="-fx-background-color: #FFFFFF;" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="150.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="38.0">
|
<AnchorPane fx:id="streamingSettingsAnchor" layoutX="138.0" layoutY="33.0" prefHeight="566.0" prefWidth="760.0" style="-fx-background-color: #FFFFFF;" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="150.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="38.0">
|
||||||
<children>
|
<children>
|
||||||
<JFXTextField fx:id="tfStreamingPath" layoutX="14.0" layoutY="14.0" onAction="#tfStreamingPathAction" prefWidth="250.0" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="5.0" />
|
<JFXTextField fx:id="tfStreamingPath" layoutX="14.0" layoutY="14.0" onAction="#tfStreamingPathAction" prefWidth="250.0" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="5.0" />
|
||||||
<JFXButton fx:id="streamingDirectoryBtn" layoutX="263.0" layoutY="2.0" onAction="#streamingDirectoryBtnAction" AnchorPane.leftAnchor="260.0" AnchorPane.topAnchor="5.0" />
|
<JFXButton fx:id="streamingDirectoryBtn" layoutX="263.0" layoutY="2.0" onAction="#streamingDirectoryBtnAction" prefHeight="25.0" prefWidth="115.0" AnchorPane.leftAnchor="260.0" AnchorPane.topAnchor="5.0" />
|
||||||
<TableView fx:id="tableViewStreamingdata" layoutX="14.0" layoutY="44.0" prefHeight="200.0" prefWidth="300.0" AnchorPane.bottomAnchor="5.0" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="40.0" />
|
<TableView fx:id="tableViewStreamingdata" layoutX="14.0" layoutY="44.0" prefHeight="517.0" prefWidth="370.0" AnchorPane.bottomAnchor="5.0" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="40.0" />
|
||||||
</children></AnchorPane>
|
</children></AnchorPane>
|
||||||
<AnchorPane fx:id="settingsAnchor" layoutX="160.0" layoutY="44.0" prefHeight="566.0" prefWidth="760.0" style="-fx-background-color: #FFFFFF;" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="150.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="38.0">
|
<AnchorPane fx:id="settingsAnchor" layoutX="160.0" layoutY="44.0" prefHeight="566.0" prefWidth="760.0" style="-fx-background-color: #FFFFFF;" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="150.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="38.0">
|
||||||
<children>
|
<children>
|
||||||
<JFXTextField fx:id="tfPath" layoutX="14.0" layoutY="14.0" onAction="#tfPathAction" prefWidth="250.0" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="5.0" />
|
<JFXTextField fx:id="tfPath" layoutX="14.0" layoutY="81.0" onAction="#tfPathAction" prefWidth="250.0" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="79.0" />
|
||||||
<JFXButton fx:id="directoryBtn" layoutX="255.0" layoutY="8.0" onAction="#directoryBtnAction" prefHeight="25.0" AnchorPane.leftAnchor="260.0" />
|
<JFXButton fx:id="directoryBtn" layoutX="276.0" layoutY="82.0" onAction="#directoryBtnAction" prefHeight="25.0" AnchorPane.leftAnchor="269.0" AnchorPane.topAnchor="82.0" />
|
||||||
<JFXColorPicker fx:id="mainColor" layoutX="14.0" layoutY="45.0" onAction="#mainColorAction" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="40.0" />
|
<JFXColorPicker fx:id="mainColor" layoutX="118.0" layoutY="130.0" onAction="#mainColorAction" AnchorPane.leftAnchor="118.0" AnchorPane.topAnchor="130.0" />
|
||||||
<Label fx:id="sizelbl" layoutY="73.0" text="Label" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="75.0" />
|
<Label fx:id="fontsizeLabel" layoutX="14.0" layoutY="179.0" text="Fontsize" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="175.0" />
|
||||||
<JFXSlider fx:id="sliderFontSize" layoutX="10.0" layoutY="99.0" max="48.0" min="2.0" prefWidth="250.0" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="110.0" />
|
<JFXSlider fx:id="sliderFontSize" layoutX="118.0" layoutY="177.0" max="48.0" min="2.0" prefWidth="250.0" AnchorPane.leftAnchor="118.0" AnchorPane.topAnchor="177.0" />
|
||||||
<ChoiceBox fx:id="cbLocal" layoutX="14.0" layoutY="131.0" prefWidth="150.0" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="145.0" />
|
<ChoiceBox fx:id="cbLocal" layoutX="118.0" layoutY="208.0" prefWidth="150.0" AnchorPane.leftAnchor="118.0" AnchorPane.topAnchor="208.0" />
|
||||||
<JFXButton fx:id="updateBtn" layoutX="7.0" layoutY="177.0" onAction="#updateBtnAction" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="180.0" />
|
<JFXButton fx:id="updateBtn" layoutX="16.0" layoutY="269.0" onAction="#updateBtnAction" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="253.0" />
|
||||||
<Label fx:id="aulbl" layoutX="43.0" layoutY="219.0" text="Label" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="215.0" />
|
<Label fx:id="autoUpdateLabel" layoutX="14.0" layoutY="310.0" prefHeight="17.0" text="check at startup for updates:" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="298.0" />
|
||||||
<JFXToggleButton fx:id="autoupdateBtn" layoutX="19.0" layoutY="215.0" onAction="#autoupdateBtnAction" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="230.0" />
|
<JFXToggleButton fx:id="autoupdateBtn" layoutX="14.0" layoutY="336.0" onAction="#autoupdateBtnAction" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="320.0" />
|
||||||
<Label fx:id="versionlbl" layoutX="29.0" layoutY="297.0" text="Label" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="280.0" />
|
<Label fx:id="versionLabel" layoutX="14.0" layoutY="418.0" text="Label" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="396.0" />
|
||||||
|
<Label fx:id="settingsHead1Label" layoutX="14.0" layoutY="24.0" text="HomeFlix Settings" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="24.0">
|
||||||
|
<font>
|
||||||
|
<Font name="System Bold" size="14.0" />
|
||||||
|
</font>
|
||||||
|
</Label>
|
||||||
|
<Label fx:id="mainColorLabel" layoutX="14.0" layoutY="134.0" prefHeight="25.0" text="Main-Color" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="130.0" />
|
||||||
|
<Label fx:id="localLabel" layoutX="14.0" layoutY="207.0" text="Local" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="212.0" />
|
||||||
</children>
|
</children>
|
||||||
</AnchorPane>
|
</AnchorPane>
|
||||||
</children>
|
</children>
|
||||||
|
@ -1 +0,0 @@
|
|||||||
/* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */
|
|
BIN
bin/application/tableData.class
Normal file
BIN
bin/libraries/commons-io-2.5.jar
Normal file
BIN
bin/libraries/jfoenix-1.4.0.jar
Normal file
BIN
bin/libraries/sqlite-jdbc-3.18.0.jar
Normal file
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 15 KiB |
@ -1,23 +1,35 @@
|
|||||||
# HomeFlix-Local_de_DE.properties German Local
|
#HomeFlix-Local_de_DE.properties German Local
|
||||||
|
|
||||||
|
#main window translations
|
||||||
info = Info
|
info = Info
|
||||||
settings = Einstellungen
|
settings = Einstellungen
|
||||||
streamingSettings = Stream Einst.
|
streamingSettings = Stream Einst.
|
||||||
tfPath = Pfad...
|
|
||||||
tfSearch = Suche...
|
tfSearch = Suche...
|
||||||
openFolder = Ordner \u00F6ffnen
|
openFolder = Ordner \u00F6ffnen
|
||||||
|
|
||||||
|
#settings translations
|
||||||
|
settingsHead1Label = HomeFlix Einstellungen
|
||||||
|
tfPath = Pfad...
|
||||||
chooseFolder = Ordner ausw\u00E4hlen
|
chooseFolder = Ordner ausw\u00E4hlen
|
||||||
fontSize = Schriftgr\u00F6\u00DFe:
|
mainColorLabel = Hauptfarbe:
|
||||||
|
fontsizeLabel = Schriftgr\u00F6\u00DFe:
|
||||||
|
localLabel = Sprache:
|
||||||
checkUpdates = Auf Update pr\u00FCfen
|
checkUpdates = Auf Update pr\u00FCfen
|
||||||
|
checkingUpdates = Es wird nach Updates gesucht...
|
||||||
updateBtnavail = Update verf\u00FCgbar
|
updateBtnavail = Update verf\u00FCgbar
|
||||||
updateBtnNotavail = Kein Update verf\u00FCgbar
|
updateBtnNotavail = Kein Update verf\u00FCgbar
|
||||||
autoUpdate = beim Start nach Updates suchen:
|
autoUpdateLabel = beim Start nach Updates suchen:
|
||||||
version = Version:
|
version = Version:
|
||||||
|
|
||||||
|
#column translations
|
||||||
columnName = Name
|
columnName = Name
|
||||||
columnRating = Bewertung
|
columnRating = Bewertung
|
||||||
columnStreamUrl = Datei Name
|
columnStreamUrl = Datei Name
|
||||||
columnResolution = Aufl\u00F6sung
|
columnResolution = Aufl\u00F6sung
|
||||||
columnSeason = Staffel
|
columnSeason = Staffel
|
||||||
columnYear = Jahr
|
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
|
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
|
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
|
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
|
||||||
@ -26,9 +38,10 @@ errorOpenStream = Beim \u00F6ffnen des Streams ist ein Fehler aufgetreten!
|
|||||||
errorLoad = Beim laden der Einstellungen ist ein Fehler aufgetreten!
|
errorLoad = Beim laden der Einstellungen ist ein Fehler aufgetreten!
|
||||||
errorSave = Beim speichern der Einstellungen ist ein Fehler aufgetreten!
|
errorSave = Beim speichern der Einstellungen ist ein Fehler aufgetreten!
|
||||||
noFilmFound = Kein Film mit diesem Titel gefunden!
|
noFilmFound = Kein Film mit diesem Titel gefunden!
|
||||||
linuxBug = Zurzeit werden unter Linux leider keine Dateien mit Leerzeichen unterst\u00FCtzt!
|
|
||||||
vlcNotInstalled = Um einen Film abspielen wird der VLC Media Player ben\u00F6tigt!
|
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
|
infoText = \nMaintainer: seilo@kellerkinder.xyz und \nhendrik.schutter@coptersicht.de \n(c) 2016-2017 Kellerkinder www.kellerkinder.xyz
|
||||||
|
|
||||||
|
#textFlow translations
|
||||||
title = Titel
|
title = Titel
|
||||||
year = Jahr
|
year = Jahr
|
||||||
rating = Einstufung
|
rating = Einstufung
|
||||||
@ -45,5 +58,6 @@ awards = Auszeichnungen
|
|||||||
metascore = Metascore
|
metascore = Metascore
|
||||||
imdbRating = IMDB-Bewertung
|
imdbRating = IMDB-Bewertung
|
||||||
type = Type
|
type = Type
|
||||||
|
|
||||||
firstStartHeader = Es ist kein Stammverzeichnis f\u00FCr Filme angegeben!
|
firstStartHeader = Es ist kein Stammverzeichnis f\u00FCr Filme angegeben!
|
||||||
firstStartContent = Stammverzeichniss angeben?
|
firstStartContent = Stammverzeichniss angeben?
|
@ -1,23 +1,35 @@
|
|||||||
# HomeFlix-Local_en_US.properties US-English Local and default
|
#HomeFlix-Local_en_US.properties US-English Local and default
|
||||||
|
|
||||||
|
#main window translations
|
||||||
info = Info
|
info = Info
|
||||||
settings = Settings
|
settings = Settings
|
||||||
streamingSettings = Stream Settings
|
streamingSettings = Stream Settings
|
||||||
tfPath = Path...
|
|
||||||
tfSearch = Search...
|
tfSearch = Search...
|
||||||
openFolder = open Folder
|
openFolder = open Folder
|
||||||
|
|
||||||
|
#settings translations
|
||||||
|
settingsHead1Label = HomeFlix Settings
|
||||||
|
tfPath = Path...
|
||||||
chooseFolder = choose Directory
|
chooseFolder = choose Directory
|
||||||
fontSize = font size:
|
mainColorLabel = main color:
|
||||||
|
fontsizeLabel = font size:
|
||||||
|
localLabel = local:
|
||||||
checkUpdates = check for updates
|
checkUpdates = check for updates
|
||||||
|
checkingUpdates = checking for updates...
|
||||||
updateBtnavail = update available
|
updateBtnavail = update available
|
||||||
updateBtnNotavail = no update available
|
updateBtnNotavail = no update available
|
||||||
autoUpdate = check at startup for updates:
|
autoUpdateLabel = check at startup for updates:
|
||||||
version = Version:
|
version = Version:
|
||||||
|
|
||||||
|
#column translations
|
||||||
columnName = Name
|
columnName = Name
|
||||||
columnRating = Rating
|
columnRating = Rating
|
||||||
columnStreamUrl = File Name
|
columnStreamUrl = File Name
|
||||||
columnResolution = Resolution
|
columnResolution = Resolution
|
||||||
columnSeason = Season
|
columnSeason = Season
|
||||||
columnYear = Year
|
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
|
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
|
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
|
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
|
||||||
@ -26,9 +38,10 @@ errorOpenStream = An error has occurred during opening the stream!
|
|||||||
errorLoad = An error occurred while loading the settings!
|
errorLoad = An error occurred while loading the settings!
|
||||||
errorSave = An error occurred while saving the settings!
|
errorSave = An error occurred while saving the settings!
|
||||||
noFilmFound = No film with this title found!
|
noFilmFound = No film with this title found!
|
||||||
linuxBug = Currently no files are supported with additional space under Linux unfortunately!
|
|
||||||
vlcNotInstalled = VLC Media Player is required to play a movie!
|
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
|
infoText = \nMaintainer: seilo@kellerkinder.xyz and \nhendrik.schutter@coptersicht.de \n(c) 2016-2017 Kellerkinder www.kellerkinder.xyz
|
||||||
|
|
||||||
|
#textFlow translations
|
||||||
title = Title
|
title = Title
|
||||||
year = Year
|
year = Year
|
||||||
rating = Rating
|
rating = Rating
|
||||||
@ -45,5 +58,6 @@ awards = Awards
|
|||||||
metascore = Metascore
|
metascore = Metascore
|
||||||
imdbRating = IMDB-Rating
|
imdbRating = IMDB-Rating
|
||||||
type = Type
|
type = Type
|
||||||
|
|
||||||
firstStartHeader = There is no root directory for movies!
|
firstStartHeader = There is no root directory for movies!
|
||||||
firstStartContent = Specify a root directory?
|
firstStartContent = Specify a root directory?
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.3 KiB |
Before Width: | Height: | Size: 214 B After Width: | Height: | Size: 214 B |
Before Width: | Height: | Size: 261 B After Width: | Height: | Size: 261 B |
Before Width: | Height: | Size: 131 B After Width: | Height: | Size: 131 B |
Before Width: | Height: | Size: 135 B After Width: | Height: | Size: 135 B |
Before Width: | Height: | Size: 215 B After Width: | Height: | Size: 215 B |
Before Width: | Height: | Size: 128 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 134 B After Width: | Height: | Size: 134 B |
Before Width: | Height: | Size: 131 B After Width: | Height: | Size: 131 B |
Before Width: | Height: | Size: 138 B After Width: | Height: | Size: 138 B |
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
|
* @author Jannik
|
||||||
* DBController for Project HomeFlix
|
* DBController for Project HomeFlix
|
||||||
* connection is in manual commit!
|
* connection is in manual commit!
|
||||||
* TODO arraylists not string -> streamUIData
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package application;
|
package application;
|
||||||
@ -23,20 +23,24 @@ import com.eclipsesource.json.Json;
|
|||||||
import com.eclipsesource.json.JsonArray;
|
import com.eclipsesource.json.JsonArray;
|
||||||
import com.eclipsesource.json.JsonObject;
|
import com.eclipsesource.json.JsonObject;
|
||||||
import com.eclipsesource.json.JsonValue;
|
import com.eclipsesource.json.JsonValue;
|
||||||
|
|
||||||
import javafx.scene.image.Image;
|
import javafx.scene.image.Image;
|
||||||
import javafx.scene.image.ImageView;
|
import javafx.scene.image.ImageView;
|
||||||
|
import javafx.scene.text.Font;
|
||||||
|
import javafx.scene.text.FontWeight;
|
||||||
|
import javafx.scene.text.Text;
|
||||||
|
|
||||||
public class DBController {
|
public class DBController {
|
||||||
|
|
||||||
public DBController(MainWindowController m) {
|
public DBController(MainWindowController m, Main main) {
|
||||||
mainWindowController = m;
|
mainWindowController = m;
|
||||||
|
this.main = main;
|
||||||
}
|
}
|
||||||
|
|
||||||
private MainWindowController mainWindowController;
|
private MainWindowController mainWindowController;
|
||||||
|
private Main main;
|
||||||
private String DB_PATH = System.getProperty("user.home") + "\\Documents\\HomeFlix" + "\\" + "Homeflix.db"; //path to database file
|
private String DB_PATH = System.getProperty("user.home") + "\\Documents\\HomeFlix" + "\\" + "Homeflix.db"; //path to database file
|
||||||
private Image favorite_black = new Image("recources/icons/ic_favorite_black_18dp_1x.png");
|
private Image favorite_black = new Image("resources/icons/ic_favorite_black_18dp_1x.png");
|
||||||
private Image favorite_border_black = new Image("recources/icons/ic_favorite_border_black_18dp_1x.png");
|
private Image favorite_border_black = new Image("resources/icons/ic_favorite_border_black_18dp_1x.png");
|
||||||
private List<String> filmsdbAll = new ArrayList<String>();
|
private List<String> filmsdbAll = new ArrayList<String>();
|
||||||
private List<String> filmsdbLocal = new ArrayList<String>();
|
private List<String> filmsdbLocal = new ArrayList<String>();
|
||||||
private List<String> filmsdbStream = new ArrayList<String>();
|
private List<String> filmsdbStream = new ArrayList<String>();
|
||||||
@ -57,15 +61,13 @@ public class DBController {
|
|||||||
try {
|
try {
|
||||||
// create a database connection
|
// create a database connection
|
||||||
connection = DriverManager.getConnection("jdbc:sqlite:" + DB_PATH);
|
connection = DriverManager.getConnection("jdbc:sqlite:" + DB_PATH);
|
||||||
// Statement statement = connection.createStatement();
|
|
||||||
// statement.setQueryTimeout(30); // set timeout to 30 sec. TODO don't know what to do with this
|
|
||||||
|
|
||||||
connection.setAutoCommit(false); //AutoCommit to false -> manual commit is active
|
connection.setAutoCommit(false); //AutoCommit to false -> manual commit is active
|
||||||
// fuelleDatenbank();
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
// if the error message is "out of memory", it probably means no database file is found
|
// if the error message is "out of memory", it probably means no database file is found
|
||||||
System.err.println(e.getMessage());
|
System.err.println(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//close connection -> at the moment this kills the program
|
||||||
// finally {
|
// finally {
|
||||||
// try {
|
// try {
|
||||||
// if (connection != null)
|
// if (connection != null)
|
||||||
@ -85,8 +87,8 @@ public class DBController {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
stmt.executeUpdate("create table if not exists film_local (rating, titel, streamUrl, favIcon)");
|
stmt.executeUpdate("create table if not exists film_local (rating, titel, streamUrl, favIcon, cached)");
|
||||||
stmt.executeUpdate("create table if not exists film_streaming (year, season, episode, rating, resolution, titel, streamUrl, favIcon)");
|
stmt.executeUpdate("create table if not exists film_streaming (year, season, episode, rating, resolution, titel, streamUrl, favIcon, cached)");
|
||||||
stmt.close();
|
stmt.close();
|
||||||
} catch (SQLException e1) {
|
} catch (SQLException e1) {
|
||||||
e1.printStackTrace();
|
e1.printStackTrace();
|
||||||
@ -113,16 +115,20 @@ public class DBController {
|
|||||||
ea.printStackTrace();
|
ea.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//getting all files from the selected directory TODO rework
|
||||||
String[] entries = new File(mainWindowController.getPath()).list();
|
String[] entries = new File(mainWindowController.getPath()).list();
|
||||||
if(mainWindowController.getPath().equals("") || mainWindowController.getPath() == null){
|
if(mainWindowController.getPath().equals("") || mainWindowController.getPath() == null){
|
||||||
System.out.println("Kein Pfad angegeben"); //if path == null or ""
|
System.out.println("Kein Pfad angegeben"); //if path == null or ""
|
||||||
}else{
|
}else if(new File(mainWindowController.getPath()).exists()) {
|
||||||
System.out.println(entries.length);
|
System.out.println(entries.length);
|
||||||
for(int i=0;i!=entries.length;i++){
|
for(int i=0;i!=entries.length;i++){
|
||||||
filmsDir.add(cutOffEnd(entries[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++){
|
for(int v=0; v< mainWindowController.streamingData.size(); v++){
|
||||||
String fileName = mainWindowController.getStreamingPath()+"/"+mainWindowController.streamingData.get(v).getStreamUrl();
|
String fileName = mainWindowController.getStreamingPath()+"/"+mainWindowController.streamingData.get(v).getStreamUrl();
|
||||||
try {
|
try {
|
||||||
@ -137,6 +143,8 @@ public class DBController {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//add all entries to filmsAll and filmsdbAl, for later comparing
|
||||||
filmsAll.addAll(filmsDir);
|
filmsAll.addAll(filmsDir);
|
||||||
filmsAll.addAll(filmsStream);
|
filmsAll.addAll(filmsStream);
|
||||||
filmsdbAll.addAll(filmsdbLocal);
|
filmsdbAll.addAll(filmsdbLocal);
|
||||||
@ -144,23 +152,28 @@ public class DBController {
|
|||||||
System.out.println("films in directory: "+filmsAll.size());
|
System.out.println("films in directory: "+filmsAll.size());
|
||||||
System.out.println("filme in db: "+filmsdbAll.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){
|
if(filmsdbAll.size() == 0){
|
||||||
System.out.println("creating entries ...");
|
System.out.println("creating entries ...");
|
||||||
|
|
||||||
try{
|
try{
|
||||||
ps = connection.prepareStatement("insert into film_local values (?, ?, ?, ?)");
|
ps = connection.prepareStatement("insert into film_local values (?, ?, ?, ?, ?)");
|
||||||
psS = connection.prepareStatement("insert into film_streaming values (?, ?, ?, ?, ?, ?, ?, ?)");
|
psS = connection.prepareStatement("insert into film_streaming values (?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||||
|
|
||||||
if(mainWindowController.getPath().equals("") || mainWindowController.getPath() == null){
|
if(mainWindowController.getPath().equals("") || mainWindowController.getPath() == null){
|
||||||
System.out.println("Kein Pfad angegeben"); //if path == null or ""
|
System.out.println("Kein Pfad angegeben"); //if path == null or ""
|
||||||
}else{
|
}else if(new File(mainWindowController.getPath()).exists()){
|
||||||
for(int j=0;j!=entries.length;j++) //goes through all the files in the directory
|
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.setInt(1, 0); //rating as integer 1. column
|
||||||
ps.setString(2, cutOffEnd(entries[j])); //name as String without ending 2. 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(3,entries[j]); //path as String 3. column
|
||||||
ps.setString(4, "favorite_border_black");
|
ps.setString(4, "favorite_border_black");
|
||||||
|
ps.setBoolean(5, false);
|
||||||
ps.addBatch(); // add command to prepared statement
|
ps.addBatch(); // add command to prepared statement
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -182,6 +195,7 @@ public class DBController {
|
|||||||
psS.setString(6, item.asObject().getString("titel",""));
|
psS.setString(6, item.asObject().getString("titel",""));
|
||||||
psS.setString(7, item.asObject().getString("streamUrl", ""));
|
psS.setString(7, item.asObject().getString("streamUrl", ""));
|
||||||
psS.setString(8, "favorite_border_black");
|
psS.setString(8, "favorite_border_black");
|
||||||
|
psS.setBoolean(9, false);
|
||||||
psS.addBatch(); // add command to prepared statement
|
psS.addBatch(); // add command to prepared statement
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@ -195,23 +209,32 @@ public class DBController {
|
|||||||
ps.close();
|
ps.close();
|
||||||
psS.close();
|
psS.close();
|
||||||
}catch (SQLException ea) {
|
}catch (SQLException ea) {
|
||||||
System.err.println("Konnte nicht ausgef<65>hrt werden");
|
System.err.println("Ups! an error occured!");
|
||||||
ea.printStackTrace();
|
ea.printStackTrace();
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
try {
|
try {
|
||||||
checkAddEntry();
|
checkAddEntry(); //check if added a new file
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} //check if added a new file
|
}
|
||||||
checkRemoveEntry(); //check if removed a file
|
checkRemoveEntry(); //check if removed a file
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
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
|
//loading data from database to mainWindowController
|
||||||
@ -220,24 +243,24 @@ public class DBController {
|
|||||||
try {
|
try {
|
||||||
//load local Data
|
//load local Data
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
ResultSet rs = stmt.executeQuery("SELECT * FROM film_local");
|
ResultSet rs = stmt.executeQuery("SELECT * FROM film_local ORDER BY titel");
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
if(rs.getString(4).equals("favorite_black")){
|
if(rs.getString(4).equals("favorite_black")){
|
||||||
mainWindowController.newData.add( new streamUiData(1, 1, 1, rs.getDouble(1), "1", rs.getString(2), rs.getString(3), new ImageView(favorite_black)));
|
mainWindowController.localFilms.add( new tableData(1, 1, 1, rs.getDouble(1), "1", rs.getString(2), rs.getString(3), new ImageView(favorite_black),rs.getBoolean(5)));
|
||||||
}else{
|
}else{
|
||||||
mainWindowController.newData.add( new streamUiData(1, 1, 1, rs.getDouble(1), "1", rs.getString(2), rs.getString(3), new ImageView(favorite_border_black)));
|
mainWindowController.localFilms.add( new tableData(1, 1, 1, rs.getDouble(1), "1", rs.getString(2), rs.getString(3), new ImageView(favorite_border_black),rs.getBoolean(5)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stmt.close();
|
stmt.close();
|
||||||
rs.close();
|
rs.close();
|
||||||
|
|
||||||
//load streaming Data TODO check if there are streaming data before loading -> maybe there is an issue now
|
//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;");
|
rs = stmt.executeQuery("SELECT * FROM film_streaming ORDER BY titel;");
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
if(rs.getString(8).equals("favorite_black")){
|
if(rs.getString(8).equals("favorite_black")){
|
||||||
mainWindowController.streamData.add(new streamUiData(rs.getInt(1), rs.getInt(2), rs.getInt(3), rs.getDouble(4), rs.getString(5), rs.getString(6), rs.getString(7), new ImageView(favorite_black)));
|
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{
|
}else{
|
||||||
mainWindowController.streamData.add(new streamUiData(rs.getInt(1), rs.getInt(2), rs.getInt(3), rs.getDouble(4), rs.getString(5), rs.getString(6), rs.getString(7), new ImageView(favorite_border_black)));
|
mainWindowController.streamingFilms.add(new tableData(rs.getInt(1), rs.getInt(2), rs.getInt(3), rs.getDouble(4), rs.getString(5), rs.getString(6), rs.getString(7), new ImageView(favorite_border_black),rs.getBoolean(9)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stmt.close();
|
stmt.close();
|
||||||
@ -250,29 +273,29 @@ public class DBController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Refreshes the data in mainWindowController.newDaten and mainWindowController.streamData
|
//Refreshes the data in mainWindowController.newDaten and mainWindowController.streamData
|
||||||
//TODO it seems that there is an issue at the moment with streaming refreshing wrong entry if there is more than one with the same name
|
//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{
|
void refresh(String name,int i) throws SQLException{
|
||||||
System.out.println("refresh ...");
|
System.out.println("refresh ...");
|
||||||
Statement stmt;
|
Statement stmt;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
stmt = connection.createStatement();
|
stmt = connection.createStatement();
|
||||||
ResultSet rs = stmt.executeQuery("SELECT * FROM film_local WHERE titel = '"+name+"';" );
|
ResultSet rs = stmt.executeQuery("SELECT * FROM film_local WHERE titel = \""+name+"\";" );
|
||||||
if(rs.getString(4).equals("favorite_black")){
|
if(rs.getString(4).equals("favorite_black")){
|
||||||
mainWindowController.newData.set(i, new streamUiData(1, 1, 1, rs.getDouble(1), "1", rs.getString(2), rs.getString(3), new ImageView(favorite_black)));
|
mainWindowController.localFilms.set(i, new tableData(1, 1, 1, rs.getDouble(1), "1", rs.getString(2), rs.getString(3), new ImageView(favorite_black),rs.getBoolean(5)));
|
||||||
}else{
|
}else{
|
||||||
mainWindowController.newData.set(i, new streamUiData(1, 1, 1, rs.getDouble(1), "1", rs.getString(2), rs.getString(3), new ImageView(favorite_border_black)));
|
mainWindowController.localFilms.set(i, new tableData(1, 1, 1, rs.getDouble(1), "1", rs.getString(2), rs.getString(3), new ImageView(favorite_border_black),rs.getBoolean(5)));
|
||||||
}
|
}
|
||||||
stmt.close();
|
stmt.close();
|
||||||
rs.close();
|
rs.close();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
try {
|
try {
|
||||||
stmt = connection.createStatement();
|
stmt = connection.createStatement();
|
||||||
ResultSet rs = stmt.executeQuery("SELECT * FROM film_streaming WHERE titel = '"+name+"';" );
|
ResultSet rs = stmt.executeQuery("SELECT * FROM film_streaming WHERE titel = \""+name+"\";" );
|
||||||
if(rs.getString(8).equals("favorite_black")){
|
if(rs.getString(8).equals("favorite_black")){
|
||||||
mainWindowController.streamData.set(i,new streamUiData(rs.getInt(1), rs.getInt(2), rs.getInt(3), rs.getDouble(4), rs.getString(5), rs.getString(6), rs.getString(7), new ImageView(favorite_black)));
|
mainWindowController.streamingFilms.set(i,new tableData(rs.getInt(1), rs.getInt(2), rs.getInt(3), rs.getDouble(4), rs.getString(5), rs.getString(6), rs.getString(7), new ImageView(favorite_black),rs.getBoolean(9)));
|
||||||
}else{
|
}else{
|
||||||
mainWindowController.streamData.set(i,new streamUiData(rs.getInt(1), rs.getInt(2), rs.getInt(3), rs.getDouble(4), rs.getString(5), rs.getString(6), rs.getString(7), new ImageView(favorite_border_black)));
|
mainWindowController.streamingFilms.set(i,new tableData(rs.getInt(1), rs.getInt(2), rs.getInt(3), rs.getDouble(4), rs.getString(5), rs.getString(6), rs.getString(7), new ImageView(favorite_border_black),rs.getBoolean(9)));
|
||||||
}
|
}
|
||||||
stmt.close();
|
stmt.close();
|
||||||
rs.close();
|
rs.close();
|
||||||
@ -282,44 +305,59 @@ public class DBController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* check if there are any entries that have been removed from the film-directory
|
||||||
|
* @throws SQLException
|
||||||
|
*/
|
||||||
private void checkRemoveEntry() throws SQLException{
|
private void checkRemoveEntry() throws SQLException{
|
||||||
System.out.println("checking for entrys to remove to DB ...");
|
System.out.println("checking for entrys to remove to DB ...");
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
|
|
||||||
for(int a=0; a<filmsdbLocal.size(); a++){
|
for(int a=0; a<filmsdbLocal.size(); a++){
|
||||||
if(filmsDir.contains(filmsdbLocal.get(a))){
|
if(!filmsDir.contains(filmsdbLocal.get(a))){
|
||||||
}else{
|
try {
|
||||||
stmt.executeUpdate("delete from film_local where titel = '"+filmsdbLocal.get(a)+"'");
|
stmt.executeUpdate("delete from film_local where titel = \""+filmsdbLocal.get(a) + "\"");
|
||||||
connection.commit();
|
connection.commit();
|
||||||
stmt.close();
|
stmt.close();
|
||||||
System.out.println("removed \""+filmsdbLocal.get(a)+"\" from databsae");
|
System.out.println("removed \""+filmsdbLocal.get(a)+"\" from databsae");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int b=0; b<filmsdbStreamURL.size(); b++){
|
for(int b=0; b<filmsdbStreamURL.size(); b++){
|
||||||
if(filmsStreamURL.contains(filmsdbStreamURL.get(b))){
|
if(!filmsStreamURL.contains(filmsdbStreamURL.get(b))){
|
||||||
}else{
|
try {
|
||||||
stmt.executeUpdate("delete from film_streaming where titel = '"+filmsdbStream.get(b)+"'");
|
stmt.executeUpdate("delete from film_streaming where titel = \"" + filmsdbStream.get(b) + "\"");
|
||||||
connection.commit();
|
connection.commit();
|
||||||
stmt.close();
|
stmt.close();
|
||||||
System.out.println("removed \""+filmsdbStream.get(b)+"\" from databsae");
|
System.out.println("removed \""+filmsdbStream.get(b)+"\" from databsae");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
/**
|
||||||
|
* check if there are new films in the film-directory
|
||||||
private void checkAddEntry() throws SQLException, FileNotFoundException, IOException{ //TODO sort alphabetical
|
* @throws SQLException
|
||||||
|
* @throws FileNotFoundException
|
||||||
|
* @throws IOException
|
||||||
|
* if lastName != filmsStreamData.get(b) then set i = 0, file changed
|
||||||
|
*/
|
||||||
|
private void checkAddEntry() throws SQLException, FileNotFoundException, IOException{
|
||||||
|
String lastName = "";
|
||||||
System.out.println("checking for entrys to add to DB ...");
|
System.out.println("checking for entrys to add to DB ...");
|
||||||
String[] entries = new File(mainWindowController.getPath()).list();
|
String[] entries = new File(mainWindowController.getPath()).list();
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
PreparedStatement ps = connection.prepareStatement("insert into film_streaming values (?, ?, ?, ?, ?, ?, ?, ?)");;
|
PreparedStatement ps = connection.prepareStatement("insert into film_streaming values (?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||||
int i=0;
|
int i=0;
|
||||||
|
|
||||||
for(int a=0; a<filmsDir.size(); a++){
|
for(int a=0; a<filmsDir.size(); a++){
|
||||||
if(filmsdbLocal.contains(filmsDir.get(a))){
|
if(!filmsdbLocal.contains(filmsDir.get(a))){
|
||||||
}else{
|
stmt.executeUpdate("insert into film_local values (0, \""+cutOffEnd(entries[a])+"\", \""+entries[a]+"\",\"favorite_border_black\",0)");
|
||||||
stmt.executeUpdate("insert into film_local values (0, '"+cutOffEnd(entries[a])+"', '"+entries[a]+"','favorite_border_black')");
|
|
||||||
connection.commit();
|
connection.commit();
|
||||||
stmt.close();
|
stmt.close();
|
||||||
System.out.println("added \""+filmsDir.get(a)+"\" to databsae");
|
System.out.println("added \""+filmsDir.get(a)+"\" to databsae");
|
||||||
@ -327,16 +365,20 @@ public class DBController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for(int b=0; b<filmsStreamURL.size(); b++){
|
for(int b=0; b<filmsStreamURL.size(); b++){
|
||||||
if(filmsdbStreamURL.contains(filmsStreamURL.get(b))){
|
if(filmsdbStreamURL.contains(filmsStreamURL.get(b))) {
|
||||||
}else{
|
} else {
|
||||||
|
if(lastName != "" && lastName != filmsStreamData.get(b)) {
|
||||||
|
i = 0;
|
||||||
|
}
|
||||||
|
lastName = filmsStreamData.get(b);
|
||||||
JsonObject object = Json.parse(new FileReader(filmsStreamData.get(b))).asObject();
|
JsonObject object = Json.parse(new FileReader(filmsStreamData.get(b))).asObject();
|
||||||
JsonArray items = object.get("entries").asArray();
|
JsonArray items = object.get("entries").asArray();
|
||||||
System.out.println(items.size()+", "+i);
|
System.out.println(items.size()+", "+i+"; "+b);
|
||||||
String streamURL = items.get(i).asObject().getString("streamUrl","");
|
String streamURL = items.get(i).asObject().getString("streamUrl","");
|
||||||
String titel = items.get(i).asObject().getString("titel","");
|
String titel = items.get(i).asObject().getString("titel","");
|
||||||
|
|
||||||
if(streamURL.equals(filmsStreamURL.get(b))){
|
if(streamURL.equals(filmsStreamURL.get(b))){
|
||||||
System.out.println("hinzuf<EFBFBD>gen \""+titel+"\"");
|
System.out.println("added \""+titel+"\"");
|
||||||
|
|
||||||
ps.setInt(1, items.get(i).asObject().getInt("year", 0));
|
ps.setInt(1, items.get(i).asObject().getInt("year", 0));
|
||||||
ps.setInt(2, items.get(i).asObject().getInt("season", 0));
|
ps.setInt(2, items.get(i).asObject().getInt("season", 0));
|
||||||
@ -346,9 +388,8 @@ public class DBController {
|
|||||||
ps.setString(6, items.get(i).asObject().getString("titel",""));
|
ps.setString(6, items.get(i).asObject().getString("titel",""));
|
||||||
ps.setString(7, items.get(i).asObject().getString("streamUrl", ""));
|
ps.setString(7, items.get(i).asObject().getString("streamUrl", ""));
|
||||||
ps.setString(8, "favorite_border_black");
|
ps.setString(8, "favorite_border_black");
|
||||||
|
ps.setBoolean(9, false);
|
||||||
ps.addBatch(); // adds the entry
|
ps.addBatch(); // adds the entry
|
||||||
|
|
||||||
// stmt.executeUpdate("insert into film_streaming values ("+items.get(i).asObject().getInt("year", 0)+", "+items.get(i).asObject().getInt("season", 0)+", "+items.get(i).asObject().getInt("episode", 0)+", 0, '"+items.get(i).asObject().getString("resolution", ""+"', '"+items.get(i).asObject().getString("titel","")+"', '"+items.get(i).asObject().getString("streamUrl", "")+"')"));
|
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
@ -359,7 +400,7 @@ public class DBController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ausgeben(){
|
void ausgeben(){
|
||||||
System.out.println("Eintraege ausgeben ... \n");
|
System.out.println("Outputting all entries ... \n");
|
||||||
try {
|
try {
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
ResultSet rs = stmt.executeQuery("SELECT * FROM film_local");
|
ResultSet rs = stmt.executeQuery("SELECT * FROM film_local");
|
||||||
@ -367,7 +408,8 @@ public class DBController {
|
|||||||
System.out.println(rs.getString(1));
|
System.out.println(rs.getString(1));
|
||||||
System.out.println(rs.getString(2));
|
System.out.println(rs.getString(2));
|
||||||
System.out.println(rs.getString(3));
|
System.out.println(rs.getString(3));
|
||||||
System.out.println(rs.getString(4)+"\n");
|
System.out.println(rs.getString(4));
|
||||||
|
System.out.println(rs.getString(5)+"\n");
|
||||||
}
|
}
|
||||||
stmt.close();
|
stmt.close();
|
||||||
rs.close();
|
rs.close();
|
||||||
@ -383,7 +425,8 @@ public class DBController {
|
|||||||
System.out.println(rs.getString(5));
|
System.out.println(rs.getString(5));
|
||||||
System.out.println(rs.getString(6));
|
System.out.println(rs.getString(6));
|
||||||
System.out.println(rs.getString(7));
|
System.out.println(rs.getString(7));
|
||||||
System.out.println(rs.getString(8)+"\n");
|
System.out.println(rs.getString(8));
|
||||||
|
System.out.println(rs.getString(9)+"\n");
|
||||||
}
|
}
|
||||||
stmt.close();
|
stmt.close();
|
||||||
rs.close();
|
rs.close();
|
||||||
@ -394,18 +437,18 @@ public class DBController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//gibt die Favorisierung eines bestimmten Films
|
//get favorite status
|
||||||
void getFavStatus(String name){
|
void getFavStatus(String name){
|
||||||
try{
|
try{
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
ResultSet rs = stmt.executeQuery("SELECT titel, rating, favIcon FROM film_local WHERE titel = '"+name+"';" ); //SQL Befehl
|
ResultSet rs = stmt.executeQuery("SELECT titel, rating, favIcon FROM film_local WHERE titel = \""+name+"\";" ); //SQL Befehl
|
||||||
System.out.println("local:"+rs.getString("rating")+", "+rs.getString("titel")+", "+rs.getString("favIcon"));
|
System.out.println("local:"+rs.getString("rating")+", "+rs.getString("titel")+", "+rs.getString("favIcon"));
|
||||||
stmt.close();
|
stmt.close();
|
||||||
rs.close();
|
rs.close();
|
||||||
}catch(SQLException e){
|
}catch(SQLException e){
|
||||||
try {
|
try {
|
||||||
Statement stmtS = connection.createStatement();
|
Statement stmtS = connection.createStatement();
|
||||||
ResultSet rsS = stmtS.executeQuery("SELECT titel, rating, favIcon FROM film_streaming WHERE titel = '"+name+"';" );
|
ResultSet rsS = stmtS.executeQuery("SELECT titel, rating, favIcon FROM film_streaming WHERE titel = \""+name+"\";" );
|
||||||
System.out.println("streaming:"+rsS.getString("rating")+", "+rsS.getString("titel")+", "+rsS.getString("favIcon"));
|
System.out.println("streaming:"+rsS.getString("rating")+", "+rsS.getString("titel")+", "+rsS.getString("favIcon"));
|
||||||
stmtS.close();
|
stmtS.close();
|
||||||
rsS.close();
|
rsS.close();
|
||||||
@ -416,12 +459,12 @@ public class DBController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//setzt die Defavorisierung eines bestimmten Films
|
//set rating=0 and favorite_border_black
|
||||||
void dislike(String name,String streamUrl){
|
void dislike(String name,String streamUrl){
|
||||||
System.out.println("defavorisieren ...");
|
System.out.println("defavorisieren ...");
|
||||||
try{
|
try{
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
stmt.executeUpdate("UPDATE film_local SET rating=0,favIcon='favorite_border_black' WHERE titel='"+name+"';");
|
stmt.executeUpdate("UPDATE film_local SET rating=0,favIcon='favorite_border_black' WHERE titel=\""+name+"\";");
|
||||||
connection.commit();
|
connection.commit();
|
||||||
stmt.close();
|
stmt.close();
|
||||||
}catch(SQLException e){
|
}catch(SQLException e){
|
||||||
@ -430,7 +473,7 @@ public class DBController {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
stmt.executeUpdate("UPDATE film_streaming SET rating=0,favIcon='favorite_border_black' WHERE streamUrl='"+streamUrl+"';");
|
stmt.executeUpdate("UPDATE film_streaming SET rating=0,favIcon='favorite_border_black' WHERE streamUrl=\""+streamUrl+"\";");
|
||||||
connection.commit();
|
connection.commit();
|
||||||
stmt.close();
|
stmt.close();
|
||||||
} catch (SQLException e1) {
|
} catch (SQLException e1) {
|
||||||
@ -438,12 +481,12 @@ public class DBController {
|
|||||||
e1.printStackTrace();
|
e1.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//setzt die Favorisierung eines bestimmten Films
|
//set rating=1 and favorite_black
|
||||||
void like(String name,String streamUrl){
|
void like(String name,String streamUrl){
|
||||||
System.out.println("favorisieren ...");
|
System.out.println("favorisieren ...");
|
||||||
try{
|
try{
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
stmt.executeUpdate("UPDATE film_local SET rating=1,favIcon='favorite_black' WHERE titel='"+name+"';");
|
stmt.executeUpdate("UPDATE film_local SET rating=1,favIcon='favorite_black' WHERE titel=\""+name+"\";");
|
||||||
connection.commit();
|
connection.commit();
|
||||||
stmt.close();
|
stmt.close();
|
||||||
}catch(SQLException e){
|
}catch(SQLException e){
|
||||||
@ -452,7 +495,7 @@ public class DBController {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
stmt.executeUpdate("UPDATE film_streaming SET rating=1,favIcon='favorite_black' WHERE streamUrl='"+streamUrl+"';");
|
stmt.executeUpdate("UPDATE film_streaming SET rating=1,favIcon='favorite_black' WHERE streamUrl=\""+streamUrl+"\";");
|
||||||
connection.commit();
|
connection.commit();
|
||||||
stmt.close();
|
stmt.close();
|
||||||
} catch (SQLException e1) {
|
} catch (SQLException e1) {
|
||||||
@ -461,6 +504,124 @@ public class DBController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setCached(String streamUrl) throws SQLException{
|
||||||
|
try{
|
||||||
|
Statement stmt = connection.createStatement();
|
||||||
|
stmt.executeUpdate("UPDATE film_local SET cached=1 WHERE streamUrl=\""+streamUrl+"\";");
|
||||||
|
connection.commit();
|
||||||
|
stmt.close();
|
||||||
|
}catch(SQLException e){
|
||||||
|
System.out.println("Ups! an error occured!");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Statement stmt = connection.createStatement();
|
||||||
|
stmt.executeUpdate("UPDATE film_streaming SET cached=1 WHERE streamUrl=\""+streamUrl+"\";");
|
||||||
|
connection.commit();
|
||||||
|
stmt.close();
|
||||||
|
} catch (SQLException e1) {
|
||||||
|
System.out.println("Ups! an error occured!");
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void addCache( String streamUrl, String Title, String Year, String Rated, String Released, String Runtime, String Genre, String Director,
|
||||||
|
String Writer, String Actors, String Plot, String Language, String Country, String Awards, String Metascore, String imdbRating,
|
||||||
|
String Type, String imdbVotes, String imdbID, String Poster, String Response) throws SQLException{
|
||||||
|
PreparedStatement ps = connection.prepareStatement("insert into cache values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
|
||||||
|
|
||||||
|
System.out.println("adding to cache: " + Title);
|
||||||
|
ps.setString(1,streamUrl);
|
||||||
|
ps.setString(2,Title);
|
||||||
|
ps.setString(3,Year);
|
||||||
|
ps.setString(4,Rated);
|
||||||
|
ps.setString(5,Released);
|
||||||
|
ps.setString(6,Runtime);
|
||||||
|
ps.setString(7,Genre);
|
||||||
|
ps.setString(8,Director);
|
||||||
|
ps.setString(9,Writer);
|
||||||
|
ps.setString(10,Actors);
|
||||||
|
ps.setString(11,Plot);
|
||||||
|
ps.setString(12,Language);
|
||||||
|
ps.setString(13,Country);
|
||||||
|
ps.setString(14,Awards);
|
||||||
|
ps.setString(15,Metascore);
|
||||||
|
ps.setString(16,imdbRating);
|
||||||
|
ps.setString(17,imdbVotes);
|
||||||
|
ps.setString(18,imdbID);
|
||||||
|
ps.setString(19,Type);
|
||||||
|
ps.setString(20,Poster);
|
||||||
|
ps.setString(21,Response);
|
||||||
|
ps.addBatch();
|
||||||
|
ps.executeBatch();
|
||||||
|
connection.commit();
|
||||||
|
ps.close();
|
||||||
|
System.out.println("done!");
|
||||||
|
}
|
||||||
|
|
||||||
|
void readCache(String streamUrl){
|
||||||
|
try{
|
||||||
|
Statement stmt = connection.createStatement();
|
||||||
|
ResultSet rs = stmt.executeQuery("SELECT * FROM cache WHERE streamUrl=\""+streamUrl+"\";");
|
||||||
|
ArrayList<Text> nameText = new ArrayList<Text>();
|
||||||
|
ArrayList<Text> responseText = new ArrayList<Text>();
|
||||||
|
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<nameText.size(); i++){
|
||||||
|
nameText.get(i).setFont(Font.font (fontFamily, FontWeight.BOLD, fontSize));
|
||||||
|
responseText.get(i).setFont(Font.font(fontFamily, fontSize));
|
||||||
|
}
|
||||||
|
|
||||||
|
mainWindowController.textFlow.getChildren().remove(0, mainWindowController.textFlow.getChildren().size());
|
||||||
|
|
||||||
|
for(int i=0;i<nameText.size(); i++){
|
||||||
|
mainWindowController.textFlow.getChildren().addAll(nameText.get(i),responseText.get(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
try{
|
||||||
|
mainWindowController.image1.setImage(im);
|
||||||
|
}catch (Exception e){
|
||||||
|
mainWindowController.image1.setImage(new Image("resources/icons/close_black_2048x2048.png"));
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
mainWindowController.image1.setImage(im);
|
||||||
|
|
||||||
|
}catch (SQLException e) {
|
||||||
|
System.out.println("Ups! an error occured!");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//removes the ending
|
//removes the ending
|
||||||
private String cutOffEnd (String str) {
|
private String cutOffEnd (String str) {
|
||||||
|
|
||||||
@ -471,4 +632,3 @@ public class DBController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
* MA 02110-1301, USA.
|
* MA 02110-1301, USA.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package application;
|
package application;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -26,7 +27,6 @@ import java.io.IOException;
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
import javafx.application.Application;
|
import javafx.application.Application;
|
||||||
import javafx.fxml.FXMLLoader;
|
import javafx.fxml.FXMLLoader;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
@ -40,24 +40,26 @@ import javafx.stage.Stage;
|
|||||||
|
|
||||||
public class Main extends Application {
|
public class Main extends Application {
|
||||||
|
|
||||||
private Stage primaryStage;
|
Stage primaryStage;
|
||||||
private String path;
|
private String path;
|
||||||
private String streamingPathWin = System.getProperty("user.home") + "\\Documents\\HomeFlix";
|
String currentWorkingDirectory;
|
||||||
private String streamingPathLinux = System.getProperty("user.home") + "/HomeFlix";
|
private String COLOR = "ee3523";
|
||||||
private String color = "ee3523";
|
private String FONT_FAMILY = "System";
|
||||||
private String autoUpdate = "0";
|
private String mode = "local"; //local or streaming TODO
|
||||||
private String mode = "local"; //local or streaming
|
|
||||||
private String local = System.getProperty("user.language")+"_"+System.getProperty("user.country");
|
private String local = System.getProperty("user.language")+"_"+System.getProperty("user.country");
|
||||||
private double size = 12;
|
private boolean AUTO_UPDATE = false;
|
||||||
|
private double FONT_SIZE = 17;
|
||||||
private ResourceBundle bundle;
|
private ResourceBundle bundle;
|
||||||
private MainWindowController mainWindowController;
|
private MainWindowController mainWindowController;
|
||||||
private File dirWin = new File(System.getProperty("user.home") + "/Documents/HomeFlix"); //Windows: C:/Users/"User"/Documents/HomeFlix
|
private File directory;
|
||||||
private File dirLinux = new File(System.getProperty("user.home") + "/HomeFlix"); //Linux: /home/"User"/HomeFlix
|
private File settingsFile;
|
||||||
private File fileWin = new File(dirWin + "/config.xml"); //Windows: C:/Users/"User"/Documents/HomeFlix/config.xml
|
private File posterCache;
|
||||||
private File fileLinux = new File(dirLinux + "/config.xml"); //Linux: /home/"User"/HomeFlix/config.xml
|
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
|
@Override
|
||||||
public void start(Stage primaryStage) {
|
public void start(Stage primaryStage) throws IOException {
|
||||||
|
currentWorkingDirectory = new java.io.File( "." ).getCanonicalPath();
|
||||||
this.primaryStage = primaryStage;
|
this.primaryStage = primaryStage;
|
||||||
mainWindow();
|
mainWindow();
|
||||||
}
|
}
|
||||||
@ -71,44 +73,45 @@ public class Main extends Application {
|
|||||||
primaryStage.setMinWidth(900.00);
|
primaryStage.setMinWidth(900.00);
|
||||||
primaryStage.setResizable(false);
|
primaryStage.setResizable(false);
|
||||||
primaryStage.setTitle("Project HomeFlix");
|
primaryStage.setTitle("Project HomeFlix");
|
||||||
primaryStage.getIcons().add(new Image(Main.class.getResourceAsStream("/recources/Homeflix_Icon_64x64.png"))); //adds application icon
|
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 = loader.getController(); //Link of FXMLController and controller class
|
||||||
mainWindowController.setAutoUpdate(autoUpdate); //set auto-update
|
mainWindowController.setAutoUpdate(AUTO_UPDATE); //set auto-update
|
||||||
|
mainWindowController.setCurrentWorkingDirectory(currentWorkingDirectory);
|
||||||
mainWindowController.setMain(this); //call setMain
|
mainWindowController.setMain(this); //call setMain
|
||||||
|
|
||||||
//Linux if directory exists -> check config.xml
|
/**Linux else Windows, check if directory & config exist
|
||||||
if(System.getProperty("os.name").equals("Linux")){
|
* Windows: config file: C:/Users/"User"/Documents/HomeFlix/config.xml
|
||||||
if(dirLinux.exists() != true){
|
* directory: C:/Users/"User"/Documents/HomeFlix
|
||||||
dirLinux.mkdir();
|
* Linux: config file: /home/"User"/HomeFlix/config.xml
|
||||||
}else if(fileLinux.exists() != true){
|
* 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.setPath(firstStart());
|
||||||
mainWindowController.setStreamingPath(streamingPathLinux);
|
mainWindowController.setStreamingPath(directory.getAbsolutePath());
|
||||||
mainWindowController.setColor(color);
|
mainWindowController.setColor(COLOR);
|
||||||
mainWindowController.setSize(size);
|
mainWindowController.setSize(FONT_SIZE);
|
||||||
mainWindowController.setAutoUpdate(autoUpdate);
|
mainWindowController.setAutoUpdate(AUTO_UPDATE);
|
||||||
mainWindowController.setLocal(local);
|
mainWindowController.setLocal(local);
|
||||||
mainWindowController.setMode(mode);
|
mainWindowController.setMode(mode);
|
||||||
mainWindowController.saveSettings();
|
mainWindowController.saveSettings();
|
||||||
Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //start again (preventing Bugs)
|
Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //start again (preventing Bugs)
|
||||||
System.exit(0); //finishes itself
|
System.exit(0); //finishes it self
|
||||||
}
|
|
||||||
//windows
|
|
||||||
}else{
|
|
||||||
if(dirWin.exists() != true){
|
|
||||||
dirWin.mkdir();
|
|
||||||
}else if(fileWin.exists() != true){
|
|
||||||
mainWindowController.setPath(firstStart());
|
|
||||||
mainWindowController.setStreamingPath(streamingPathWin);
|
|
||||||
mainWindowController.setColor(color);
|
|
||||||
mainWindowController.setSize(size);
|
|
||||||
mainWindowController.setAutoUpdate(autoUpdate);
|
|
||||||
mainWindowController.setLocal(local);
|
|
||||||
mainWindowController.setMode(mode);
|
|
||||||
mainWindowController.saveSettings();
|
|
||||||
Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //start again (preventing Bugs)
|
|
||||||
System.exit(0); //finishes itself
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!posterCache.exists()) {
|
||||||
|
posterCache.mkdir();
|
||||||
}
|
}
|
||||||
|
|
||||||
mainWindowController.loadSettings();
|
mainWindowController.loadSettings();
|
||||||
@ -125,7 +128,7 @@ public class Main extends Application {
|
|||||||
mainWindowController.addDataUI();
|
mainWindowController.addDataUI();
|
||||||
|
|
||||||
Scene scene = new Scene(pane); //create new scene, append pane to scene
|
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.setScene(scene); //append scene to stage
|
||||||
primaryStage.show(); //show stage
|
primaryStage.show(); //show stage
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@ -137,11 +140,11 @@ public class Main extends Application {
|
|||||||
private String firstStart(){
|
private String firstStart(){
|
||||||
MainWindowController.firststart = true;
|
MainWindowController.firststart = true;
|
||||||
switch(System.getProperty("user.language")+"_"+System.getProperty("user.country")){
|
switch(System.getProperty("user.language")+"_"+System.getProperty("user.country")){
|
||||||
case "en_US": bundle = ResourceBundle.getBundle("recources.HomeFlix-Local", Locale.US); //us_english
|
case "en_US": bundle = ResourceBundle.getBundle("resources.HomeFlix-Local", Locale.US); //us_english
|
||||||
break;
|
break;
|
||||||
case "de_DE": bundle = ResourceBundle.getBundle("recources.HomeFlix-Local", Locale.GERMAN); //German
|
case "de_DE": bundle = ResourceBundle.getBundle("resources.HomeFlix-Local", Locale.GERMAN); //German
|
||||||
break;
|
break;
|
||||||
default: bundle = ResourceBundle.getBundle("recources.HomeFlix-Local", Locale.US); //default local
|
default: bundle = ResourceBundle.getBundle("resources.HomeFlix-Local", Locale.US); //default local
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,4 +169,20 @@ public class Main extends Application {
|
|||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
launch(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;
|
||||||
|
}
|
||||||
}
|
}
|
4
src/application/MainWindow.css
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
.jfx-hamburgerW StackPane { -fx-background-color: white;
|
||||||
|
-fx-background-radius: 5px; }
|
||||||
|
.jfx-hamburgerB StackPane { -fx-background-color: black;
|
||||||
|
-fx-background-radius: 5px; }
|
@ -2,12 +2,14 @@
|
|||||||
|
|
||||||
<?import com.jfoenix.controls.JFXButton?>
|
<?import com.jfoenix.controls.JFXButton?>
|
||||||
<?import com.jfoenix.controls.JFXColorPicker?>
|
<?import com.jfoenix.controls.JFXColorPicker?>
|
||||||
|
<?import com.jfoenix.controls.JFXHamburger?>
|
||||||
<?import com.jfoenix.controls.JFXSlider?>
|
<?import com.jfoenix.controls.JFXSlider?>
|
||||||
<?import com.jfoenix.controls.JFXTextArea?>
|
|
||||||
<?import com.jfoenix.controls.JFXTextField?>
|
<?import com.jfoenix.controls.JFXTextField?>
|
||||||
<?import com.jfoenix.controls.JFXToggleButton?>
|
<?import com.jfoenix.controls.JFXToggleButton?>
|
||||||
|
<?import javafx.geometry.Insets?>
|
||||||
<?import javafx.scene.control.ChoiceBox?>
|
<?import javafx.scene.control.ChoiceBox?>
|
||||||
<?import javafx.scene.control.Label?>
|
<?import javafx.scene.control.Label?>
|
||||||
|
<?import javafx.scene.control.ScrollPane?>
|
||||||
<?import javafx.scene.control.TableView?>
|
<?import javafx.scene.control.TableView?>
|
||||||
<?import javafx.scene.control.TreeTableView?>
|
<?import javafx.scene.control.TreeTableView?>
|
||||||
<?import javafx.scene.image.Image?>
|
<?import javafx.scene.image.Image?>
|
||||||
@ -20,9 +22,12 @@
|
|||||||
|
|
||||||
<AnchorPane fx:id="anpane" prefHeight="600.0" prefWidth="950.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="application.MainWindowController">
|
<AnchorPane fx:id="anpane" prefHeight="600.0" prefWidth="950.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="application.MainWindowController">
|
||||||
<children>
|
<children>
|
||||||
<TreeTableView fx:id="treeTableViewfilm" layoutX="14.0" layoutY="88.0" prefHeight="400.0" prefWidth="360.0" AnchorPane.bottomAnchor="12.0" AnchorPane.leftAnchor="12.0" AnchorPane.rightAnchor="553.0" AnchorPane.topAnchor="88.0" />
|
<ScrollPane fx:id="scrollPane" fitToWidth="true" layoutX="408.0" layoutY="44.0" prefHeight="544.0" prefWidth="320.0" AnchorPane.bottomAnchor="12.0" AnchorPane.leftAnchor="408.0" AnchorPane.rightAnchor="222.0" AnchorPane.topAnchor="44.0">
|
||||||
<JFXTextArea fx:id="ta1" layoutX="385.0" layoutY="42.0" maxWidth="503.0" minWidth="275.0" prefHeight="546.0" prefWidth="293.0" AnchorPane.bottomAnchor="12.0" AnchorPane.leftAnchor="410.0" AnchorPane.rightAnchor="222.0" AnchorPane.topAnchor="44.0" />
|
<content>
|
||||||
<TextFlow fx:id="textFlow" layoutX="496.0" layoutY="131.0" prefHeight="200.0" prefWidth="200.0" visible="false" AnchorPane.bottomAnchor="15.0" AnchorPane.leftAnchor="410.0" AnchorPane.rightAnchor="220.0" AnchorPane.topAnchor="44.0" />
|
<TextFlow fx:id="textFlow" accessibleRole="TEXT_AREA" maxHeight="544.0" maxWidth="320.0" visible="true" />
|
||||||
|
</content>
|
||||||
|
</ScrollPane>
|
||||||
|
<TreeTableView fx:id="treeTableViewfilm" layoutX="14.0" layoutY="88.0" prefHeight="500.0" prefWidth="375.0" AnchorPane.bottomAnchor="12.0" AnchorPane.leftAnchor="12.0" AnchorPane.rightAnchor="568.0" AnchorPane.topAnchor="88.0" />
|
||||||
<JFXButton fx:id="playbtn" contentDisplay="CENTER" layoutX="690.0" layoutY="363.0" onAction="#playbtnclicked" prefHeight="25.0" prefWidth="198.0" AnchorPane.bottomAnchor="212.0" AnchorPane.rightAnchor="12.0">
|
<JFXButton fx:id="playbtn" contentDisplay="CENTER" layoutX="690.0" layoutY="363.0" onAction="#playbtnclicked" prefHeight="25.0" prefWidth="198.0" AnchorPane.bottomAnchor="212.0" AnchorPane.rightAnchor="12.0">
|
||||||
<font>
|
<font>
|
||||||
<Font name="System Bold" size="14.0" />
|
<Font name="System Bold" size="14.0" />
|
||||||
@ -31,22 +36,26 @@
|
|||||||
<font>
|
<font>
|
||||||
<Font name="System Bold" size="14.0" />
|
<Font name="System Bold" size="14.0" />
|
||||||
</font></JFXButton>
|
</font></JFXButton>
|
||||||
<JFXTextField fx:id="tfsearch" layoutX="12.0" layoutY="44.0" maxWidth="477.0" minWidth="359.0" prefHeight="31.0" prefWidth="359.0" promptText="Suche ..." AnchorPane.leftAnchor="12.0" AnchorPane.rightAnchor="553.0" AnchorPane.topAnchor="44.0">
|
<JFXTextField fx:id="tfsearch" layoutX="12.0" layoutY="44.0" maxWidth="477.0" minWidth="359.0" prefHeight="31.0" prefWidth="370.0" promptText="Suche ..." AnchorPane.leftAnchor="12.0" AnchorPane.rightAnchor="568.0" AnchorPane.topAnchor="44.0">
|
||||||
<font>
|
<font>
|
||||||
<Font name="Arial" size="12.0" />
|
<Font name="Arial" size="12.0" />
|
||||||
</font></JFXTextField>
|
</font></JFXTextField>
|
||||||
<ImageView fx:id="image1" fitHeight="297.0" fitWidth="198.0" layoutX="481.0" layoutY="46.0" pickOnBounds="true" preserveRatio="true" AnchorPane.rightAnchor="12.0" AnchorPane.topAnchor="44.0">
|
<ImageView fx:id="image1" fitHeight="297.0" fitWidth="198.0" layoutX="481.0" layoutY="46.0" pickOnBounds="true" preserveRatio="true" AnchorPane.rightAnchor="12.0" AnchorPane.topAnchor="44.0">
|
||||||
<image>
|
<image>
|
||||||
<Image url="@../recources/Homeflix_Poster.png" />
|
<Image url="@../resources/Homeflix_Poster.png" />
|
||||||
</image></ImageView>
|
</image></ImageView>
|
||||||
<JFXButton fx:id="returnBtn" contentDisplay="CENTER" layoutX="690.0" layoutY="443.0" onAction="#returnBtnclicked" prefHeight="25.0" prefWidth="90.0" AnchorPane.bottomAnchor="132.0" AnchorPane.rightAnchor="120.0" />
|
<JFXButton fx:id="returnBtn" contentDisplay="CENTER" layoutX="690.0" layoutY="443.0" onAction="#returnBtnclicked" prefHeight="25.0" prefWidth="90.0" AnchorPane.bottomAnchor="132.0" AnchorPane.rightAnchor="120.0" />
|
||||||
<JFXButton fx:id="forwardBtn" contentDisplay="CENTER" layoutX="798.0" layoutY="443.0" onAction="#forwardBtnclicked" prefHeight="25.0" prefWidth="90.0" AnchorPane.bottomAnchor="132.0" AnchorPane.rightAnchor="12.0" />
|
<JFXButton fx:id="forwardBtn" contentDisplay="CENTER" layoutX="798.0" layoutY="443.0" onAction="#forwardBtnclicked" prefHeight="25.0" prefWidth="90.0" AnchorPane.bottomAnchor="132.0" AnchorPane.rightAnchor="12.0" />
|
||||||
<HBox fx:id="topHBox" layoutY="12.0" prefHeight="32.0" prefWidth="900.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
<HBox fx:id="topHBox" layoutY="12.0" prefHeight="32.0" prefWidth="900.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||||
<children>
|
<children>
|
||||||
<JFXButton fx:id="menubtn" onAction="#menubtnclicked" prefHeight="32.0" prefWidth="32.0" />
|
<JFXHamburger fx:id="menuHam">
|
||||||
|
<padding>
|
||||||
|
<Insets left="3.0" />
|
||||||
|
</padding>
|
||||||
|
</JFXHamburger>
|
||||||
</children>
|
</children>
|
||||||
</HBox>
|
</HBox>
|
||||||
<VBox fx:id="sideMenuVBox" layoutY="32.0" prefHeight="660.0" prefWidth="150.0" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="38.0">
|
<VBox fx:id="sideMenuVBox" layoutY="32.0" prefHeight="660.0" prefWidth="150.0" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="32.0">
|
||||||
<children>
|
<children>
|
||||||
<JFXButton fx:id="infoBtn" onAction="#infoBtnclicked" prefHeight="32.0" prefWidth="150.0" textAlignment="CENTER">
|
<JFXButton fx:id="infoBtn" onAction="#infoBtnclicked" prefHeight="32.0" prefWidth="150.0" textAlignment="CENTER">
|
||||||
<font>
|
<font>
|
||||||
@ -78,21 +87,28 @@
|
|||||||
<AnchorPane fx:id="streamingSettingsAnchor" layoutX="138.0" layoutY="33.0" prefHeight="566.0" prefWidth="760.0" style="-fx-background-color: #FFFFFF;" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="150.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="38.0">
|
<AnchorPane fx:id="streamingSettingsAnchor" layoutX="138.0" layoutY="33.0" prefHeight="566.0" prefWidth="760.0" style="-fx-background-color: #FFFFFF;" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="150.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="38.0">
|
||||||
<children>
|
<children>
|
||||||
<JFXTextField fx:id="tfStreamingPath" layoutX="14.0" layoutY="14.0" onAction="#tfStreamingPathAction" prefWidth="250.0" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="5.0" />
|
<JFXTextField fx:id="tfStreamingPath" layoutX="14.0" layoutY="14.0" onAction="#tfStreamingPathAction" prefWidth="250.0" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="5.0" />
|
||||||
<JFXButton fx:id="streamingDirectoryBtn" layoutX="263.0" layoutY="2.0" onAction="#streamingDirectoryBtnAction" AnchorPane.leftAnchor="260.0" AnchorPane.topAnchor="5.0" />
|
<JFXButton fx:id="streamingDirectoryBtn" layoutX="263.0" layoutY="2.0" onAction="#streamingDirectoryBtnAction" prefHeight="25.0" prefWidth="115.0" AnchorPane.leftAnchor="260.0" AnchorPane.topAnchor="5.0" />
|
||||||
<TableView fx:id="tableViewStreamingdata" layoutX="14.0" layoutY="44.0" prefHeight="200.0" prefWidth="300.0" AnchorPane.bottomAnchor="5.0" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="40.0" />
|
<TableView fx:id="tableViewStreamingdata" layoutX="14.0" layoutY="44.0" prefHeight="517.0" prefWidth="370.0" AnchorPane.bottomAnchor="5.0" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="40.0" />
|
||||||
</children></AnchorPane>
|
</children></AnchorPane>
|
||||||
<AnchorPane fx:id="settingsAnchor" layoutX="160.0" layoutY="44.0" prefHeight="566.0" prefWidth="760.0" style="-fx-background-color: #FFFFFF;" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="150.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="38.0">
|
<AnchorPane fx:id="settingsAnchor" layoutX="160.0" layoutY="44.0" prefHeight="566.0" prefWidth="760.0" style="-fx-background-color: #FFFFFF;" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="150.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="38.0">
|
||||||
<children>
|
<children>
|
||||||
<JFXTextField fx:id="tfPath" layoutX="14.0" layoutY="14.0" onAction="#tfPathAction" prefWidth="250.0" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="5.0" />
|
<JFXTextField fx:id="tfPath" layoutX="14.0" layoutY="81.0" onAction="#tfPathAction" prefWidth="250.0" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="79.0" />
|
||||||
<JFXButton fx:id="directoryBtn" layoutX="255.0" layoutY="8.0" onAction="#directoryBtnAction" prefHeight="25.0" AnchorPane.leftAnchor="260.0" />
|
<JFXButton fx:id="directoryBtn" layoutX="276.0" layoutY="82.0" onAction="#directoryBtnAction" prefHeight="25.0" AnchorPane.leftAnchor="269.0" AnchorPane.topAnchor="82.0" />
|
||||||
<JFXColorPicker fx:id="mainColor" layoutX="14.0" layoutY="45.0" onAction="#mainColorAction" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="40.0" />
|
<JFXColorPicker fx:id="mainColor" layoutX="118.0" layoutY="130.0" onAction="#mainColorAction" AnchorPane.leftAnchor="118.0" AnchorPane.topAnchor="130.0" />
|
||||||
<Label fx:id="sizelbl" layoutY="73.0" text="Label" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="75.0" />
|
<Label fx:id="fontsizeLabel" layoutX="14.0" layoutY="179.0" text="Fontsize" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="175.0" />
|
||||||
<JFXSlider fx:id="sliderFontSize" layoutX="10.0" layoutY="99.0" max="48.0" min="2.0" prefWidth="250.0" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="110.0" />
|
<JFXSlider fx:id="sliderFontSize" layoutX="118.0" layoutY="177.0" max="48.0" min="2.0" prefWidth="250.0" AnchorPane.leftAnchor="118.0" AnchorPane.topAnchor="177.0" />
|
||||||
<ChoiceBox fx:id="cbLocal" layoutX="14.0" layoutY="131.0" prefWidth="150.0" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="145.0" />
|
<ChoiceBox fx:id="cbLocal" layoutX="118.0" layoutY="208.0" prefWidth="150.0" AnchorPane.leftAnchor="118.0" AnchorPane.topAnchor="208.0" />
|
||||||
<JFXButton fx:id="updateBtn" layoutX="7.0" layoutY="177.0" onAction="#updateBtnAction" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="180.0" />
|
<JFXButton fx:id="updateBtn" layoutX="16.0" layoutY="269.0" onAction="#updateBtnAction" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="253.0" />
|
||||||
<Label fx:id="aulbl" layoutX="43.0" layoutY="219.0" text="Label" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="215.0" />
|
<Label fx:id="autoUpdateLabel" layoutX="14.0" layoutY="310.0" prefHeight="17.0" text="check at startup for updates:" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="298.0" />
|
||||||
<JFXToggleButton fx:id="autoupdateBtn" layoutX="19.0" layoutY="215.0" onAction="#autoupdateBtnAction" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="230.0" />
|
<JFXToggleButton fx:id="autoupdateBtn" layoutX="14.0" layoutY="336.0" onAction="#autoupdateBtnAction" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="320.0" />
|
||||||
<Label fx:id="versionlbl" layoutX="29.0" layoutY="297.0" text="Label" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="280.0" />
|
<Label fx:id="versionLabel" layoutX="14.0" layoutY="418.0" text="Label" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="396.0" />
|
||||||
|
<Label fx:id="settingsHead1Label" layoutX="14.0" layoutY="24.0" text="HomeFlix Settings" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="24.0">
|
||||||
|
<font>
|
||||||
|
<Font name="System Bold" size="14.0" />
|
||||||
|
</font>
|
||||||
|
</Label>
|
||||||
|
<Label fx:id="mainColorLabel" layoutX="14.0" layoutY="134.0" prefHeight="25.0" text="Main-Color" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="130.0" />
|
||||||
|
<Label fx:id="localLabel" layoutX="14.0" layoutY="207.0" text="Local" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="212.0" />
|
||||||
</children>
|
</children>
|
||||||
</AnchorPane>
|
</AnchorPane>
|
||||||
</children>
|
</children>
|
||||||
|
@ -32,7 +32,6 @@ import java.io.InputStreamReader;
|
|||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
import java.lang.Thread.State;
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
@ -41,14 +40,13 @@ import java.util.ArrayList;
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
import org.apache.commons.lang3.SystemUtils;
|
|
||||||
|
|
||||||
import com.jfoenix.controls.JFXButton;
|
import com.jfoenix.controls.JFXButton;
|
||||||
import com.jfoenix.controls.JFXColorPicker;
|
import com.jfoenix.controls.JFXColorPicker;
|
||||||
|
import com.jfoenix.controls.JFXHamburger;
|
||||||
import com.jfoenix.controls.JFXSlider;
|
import com.jfoenix.controls.JFXSlider;
|
||||||
import com.jfoenix.controls.JFXTextArea;
|
|
||||||
import com.jfoenix.controls.JFXTextField;
|
import com.jfoenix.controls.JFXTextField;
|
||||||
import com.jfoenix.controls.JFXToggleButton;
|
import com.jfoenix.controls.JFXToggleButton;
|
||||||
|
import com.jfoenix.transitions.hamburger.HamburgerBackArrowBasicTransition;
|
||||||
|
|
||||||
import javafx.animation.FadeTransition;
|
import javafx.animation.FadeTransition;
|
||||||
import javafx.animation.ParallelTransition;
|
import javafx.animation.ParallelTransition;
|
||||||
@ -76,6 +74,7 @@ import javafx.scene.control.TreeTableColumn.SortType;
|
|||||||
import javafx.scene.control.TreeTableView;
|
import javafx.scene.control.TreeTableView;
|
||||||
import javafx.scene.image.Image;
|
import javafx.scene.image.Image;
|
||||||
import javafx.scene.image.ImageView;
|
import javafx.scene.image.ImageView;
|
||||||
|
import javafx.scene.input.MouseEvent;
|
||||||
import javafx.scene.layout.AnchorPane;
|
import javafx.scene.layout.AnchorPane;
|
||||||
import javafx.scene.layout.GridPane;
|
import javafx.scene.layout.GridPane;
|
||||||
import javafx.scene.layout.HBox;
|
import javafx.scene.layout.HBox;
|
||||||
@ -99,18 +98,14 @@ public class MainWindowController {
|
|||||||
@FXML
|
@FXML
|
||||||
private VBox sideMenuVBox;
|
private VBox sideMenuVBox;
|
||||||
@FXML
|
@FXML
|
||||||
private TreeTableView<streamUiData> treeTableViewfilm;
|
private TreeTableView<tableData> treeTableViewfilm;
|
||||||
@FXML
|
@FXML
|
||||||
private TableView<streamUiData> tableViewStreamingdata;
|
private TableView<tableData> tableViewStreamingdata;
|
||||||
@FXML
|
|
||||||
JFXTextArea ta1;
|
|
||||||
@FXML
|
@FXML
|
||||||
TextFlow textFlow;
|
TextFlow textFlow;
|
||||||
@FXML
|
@FXML
|
||||||
ScrollPane scrollPane;
|
ScrollPane scrollPane;
|
||||||
@FXML
|
@FXML
|
||||||
private JFXButton menubtn;
|
|
||||||
@FXML
|
|
||||||
private JFXButton playbtn;
|
private JFXButton playbtn;
|
||||||
@FXML
|
@FXML
|
||||||
private JFXButton openfolderbtn;
|
private JFXButton openfolderbtn;
|
||||||
@ -135,6 +130,8 @@ public class MainWindowController {
|
|||||||
@FXML
|
@FXML
|
||||||
private JFXButton streamingDirectoryBtn;
|
private JFXButton streamingDirectoryBtn;
|
||||||
@FXML
|
@FXML
|
||||||
|
private JFXHamburger menuHam;
|
||||||
|
@FXML
|
||||||
private JFXToggleButton autoupdateBtn;
|
private JFXToggleButton autoupdateBtn;
|
||||||
@FXML
|
@FXML
|
||||||
public JFXTextField tfPath;
|
public JFXTextField tfPath;
|
||||||
@ -149,50 +146,55 @@ public class MainWindowController {
|
|||||||
@FXML
|
@FXML
|
||||||
public JFXSlider sliderFontSize;
|
public JFXSlider sliderFontSize;
|
||||||
@FXML
|
@FXML
|
||||||
private Label versionlbl;
|
private Label versionLabel;
|
||||||
@FXML
|
@FXML
|
||||||
private Label sizelbl;
|
private Label fontsizeLabel;
|
||||||
@FXML
|
@FXML
|
||||||
private Label aulbl;
|
private Label autoUpdateLabel;
|
||||||
|
@FXML
|
||||||
|
private Label settingsHead1Label;
|
||||||
|
@FXML
|
||||||
|
private Label mainColorLabel;
|
||||||
|
@FXML
|
||||||
|
private Label localLabel;
|
||||||
@FXML
|
@FXML
|
||||||
ImageView image1;
|
ImageView image1;
|
||||||
|
|
||||||
private ImageView imv1;
|
private ImageView imv1;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
TreeItem<streamUiData> root = new TreeItem<>(new streamUiData(1, 1, 1, 5.0,"1", "filme","1", imv1));
|
TreeItem<tableData> root = new TreeItem<>(new tableData(1, 1, 1, 5.0,"1", "filme","1", imv1, false));
|
||||||
@FXML
|
@FXML
|
||||||
TreeTableColumn<streamUiData, ImageView> columnRating = new TreeTableColumn<>("Rating");
|
TreeTableColumn<tableData, ImageView> columnRating = new TreeTableColumn<>("Rating");
|
||||||
@FXML
|
@FXML
|
||||||
TreeTableColumn<streamUiData, String> columnTitel = new TreeTableColumn<>("Titel");
|
TreeTableColumn<tableData, String> columnTitel = new TreeTableColumn<>("Titel");
|
||||||
@FXML
|
@FXML
|
||||||
TreeTableColumn<streamUiData, String> columnStreamUrl = new TreeTableColumn<>("File Name");
|
TreeTableColumn<tableData, String> columnStreamUrl = new TreeTableColumn<>("File Name");
|
||||||
@FXML
|
@FXML
|
||||||
TreeTableColumn<streamUiData, String> columnResolution = new TreeTableColumn<>("Resolution");
|
TreeTableColumn<tableData, String> columnResolution = new TreeTableColumn<>("Resolution");
|
||||||
@FXML
|
@FXML
|
||||||
TreeTableColumn<streamUiData, Integer> columnYear = new TreeTableColumn<>("Year");
|
TreeTableColumn<tableData, Integer> columnYear = new TreeTableColumn<>("Year");
|
||||||
@FXML
|
@FXML
|
||||||
TreeTableColumn<streamUiData, Integer> columnSeason = new TreeTableColumn<>("Season");
|
TreeTableColumn<tableData, Integer> columnSeason = new TreeTableColumn<>("Season");
|
||||||
@FXML
|
@FXML
|
||||||
TreeTableColumn<streamUiData, Integer> columnEpisode = new TreeTableColumn<>("Episode");
|
TreeTableColumn<tableData, Integer> columnEpisode = new TreeTableColumn<>("Episode");
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private TreeItem<streamUiData> streamingRoot =new TreeItem<>(new streamUiData(1 ,1 ,1 ,1.0 ,"1" ,"filme" ,"1", imv1));
|
private TreeItem<tableData> streamingRoot =new TreeItem<>(new tableData(1 ,1 ,1 ,1.0 ,"1" ,"filme" ,"1", imv1, false));
|
||||||
@FXML
|
@FXML
|
||||||
private TableColumn<streamUiData, String> dataNameColumn = new TableColumn<>("Datei Name");
|
private TableColumn<tableData, String> dataNameColumn = new TableColumn<>("Datei Name");
|
||||||
@FXML
|
@FXML
|
||||||
private TableColumn<streamUiData, String> dataNameEndColumn = new TableColumn<>("Datei Name mit Endung");
|
private TableColumn<tableData, String> dataNameEndColumn = new TableColumn<>("Datei Name mit Endung");
|
||||||
|
|
||||||
|
private boolean menuTrue = false; //saves the position of menuBtn (opened or closed)
|
||||||
private boolean menutrue = false; //saves the position of menubtn (opened or closed)
|
private boolean settingsTrue = false;
|
||||||
private boolean settingstrue = false;
|
|
||||||
private boolean streamingSettingsTrue = false;
|
private boolean streamingSettingsTrue = false;
|
||||||
|
private boolean autoUpdate = false;
|
||||||
static boolean firststart = false;
|
static boolean firststart = false;
|
||||||
private int hashA = -2055934614;
|
private int hashA = -2055934614;
|
||||||
private String version = "0.5.0";
|
private String version = "0.5.2";
|
||||||
private String buildNumber = "117";
|
private String buildNumber = "129";
|
||||||
private String versionName = "plasma cow";
|
private String versionName = "solidify cow";
|
||||||
private String buildURL = "https://raw.githubusercontent.com/Seil0/Project-HomeFlix/master/updates/buildNumber.txt";
|
|
||||||
private String downloadLink = "https://raw.githubusercontent.com/Seil0/Project-HomeFlix/master/updates/downloadLink.txt";
|
|
||||||
private File dirWin = new File(System.getProperty("user.home") + "/Documents/HomeFlix");
|
private File dirWin = new File(System.getProperty("user.home") + "/Documents/HomeFlix");
|
||||||
private File dirLinux = new File(System.getProperty("user.home") + "/HomeFlix");
|
private File dirLinux = new File(System.getProperty("user.home") + "/HomeFlix");
|
||||||
private File fileWin = new File(dirWin + "/config.xml");
|
private File fileWin = new File(dirWin + "/config.xml");
|
||||||
@ -200,22 +202,20 @@ public class MainWindowController {
|
|||||||
|
|
||||||
String errorUpdateD;
|
String errorUpdateD;
|
||||||
String errorUpdateV;
|
String errorUpdateV;
|
||||||
|
String noFilmFound;
|
||||||
private String errorPlay;
|
private String errorPlay;
|
||||||
private String errorOpenStream;
|
private String errorOpenStream;
|
||||||
private String errorMode;
|
private String errorMode;
|
||||||
private String errorLoad;
|
private String errorLoad;
|
||||||
private String errorSave;
|
private String errorSave;
|
||||||
String noFilmFound;
|
|
||||||
private String infoText;
|
private String infoText;
|
||||||
private String linuxBugText;
|
|
||||||
private String vlcNotInstalled;
|
private String vlcNotInstalled;
|
||||||
private String aktBuildNumber;
|
private String currentWorkingDirectory;
|
||||||
private String path;
|
private String path;
|
||||||
private String streamingPath;
|
private String streamingPath;
|
||||||
private String color;
|
private String color;
|
||||||
private String Name;
|
private String name;
|
||||||
private String datPath;
|
private String datPath;
|
||||||
private String autoUpdate;
|
|
||||||
private String mode;
|
private String mode;
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private String ratingSortType;
|
private String ratingSortType;
|
||||||
@ -236,7 +236,7 @@ public class MainWindowController {
|
|||||||
String metascore;
|
String metascore;
|
||||||
String imdbRating;
|
String imdbRating;
|
||||||
String type;
|
String type;
|
||||||
private double size;
|
double size;
|
||||||
private int last;
|
private int last;
|
||||||
private int selected;
|
private int selected;
|
||||||
private int next;
|
private int next;
|
||||||
@ -244,57 +244,33 @@ public class MainWindowController {
|
|||||||
private File selectedStreamingFolder;
|
private File selectedStreamingFolder;
|
||||||
ResourceBundle bundle;
|
ResourceBundle bundle;
|
||||||
|
|
||||||
private ObservableList<streamUiData> filterData = FXCollections.observableArrayList();
|
private ObservableList<tableData> filterData = FXCollections.observableArrayList();
|
||||||
private ObservableList<String> locals = FXCollections.observableArrayList("english (en_US)", "deutsch (de_DE)");
|
private ObservableList<String> locals = FXCollections.observableArrayList("English (en_US)", "Deutsch (de_DE)");
|
||||||
ObservableList<streamUiData> newData = FXCollections.observableArrayList(); //TODO rename to localFilms
|
ObservableList<tableData> localFilms = FXCollections.observableArrayList();
|
||||||
ObservableList<streamUiData> streamData = FXCollections.observableArrayList(); //TODO rename to streamingFilms
|
ObservableList<tableData> streamingFilms = FXCollections.observableArrayList();
|
||||||
ObservableList<streamUiData> streamingData = FXCollections.observableArrayList();
|
ObservableList<tableData> streamingData = FXCollections.observableArrayList();
|
||||||
private ImageView menu_icon_black = new ImageView(new Image("recources/icons/menu_icon_black.png"));
|
private ImageView skip_previous_white = new ImageView(new Image("resources/icons/ic_skip_previous_white_18dp_1x.png"));
|
||||||
private ImageView menu_icon_white = new ImageView(new Image("recources/icons/menu_icon_white.png"));
|
private ImageView skip_previous_black = new ImageView(new Image("resources/icons/ic_skip_previous_black_18dp_1x.png"));
|
||||||
private ImageView skip_previous_white = new ImageView(new Image("recources/icons/ic_skip_previous_white_18dp_1x.png"));
|
private ImageView skip_next_white = new ImageView(new Image("resources/icons/ic_skip_next_white_18dp_1x.png"));
|
||||||
private ImageView skip_previous_black = new ImageView(new Image("recources/icons/ic_skip_previous_black_18dp_1x.png"));
|
private ImageView skip_next_black = new ImageView(new Image("resources/icons/ic_skip_next_black_18dp_1x.png"));
|
||||||
private ImageView skip_next_white = new ImageView(new Image("recources/icons/ic_skip_next_white_18dp_1x.png"));
|
private ImageView play_arrow_white = new ImageView(new Image("resources/icons/ic_play_arrow_white_18dp_1x.png"));
|
||||||
private ImageView skip_next_black = new ImageView(new Image("recources/icons/ic_skip_next_black_18dp_1x.png"));
|
private ImageView play_arrow_black = new ImageView(new Image("resources/icons/ic_play_arrow_black_18dp_1x.png"));
|
||||||
private ImageView play_arrow_white = new ImageView(new Image("recources/icons/ic_play_arrow_white_18dp_1x.png"));
|
|
||||||
private ImageView play_arrow_black = new ImageView(new Image("recources/icons/ic_play_arrow_black_18dp_1x.png"));
|
|
||||||
private DirectoryChooser directoryChooser = new DirectoryChooser();
|
private DirectoryChooser directoryChooser = new DirectoryChooser();
|
||||||
private MenuItem like = new MenuItem("like");
|
private MenuItem like = new MenuItem("like");
|
||||||
private MenuItem dislike = new MenuItem("dislike"); //TODO one option (like or dislike)
|
private MenuItem dislike = new MenuItem("dislike"); //TODO one option (like or dislike)
|
||||||
private ContextMenu menu = new ContextMenu(like, dislike);
|
private ContextMenu menu = new ContextMenu(like, dislike);
|
||||||
Properties props = new Properties();
|
Properties props = new Properties();
|
||||||
|
|
||||||
|
private Main main;
|
||||||
private updater Updater;
|
private updater Updater;
|
||||||
private apiQuery ApiQuery;
|
private apiQuery ApiQuery;
|
||||||
DBController dbController;
|
DBController dbController;
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO change value of Text-color change
|
|
||||||
*/
|
|
||||||
@FXML
|
|
||||||
private void menubtnclicked(){
|
|
||||||
if(menutrue == false){
|
|
||||||
sideMenuSlideIn();
|
|
||||||
menutrue = true;
|
|
||||||
}else{
|
|
||||||
sideMenuSlideOut();
|
|
||||||
menutrue = false;
|
|
||||||
}
|
|
||||||
if(settingstrue == true){
|
|
||||||
settingsAnchor.setVisible(false);
|
|
||||||
setPath(tfPath.getText());
|
|
||||||
saveSettings();
|
|
||||||
settingstrue = false;
|
|
||||||
}
|
|
||||||
if(streamingSettingsTrue == true){
|
|
||||||
streamingSettingsAnchor.setVisible(false);
|
|
||||||
streamingSettingsTrue = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private void playbtnclicked(){
|
private void playbtnclicked(){
|
||||||
if(SystemUtils.IS_OS_LINUX){
|
System.out.println(System.getProperty("os.name"));
|
||||||
System.out.println("This is Linux");
|
if(System.getProperty("os.name").contains("Linux")){
|
||||||
|
System.out.println("This is "+System.getProperty("os.name"));
|
||||||
String line;
|
String line;
|
||||||
String output = "";
|
String output = "";
|
||||||
Process p;
|
Process p;
|
||||||
@ -315,21 +291,15 @@ public class MainWindowController {
|
|||||||
alert.setTitle("Info");
|
alert.setTitle("Info");
|
||||||
alert.setContentText(vlcNotInstalled);
|
alert.setContentText(vlcNotInstalled);
|
||||||
alert.showAndWait();
|
alert.showAndWait();
|
||||||
}else if(datPath.contains(" ")){
|
|
||||||
Alert alert = new Alert(AlertType.INFORMATION);
|
|
||||||
alert.setHeaderText("");
|
|
||||||
alert.setTitle("Info");
|
|
||||||
alert.setContentText(linuxBugText);
|
|
||||||
alert.showAndWait();
|
|
||||||
}else{
|
}else{
|
||||||
try {
|
try {
|
||||||
Runtime.getRuntime().exec("vlc "+getPath()+"/"+ datPath);
|
Runtime.getRuntime().exec(new String[] { "vlc", getPath()+"/"+ datPath});
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
showErrorMsg(errorPlay,e);
|
showErrorMsg(errorPlay,e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else if(SystemUtils.IS_OS_WINDOWS || SystemUtils.IS_OS_MAC_OSX){
|
}else if(System.getProperty("os.name").contains("Windows") || System.getProperty("os.name").contains("Mac OS X")){
|
||||||
System.out.println("This is Windows or Mac OSX");
|
System.out.println("This is "+System.getProperty("os.name"));
|
||||||
if(mode.equals("local")){
|
if(mode.equals("local")){
|
||||||
try {
|
try {
|
||||||
Desktop.getDesktop().open(new File(getPath()+"\\"+ datPath));
|
Desktop.getDesktop().open(new File(getPath()+"\\"+ datPath));
|
||||||
@ -338,7 +308,7 @@ public class MainWindowController {
|
|||||||
}
|
}
|
||||||
}else if(mode.equals("streaming")){
|
}else if(mode.equals("streaming")){
|
||||||
try {
|
try {
|
||||||
Desktop.getDesktop().browse(new URI(datPath)); //open the streaming Url in browser (TODO other option?)
|
Desktop.getDesktop().browse(new URI(datPath)); //open the streaming URL in browser
|
||||||
} catch (URISyntaxException | IOException e) {
|
} catch (URISyntaxException | IOException e) {
|
||||||
showErrorMsg(errorOpenStream, (IOException) e);
|
showErrorMsg(errorOpenStream, (IOException) e);
|
||||||
}
|
}
|
||||||
@ -375,23 +345,24 @@ public class MainWindowController {
|
|||||||
alert.setTitle("Info");
|
alert.setTitle("Info");
|
||||||
alert.setHeaderText("Project HomeFlix");
|
alert.setHeaderText("Project HomeFlix");
|
||||||
alert.setContentText(infoText);
|
alert.setContentText(infoText);
|
||||||
|
alert.initOwner(main.primaryStage);
|
||||||
alert.showAndWait();
|
alert.showAndWait();
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private void settingsBtnclicked(){
|
private void settingsBtnclicked(){
|
||||||
if(settingstrue == false){
|
if(settingsTrue == false){
|
||||||
if(streamingSettingsTrue == true){
|
if(streamingSettingsTrue == true){
|
||||||
streamingSettingsAnchor.setVisible(false);
|
streamingSettingsAnchor.setVisible(false);
|
||||||
streamingSettingsTrue = false;
|
streamingSettingsTrue = false;
|
||||||
}
|
}
|
||||||
settingsAnchor.setVisible(true);
|
settingsAnchor.setVisible(true);
|
||||||
settingstrue = true;
|
settingsTrue = true;
|
||||||
}else{
|
}else{
|
||||||
settingsAnchor.setVisible(false);
|
settingsAnchor.setVisible(false);
|
||||||
setPath(tfPath.getText());
|
setPath(tfPath.getText());
|
||||||
saveSettings();
|
saveSettings();
|
||||||
settingstrue = false;
|
settingsTrue = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -401,9 +372,9 @@ public class MainWindowController {
|
|||||||
@FXML
|
@FXML
|
||||||
private void streamingSettingsBtnclicked(){
|
private void streamingSettingsBtnclicked(){
|
||||||
if(streamingSettingsTrue == false){
|
if(streamingSettingsTrue == false){
|
||||||
if(settingstrue == true){
|
if(settingsTrue == true){
|
||||||
settingsAnchor.setVisible(false);
|
settingsAnchor.setVisible(false);
|
||||||
settingstrue = false;
|
settingsTrue = false;
|
||||||
}
|
}
|
||||||
streamingSettingsAnchor.setVisible(true);
|
streamingSettingsAnchor.setVisible(true);
|
||||||
streamingSettingsTrue = true;
|
streamingSettingsTrue = true;
|
||||||
@ -428,8 +399,8 @@ public class MainWindowController {
|
|||||||
settingsAnchor.setVisible(false);
|
settingsAnchor.setVisible(false);
|
||||||
streamingSettingsAnchor.setVisible(false);
|
streamingSettingsAnchor.setVisible(false);
|
||||||
sideMenuSlideOut(); //disables side-menu
|
sideMenuSlideOut(); //disables side-menu
|
||||||
menutrue = false;
|
menuTrue = false;
|
||||||
settingstrue = false;
|
settingsTrue = false;
|
||||||
streamingSettingsTrue = false;
|
streamingSettingsTrue = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -472,21 +443,17 @@ public class MainWindowController {
|
|||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private void updateBtnAction(){
|
private void updateBtnAction(){
|
||||||
// Updater.update(buildURL, downloadLink, aktBuildNumber, buildNumber);
|
Thread updateThread = new Thread(Updater);
|
||||||
System.out.println(Updater.getState());
|
updateThread.setName("Updater");
|
||||||
if(Updater.getState() == State.NEW){
|
updateThread.start();
|
||||||
Updater.start();
|
|
||||||
}else{
|
|
||||||
Updater.run();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private void autoupdateBtnAction(){
|
private void autoupdateBtnAction(){
|
||||||
if(autoUpdate.equals("0")){
|
if(autoUpdate){
|
||||||
setAutoUpdate("1");
|
setAutoUpdate(false);
|
||||||
}else{
|
}else{
|
||||||
setAutoUpdate("0");
|
setAutoUpdate(true);
|
||||||
}
|
}
|
||||||
saveSettings();
|
saveSettings();
|
||||||
}
|
}
|
||||||
@ -516,11 +483,14 @@ public class MainWindowController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//"Main" Method called in Main.java main() when starting
|
/**"Main" Method called in Main.java main() when starting
|
||||||
|
* Initialize other objects: Updater, dbController and ApiQuery
|
||||||
|
*/
|
||||||
void setMain(Main main) {
|
void setMain(Main main) {
|
||||||
Updater = new updater(this,buildURL, downloadLink, aktBuildNumber, buildNumber);
|
this.main = main;
|
||||||
ApiQuery = new apiQuery(this);
|
Updater = new updater(this, buildNumber);
|
||||||
dbController = new DBController(this);
|
dbController = new DBController(this, this.main);
|
||||||
|
ApiQuery = new apiQuery(this, dbController, this.main);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Initialize the tables (treeTableViewfilm and tableViewStreamingdata)
|
//Initialize the tables (treeTableViewfilm and tableViewStreamingdata)
|
||||||
@ -532,7 +502,7 @@ public class MainWindowController {
|
|||||||
columnTitel.setMaxWidth(260);
|
columnTitel.setMaxWidth(260);
|
||||||
columnStreamUrl.setMaxWidth(0);
|
columnStreamUrl.setMaxWidth(0);
|
||||||
dataNameColumn.setPrefWidth(150);
|
dataNameColumn.setPrefWidth(150);
|
||||||
dataNameEndColumn.setPrefWidth(170);
|
dataNameEndColumn.setPrefWidth(220);
|
||||||
columnRating.setStyle("-fx-alignment: CENTER;");
|
columnRating.setStyle("-fx-alignment: CENTER;");
|
||||||
|
|
||||||
treeTableViewfilm.setRoot(root);
|
treeTableViewfilm.setRoot(root);
|
||||||
@ -540,7 +510,7 @@ public class MainWindowController {
|
|||||||
treeTableViewfilm.setShowRoot(false);
|
treeTableViewfilm.setShowRoot(false);
|
||||||
|
|
||||||
//write content into cell
|
//write content into cell
|
||||||
columnTitel.setCellValueFactory(cellData -> cellData.getValue().getValue().titelProperty());
|
columnTitel.setCellValueFactory(cellData -> cellData.getValue().getValue().titleProperty());
|
||||||
columnRating.setCellValueFactory(cellData -> cellData.getValue().getValue().imageProperty());
|
columnRating.setCellValueFactory(cellData -> cellData.getValue().getValue().imageProperty());
|
||||||
columnStreamUrl.setCellValueFactory(cellData -> cellData.getValue().getValue().streamUrlProperty());
|
columnStreamUrl.setCellValueFactory(cellData -> cellData.getValue().getValue().streamUrlProperty());
|
||||||
columnResolution.setCellValueFactory(cellData -> cellData.getValue().getValue().resolutionProperty());
|
columnResolution.setCellValueFactory(cellData -> cellData.getValue().getValue().resolutionProperty());
|
||||||
@ -554,16 +524,30 @@ public class MainWindowController {
|
|||||||
//Change-listener for TreeTable
|
//Change-listener for TreeTable
|
||||||
treeTableViewfilm.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Object>() {
|
treeTableViewfilm.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Object>() {
|
||||||
@Override
|
@Override
|
||||||
public void changed(ObservableValue<?> observable, Object oldVal, Object newVal) {
|
public void changed(ObservableValue<?> observable, Object oldVal, Object newVal){
|
||||||
// last = selected; //for auto-play
|
// last = selected; //for auto-play
|
||||||
selected = treeTableViewfilm.getSelectionModel().getSelectedIndex(); //get selected item
|
selected = treeTableViewfilm.getSelectionModel().getSelectedIndex(); //get selected item
|
||||||
last = selected - 1;
|
last = selected - 1;
|
||||||
next = selected + 1;
|
next = selected + 1;
|
||||||
Name = columnTitel.getCellData(selected); //get name of selected item
|
name = columnTitel.getCellData(selected); //get name of selected item
|
||||||
datPath = columnStreamUrl.getCellData(selected); //get file path of selected item
|
datPath = columnStreamUrl.getCellData(selected); //get file path of selected item
|
||||||
ta1.setText(""); //delete text in ta1
|
|
||||||
ApiQuery.startQuery(Name); // start api query
|
if(mode.equals("local")){
|
||||||
ta1.positionCaret(0); //set cursor position in ta1
|
if(localFilms.get(selected).getCached()==true){
|
||||||
|
System.out.println("loading from cache: "+name);
|
||||||
|
dbController.readCache(datPath);
|
||||||
|
}else{
|
||||||
|
ApiQuery.startQuery(name,datPath); // start api query
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
System.out.println(streamingFilms.size());
|
||||||
|
if(streamingFilms.get(selected).getCached()==true){
|
||||||
|
System.out.println("loading from cache: "+name);
|
||||||
|
dbController.readCache(datPath);
|
||||||
|
}else{
|
||||||
|
ApiQuery.startQuery(name,datPath); // start api query
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -571,7 +555,7 @@ public class MainWindowController {
|
|||||||
treeTableViewfilm.setContextMenu(menu);
|
treeTableViewfilm.setContextMenu(menu);
|
||||||
|
|
||||||
//Streaming-Settings Table
|
//Streaming-Settings Table
|
||||||
dataNameColumn.setCellValueFactory(cellData -> cellData.getValue().titelProperty());
|
dataNameColumn.setCellValueFactory(cellData -> cellData.getValue().titleProperty());
|
||||||
dataNameEndColumn.setCellValueFactory(cellData -> cellData.getValue().streamUrlProperty());
|
dataNameEndColumn.setCellValueFactory(cellData -> cellData.getValue().streamUrlProperty());
|
||||||
|
|
||||||
tableViewStreamingdata.getColumns().addAll(dataNameColumn, dataNameEndColumn);
|
tableViewStreamingdata.getColumns().addAll(dataNameColumn, dataNameEndColumn);
|
||||||
@ -581,27 +565,53 @@ public class MainWindowController {
|
|||||||
//Initializing the actions
|
//Initializing the actions
|
||||||
void initActions(){
|
void initActions(){
|
||||||
|
|
||||||
|
HamburgerBackArrowBasicTransition burgerTask = new HamburgerBackArrowBasicTransition(menuHam);
|
||||||
|
menuHam.addEventHandler(MouseEvent.MOUSE_PRESSED, (e)->{
|
||||||
|
if(menuTrue == false){
|
||||||
|
sideMenuSlideIn();
|
||||||
|
burgerTask.setRate(1.0);
|
||||||
|
burgerTask.play();
|
||||||
|
menuTrue = true;
|
||||||
|
}else{
|
||||||
|
sideMenuSlideOut();
|
||||||
|
burgerTask.setRate(-1.0);
|
||||||
|
burgerTask.play();
|
||||||
|
menuTrue = false;
|
||||||
|
}
|
||||||
|
if(settingsTrue == true){
|
||||||
|
settingsAnchor.setVisible(false);
|
||||||
|
setPath(tfPath.getText());
|
||||||
|
saveSettings();
|
||||||
|
settingsTrue = false;
|
||||||
|
}
|
||||||
|
if(streamingSettingsTrue == true){
|
||||||
|
streamingSettingsAnchor.setVisible(false);
|
||||||
|
streamingSettingsTrue = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
tfsearch.textProperty().addListener(new ChangeListener<String>() {
|
tfsearch.textProperty().addListener(new ChangeListener<String>() {
|
||||||
@Override
|
@Override
|
||||||
public void changed(ObservableValue<? extends String> observable,String oldValue, String newValue) {
|
public void changed(ObservableValue<? extends String> observable,String oldValue, String newValue) {
|
||||||
ObservableList<streamUiData> helpData;
|
ObservableList<tableData> helpData;
|
||||||
filterData.removeAll(filterData);
|
filterData.removeAll(filterData);
|
||||||
root.getChildren().remove(0,root.getChildren().size());
|
root.getChildren().remove(0,root.getChildren().size());
|
||||||
|
|
||||||
if(mode.equals("local")){
|
if(mode.equals("local")){
|
||||||
helpData = newData;
|
helpData = localFilms;
|
||||||
}else{
|
}else{
|
||||||
helpData = streamData;
|
helpData = streamingFilms;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < helpData.size(); i++){
|
for(int i = 0; i < helpData.size(); i++){
|
||||||
if(helpData.get(i).getTitel().toLowerCase().contains(tfsearch.getText().toLowerCase())){
|
if(helpData.get(i).getTitle().toLowerCase().contains(tfsearch.getText().toLowerCase())){
|
||||||
filterData.add(helpData.get(i)); //add data from newDaten to filteredData where title contains search input
|
filterData.add(helpData.get(i)); //add data from newDaten to filteredData where title contains search input
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < filterData.size(); i++){
|
for(int i = 0; i < filterData.size(); i++){
|
||||||
root.getChildren().add(new TreeItem<streamUiData>(filterData.get(i))); //add filtered data to root node after search
|
root.getChildren().add(new TreeItem<tableData>(filterData.get(i))); //add filtered data to root node after search
|
||||||
}
|
}
|
||||||
if(tfsearch.getText().hashCode() == hashA){
|
if(tfsearch.getText().hashCode() == hashA){
|
||||||
setColor("000000");
|
setColor("000000");
|
||||||
@ -613,7 +623,7 @@ public class MainWindowController {
|
|||||||
cbLocal.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {
|
cbLocal.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {
|
||||||
public void changed(ObservableValue<? extends Number> ov, Number value, Number new_value) {
|
public void changed(ObservableValue<? extends Number> ov, Number value, Number new_value) {
|
||||||
String local = cbLocal.getItems().get((int) new_value).toString();
|
String local = cbLocal.getItems().get((int) new_value).toString();
|
||||||
local = local.substring(local.length()-6,local.length()-1);
|
local = local.substring(local.length()-6,local.length()-1); //reading only en_US from English (en_US)
|
||||||
setLocal(local);
|
setLocal(local);
|
||||||
setLocalUI();
|
setLocalUI();
|
||||||
saveSettings();
|
saveSettings();
|
||||||
@ -624,7 +634,12 @@ public class MainWindowController {
|
|||||||
@Override
|
@Override
|
||||||
public void changed(ObservableValue<? extends Number> ov,Number old_val, Number new_val) {
|
public void changed(ObservableValue<? extends Number> ov,Number old_val, Number new_val) {
|
||||||
setSize(sliderFontSize.getValue());
|
setSize(sliderFontSize.getValue());
|
||||||
ta1.setFont(Font.font("System", size));
|
|
||||||
|
if(name != null){
|
||||||
|
dbController.readCache(datPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ta1.setFont(Font.font("System", size));
|
||||||
saveSettings();
|
saveSettings();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -633,13 +648,13 @@ public class MainWindowController {
|
|||||||
@Override
|
@Override
|
||||||
public void handle(ActionEvent event) {
|
public void handle(ActionEvent event) {
|
||||||
if(mode.equals("streaming")){
|
if(mode.equals("streaming")){
|
||||||
dbController.like(Name,streamData.get(selected).getStreamUrl());
|
dbController.like(name,streamingFilms.get(selected).getStreamUrl());
|
||||||
}else{
|
}else{
|
||||||
dbController.like(Name,newData.get(selected).getStreamUrl());
|
dbController.like(name,localFilms.get(selected).getStreamUrl());
|
||||||
}
|
}
|
||||||
dbController.getFavStatus(Name);
|
dbController.getFavStatus(name);
|
||||||
try {
|
try {
|
||||||
dbController.refresh(Name, selected);
|
dbController.refresh(name, selected);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
Alert alert = new Alert(AlertType.ERROR);
|
Alert alert = new Alert(AlertType.ERROR);
|
||||||
alert.setTitle("Error");
|
alert.setTitle("Error");
|
||||||
@ -655,13 +670,13 @@ public class MainWindowController {
|
|||||||
@Override
|
@Override
|
||||||
public void handle(ActionEvent event) {
|
public void handle(ActionEvent event) {
|
||||||
if(mode.equals("streaming")){
|
if(mode.equals("streaming")){
|
||||||
dbController.dislike(Name,streamData.get(selected).getStreamUrl());
|
dbController.dislike(name,streamingFilms.get(selected).getStreamUrl());
|
||||||
}else{
|
}else{
|
||||||
dbController.dislike(Name,newData.get(selected).getStreamUrl());
|
dbController.dislike(name,localFilms.get(selected).getStreamUrl());
|
||||||
}
|
}
|
||||||
dbController.getFavStatus(Name);
|
dbController.getFavStatus(name);
|
||||||
try {
|
try {
|
||||||
dbController.refresh(Name, selected);
|
dbController.refresh(name, selected);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
Alert alert = new Alert(AlertType.ERROR);
|
Alert alert = new Alert(AlertType.ERROR);
|
||||||
alert.setTitle("Error");
|
alert.setTitle("Error");
|
||||||
@ -674,7 +689,7 @@ public class MainWindowController {
|
|||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO fix bug when sort by ASCENDING, wrong order
|
* FIXME fix bug when sort by ASCENDING, wrong order
|
||||||
*/
|
*/
|
||||||
columnRating.sortTypeProperty().addListener(new ChangeListener<SortType>() {
|
columnRating.sortTypeProperty().addListener(new ChangeListener<SortType>() {
|
||||||
@Override
|
@Override
|
||||||
@ -682,14 +697,15 @@ public class MainWindowController {
|
|||||||
System.out.println("NAME Clicked -- sortType = " + paramT1 + ", SortType=" + paramT2);
|
System.out.println("NAME Clicked -- sortType = " + paramT1 + ", SortType=" + paramT2);
|
||||||
ArrayList<Integer> fav_true = new ArrayList<Integer>();
|
ArrayList<Integer> fav_true = new ArrayList<Integer>();
|
||||||
ArrayList<Integer> fav_false = new ArrayList<Integer>();
|
ArrayList<Integer> fav_false = new ArrayList<Integer>();
|
||||||
ObservableList<streamUiData> helpData;
|
ObservableList<tableData> helpData;
|
||||||
filterData.removeAll(filterData);
|
filterData.removeAll(filterData);
|
||||||
|
// treeTableViewfilm.getSelectionModel().clearSelection(selected);
|
||||||
root.getChildren().remove(0,root.getChildren().size());
|
root.getChildren().remove(0,root.getChildren().size());
|
||||||
|
|
||||||
if(mode.equals("local")){
|
if(mode.equals("local")){
|
||||||
helpData = newData;
|
helpData = localFilms;
|
||||||
}else{
|
}else{
|
||||||
helpData = streamData;
|
helpData = streamingFilms;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -720,7 +736,7 @@ public class MainWindowController {
|
|||||||
System.out.println(filterData.size());
|
System.out.println(filterData.size());
|
||||||
for(int i = 0; i < filterData.size(); i++){
|
for(int i = 0; i < filterData.size(); i++){
|
||||||
// System.out.println(filterData.get(i).getTitel()+"; "+filterData.get(i).getRating());
|
// System.out.println(filterData.get(i).getTitel()+"; "+filterData.get(i).getRating());
|
||||||
root.getChildren().add(new TreeItem<streamUiData>(filterData.get(i))); //add filtered data to root node after search
|
root.getChildren().add(new TreeItem<tableData>(filterData.get(i))); //add filtered data to root node after search
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -739,41 +755,43 @@ public class MainWindowController {
|
|||||||
updateBtn.setFont(Font.font("System", 12));
|
updateBtn.setFont(Font.font("System", 12));
|
||||||
cbLocal.setItems(locals);
|
cbLocal.setItems(locals);
|
||||||
|
|
||||||
//TODO rework!
|
if(autoUpdate){
|
||||||
if(autoUpdate.equals("1")){
|
|
||||||
autoupdateBtn.setSelected(true);
|
autoupdateBtn.setSelected(true);
|
||||||
Updater.start();
|
try {
|
||||||
|
Thread updateThread = new Thread(Updater);
|
||||||
|
updateThread.setName("Updater");
|
||||||
|
updateThread.start();
|
||||||
|
updateThread.join();
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
autoupdateBtn.setSelected(false);
|
autoupdateBtn.setSelected(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
ta1.setWrapText(true);
|
|
||||||
ta1.setEditable(false);
|
|
||||||
ta1.setFont(Font.font("System", getSize()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void refreshTable(){
|
private void refreshTable(){
|
||||||
if(mode.equals("local")){
|
if(mode.equals("local")){
|
||||||
root.getChildren().set(selected, new TreeItem<streamUiData>(newData.get(selected)));
|
root.getChildren().set(selected, new TreeItem<tableData>(localFilms.get(selected)));
|
||||||
}else if(mode.equals("streaming")){
|
}else if(mode.equals("streaming")){
|
||||||
root.getChildren().set(selected, new TreeItem<streamUiData>(streamData.get(selected)));
|
root.getChildren().set(selected, new TreeItem<tableData>(streamingFilms.get(selected)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void addDataUI(){
|
void addDataUI(){
|
||||||
if(mode.equals("local")){
|
if(mode.equals("local")){
|
||||||
for(int i = 0; i < newData.size(); i++){
|
for(int i = 0; i < localFilms.size(); i++){
|
||||||
root.getChildren().add(new TreeItem<streamUiData>(newData.get(i))); //add data to root-node
|
root.getChildren().add(new TreeItem<tableData>(localFilms.get(i))); //add data to root-node
|
||||||
}
|
}
|
||||||
columnRating.setMaxWidth(90);
|
columnRating.setMaxWidth(85);
|
||||||
columnTitel.setMaxWidth(290);
|
columnTitel.setMaxWidth(290);
|
||||||
treeTableViewfilm.getColumns().get(3).setVisible(false);
|
treeTableViewfilm.getColumns().get(3).setVisible(false);
|
||||||
treeTableViewfilm.getColumns().get(4).setVisible(false);
|
treeTableViewfilm.getColumns().get(4).setVisible(false);
|
||||||
treeTableViewfilm.getColumns().get(5).setVisible(false);
|
treeTableViewfilm.getColumns().get(5).setVisible(false);
|
||||||
treeTableViewfilm.getColumns().get(6).setVisible(false);
|
treeTableViewfilm.getColumns().get(6).setVisible(false);
|
||||||
}else if(mode.equals("streaming")){
|
}else if(mode.equals("streaming")){
|
||||||
for(int i = 0; i < streamData.size(); i++){
|
for(int i = 0; i < streamingFilms.size(); i++){
|
||||||
root.getChildren().add(new TreeItem<streamUiData>(streamData.get(i))); //add data to root-node
|
root.getChildren().add(new TreeItem<tableData>(streamingFilms.get(i))); //add data to root-node
|
||||||
}
|
}
|
||||||
columnTitel.setMaxWidth(150);
|
columnTitel.setMaxWidth(150);
|
||||||
columnResolution.setMaxWidth(65);
|
columnResolution.setMaxWidth(65);
|
||||||
@ -790,18 +808,18 @@ public class MainWindowController {
|
|||||||
|
|
||||||
void loadStreamingSettings(){
|
void loadStreamingSettings(){
|
||||||
if(getStreamingPath().equals("")||getStreamingPath().equals(null)){
|
if(getStreamingPath().equals("")||getStreamingPath().equals(null)){
|
||||||
System.out.println("Kein Pfad angegeben"); //falls der Pfad null oder "" ist
|
System.out.println("Kein Pfad angegeben"); //if path equals "" or null
|
||||||
}else{
|
}else{
|
||||||
String[] entries = new File(getStreamingPath()).list();
|
String[] entries = new File(getStreamingPath()).list();
|
||||||
for(int i = 0; i < entries.length; i++){
|
for(int i = 0; i < entries.length; i++){
|
||||||
if(entries[i].endsWith(".json")){
|
if(entries[i].endsWith(".json")){
|
||||||
String titel = ohneEndung(entries[i]);
|
String titel = ohneEndung(entries[i]);
|
||||||
String data = entries[i];
|
String data = entries[i];
|
||||||
streamingData.add(new streamUiData(1,1,1,5.0,"1",titel ,data, imv1));
|
streamingData.add(new tableData(1,1,1,5.0,"1",titel ,data, imv1, false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(int i = 0; i < streamingData.size(); i++){
|
for(int i = 0; i < streamingData.size(); i++){
|
||||||
streamingRoot.getChildren().add( new TreeItem<streamUiData>(streamingData.get(i))); //fügt daten zur Rootnode hinzu
|
streamingRoot.getChildren().add( new TreeItem<tableData>(streamingData.get(i))); //adds data to root-node
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -842,7 +860,7 @@ public class MainWindowController {
|
|||||||
playbtn.setGraphic(play_arrow_white);
|
playbtn.setGraphic(play_arrow_white);
|
||||||
returnBtn.setGraphic(skip_previous_white);
|
returnBtn.setGraphic(skip_previous_white);
|
||||||
forwardBtn.setGraphic(skip_next_white);
|
forwardBtn.setGraphic(skip_next_white);
|
||||||
menubtn.setGraphic(menu_icon_white);
|
menuHam.getStyleClass().add("jfx-hamburgerW");
|
||||||
}else{
|
}else{
|
||||||
settingsBtn.setStyle("-fx-text-fill: BLACK;");
|
settingsBtn.setStyle("-fx-text-fill: BLACK;");
|
||||||
streamingSettingsBtn.setStyle("-fx-text-fill: BLACK;");
|
streamingSettingsBtn.setStyle("-fx-text-fill: BLACK;");
|
||||||
@ -859,7 +877,7 @@ public class MainWindowController {
|
|||||||
playbtn.setGraphic(play_arrow_black);
|
playbtn.setGraphic(play_arrow_black);
|
||||||
returnBtn.setGraphic(skip_previous_black);
|
returnBtn.setGraphic(skip_previous_black);
|
||||||
forwardBtn.setGraphic(skip_next_black);
|
forwardBtn.setGraphic(skip_next_black);
|
||||||
menubtn.setGraphic(menu_icon_black);
|
menuHam.getStyleClass().add("jfx-hamburgerB");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mode.equals("local")){
|
if(mode.equals("local")){
|
||||||
@ -904,15 +922,15 @@ public class MainWindowController {
|
|||||||
void setLocalUI(){
|
void setLocalUI(){
|
||||||
switch(getLocal()){
|
switch(getLocal()){
|
||||||
case "en_US":
|
case "en_US":
|
||||||
bundle = ResourceBundle.getBundle("recources.HomeFlix-Local", Locale.US); //us_english
|
bundle = ResourceBundle.getBundle("resources.HomeFlix-Local", Locale.US); //us_English
|
||||||
cbLocal.getSelectionModel().select(0);
|
cbLocal.getSelectionModel().select(0);
|
||||||
break;
|
break;
|
||||||
case "de_DE":
|
case "de_DE":
|
||||||
bundle = ResourceBundle.getBundle("recources.HomeFlix-Local", Locale.GERMAN); //German
|
bundle = ResourceBundle.getBundle("resources.HomeFlix-Local", Locale.GERMAN); //German
|
||||||
cbLocal.getSelectionModel().select(1);
|
cbLocal.getSelectionModel().select(1);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
bundle = ResourceBundle.getBundle("recources.HomeFlix-Local", Locale.US); //default local
|
bundle = ResourceBundle.getBundle("resources.HomeFlix-Local", Locale.US); //default local
|
||||||
cbLocal.getSelectionModel().select(0);
|
cbLocal.getSelectionModel().select(0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -926,9 +944,12 @@ public class MainWindowController {
|
|||||||
updateBtn.setText(bundle.getString("checkUpdates"));
|
updateBtn.setText(bundle.getString("checkUpdates"));
|
||||||
directoryBtn.setText(bundle.getString("chooseFolder"));
|
directoryBtn.setText(bundle.getString("chooseFolder"));
|
||||||
streamingDirectoryBtn.setText(bundle.getString("chooseFolder"));
|
streamingDirectoryBtn.setText(bundle.getString("chooseFolder"));
|
||||||
sizelbl.setText(bundle.getString("fontSize"));
|
settingsHead1Label.setText(bundle.getString("settingsHead1Label"));
|
||||||
aulbl.setText(bundle.getString("autoUpdate"));
|
mainColorLabel.setText(bundle.getString("mainColorLabel"));
|
||||||
versionlbl.setText(bundle.getString("version")+" "+version+" (Build: "+buildNumber+")");
|
fontsizeLabel.setText(bundle.getString("fontsizeLabel"));
|
||||||
|
localLabel.setText(bundle.getString("localLabel"));
|
||||||
|
autoUpdateLabel.setText(bundle.getString("autoUpdateLabel"));
|
||||||
|
versionLabel.setText(bundle.getString("version")+" "+version+" (Build: "+buildNumber+")");
|
||||||
columnTitel.setText(bundle.getString("columnName"));
|
columnTitel.setText(bundle.getString("columnName"));
|
||||||
columnRating.setText(bundle.getString("columnRating"));
|
columnRating.setText(bundle.getString("columnRating"));
|
||||||
columnStreamUrl.setText(bundle.getString("columnStreamUrl"));
|
columnStreamUrl.setText(bundle.getString("columnStreamUrl"));
|
||||||
@ -944,7 +965,6 @@ public class MainWindowController {
|
|||||||
errorSave = bundle.getString("errorSave");
|
errorSave = bundle.getString("errorSave");
|
||||||
noFilmFound = bundle.getString("noFilmFound");
|
noFilmFound = bundle.getString("noFilmFound");
|
||||||
infoText = bundle.getString("version")+" "+version+" (Build: "+buildNumber+") "+versionName+bundle.getString("infoText");
|
infoText = bundle.getString("version")+" "+version+" (Build: "+buildNumber+") "+versionName+bundle.getString("infoText");
|
||||||
linuxBugText = bundle.getString("linuxBug");
|
|
||||||
vlcNotInstalled = bundle.getString("vlcNotInstalled");
|
vlcNotInstalled = bundle.getString("vlcNotInstalled");
|
||||||
|
|
||||||
title = bundle.getString("title");
|
title = bundle.getString("title");
|
||||||
@ -970,6 +990,7 @@ public class MainWindowController {
|
|||||||
alert.setTitle("Error");
|
alert.setTitle("Error");
|
||||||
alert.setHeaderText("");
|
alert.setHeaderText("");
|
||||||
alert.setContentText(msg);
|
alert.setContentText(msg);
|
||||||
|
alert.initOwner(main.primaryStage);
|
||||||
|
|
||||||
// Create expandable Exception.
|
// Create expandable Exception.
|
||||||
StringWriter sw = new StringWriter();
|
StringWriter sw = new StringWriter();
|
||||||
@ -1000,11 +1021,12 @@ public class MainWindowController {
|
|||||||
|
|
||||||
//saves the Settings
|
//saves the Settings
|
||||||
public void saveSettings(){
|
public void saveSettings(){
|
||||||
|
System.out.println("saving settings ...");
|
||||||
OutputStream outputStream; //new output-stream
|
OutputStream outputStream; //new output-stream
|
||||||
try {
|
try {
|
||||||
props.setProperty("path", getPath()); //writes path into property
|
props.setProperty("path", getPath()); //writes path into property
|
||||||
props.setProperty("color", getColor());
|
props.setProperty("color", getColor());
|
||||||
props.setProperty("autoUpdate", getAutoUpdate());
|
props.setProperty("autoUpdate", String.valueOf(isAutoUpdate()));
|
||||||
props.setProperty("size", getSize().toString());
|
props.setProperty("size", getSize().toString());
|
||||||
props.setProperty("local", getLocal());
|
props.setProperty("local", getLocal());
|
||||||
props.setProperty("streamingPath", getStreamingPath());
|
props.setProperty("streamingPath", getStreamingPath());
|
||||||
@ -1036,21 +1058,33 @@ public class MainWindowController {
|
|||||||
inputStream = new FileInputStream(fileWin);
|
inputStream = new FileInputStream(fileWin);
|
||||||
}
|
}
|
||||||
props.loadFromXML(inputStream); //new input-stream from .xml
|
props.loadFromXML(inputStream); //new input-stream from .xml
|
||||||
path = props.getProperty("path"); //reads path from property
|
path = props.getProperty("path"); //read path from property
|
||||||
streamingPath = props.getProperty("streamingPath");
|
streamingPath = props.getProperty("streamingPath");
|
||||||
color = props.getProperty("color");
|
color = props.getProperty("color");
|
||||||
size = Double.parseDouble(props.getProperty("size"));
|
size = Double.parseDouble(props.getProperty("size"));
|
||||||
autoUpdate = props.getProperty("autoUpdate");
|
autoUpdate = Boolean.parseBoolean(props.getProperty("autoUpdate"));
|
||||||
local = props.getProperty("local");
|
local = props.getProperty("local");
|
||||||
mode = props.getProperty("mode");
|
|
||||||
ratingSortType = props.getProperty("ratingSortType");
|
ratingSortType = props.getProperty("ratingSortType");
|
||||||
|
|
||||||
|
switch (props.getProperty("mode")) {
|
||||||
|
case "local":
|
||||||
|
mode = "local";
|
||||||
|
break;
|
||||||
|
case "streaming":
|
||||||
|
mode = "streaming";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
mode = "local";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
inputStream.close();
|
inputStream.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
if(firststart == false){
|
if(firststart == false){
|
||||||
showErrorMsg(errorSave, e);
|
showErrorMsg(errorSave, e);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
// showErrorMsg(errorLoad, e); //TODO das soll beim ersten start nicht erscheinen
|
// showErrorMsg(errorLoad, e); //TODO This should not be visible at first startup
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1095,11 +1129,11 @@ public class MainWindowController {
|
|||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAutoUpdate(String input){
|
public void setAutoUpdate(boolean input){
|
||||||
this.autoUpdate = input;
|
this.autoUpdate = input;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAutoUpdate(){
|
public boolean isAutoUpdate(){
|
||||||
return autoUpdate;
|
return autoUpdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1118,4 +1152,12 @@ public class MainWindowController {
|
|||||||
public String getMode(){
|
public String getMode(){
|
||||||
return mode;
|
return mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getCurrentWorkingDirectory() {
|
||||||
|
return currentWorkingDirectory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCurrentWorkingDirectory(String currentWorkingDirectory) {
|
||||||
|
this.currentWorkingDirectory = currentWorkingDirectory;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,54 +1,68 @@
|
|||||||
/**
|
/**
|
||||||
* apiQuery for Project HomeFlix
|
* apiQuery for Project HomeFlix
|
||||||
* sends a query to the omdb api
|
* sends a query to the omdb api
|
||||||
*
|
|
||||||
* TODO build in a caching function
|
|
||||||
*/
|
*/
|
||||||
package application;
|
package application;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.File;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
|
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
|
||||||
import com.eclipsesource.json.Json;
|
import com.eclipsesource.json.Json;
|
||||||
import com.eclipsesource.json.JsonObject;
|
import com.eclipsesource.json.JsonObject;
|
||||||
|
|
||||||
import javafx.collections.ObservableList;
|
|
||||||
import javafx.scene.Node;
|
|
||||||
import javafx.scene.image.Image;
|
import javafx.scene.image.Image;
|
||||||
import javafx.scene.paint.Color;
|
|
||||||
import javafx.scene.text.Font;
|
import javafx.scene.text.Font;
|
||||||
import javafx.scene.text.FontWeight;
|
import javafx.scene.text.FontWeight;
|
||||||
import javafx.scene.text.Text;
|
import javafx.scene.text.Text;
|
||||||
|
|
||||||
public class apiQuery{
|
public class apiQuery{
|
||||||
|
|
||||||
public apiQuery(MainWindowController m){
|
public apiQuery(MainWindowController m, DBController db, Main main){
|
||||||
mainWindowController=m;
|
mainWindowController=m;
|
||||||
|
dbController=db;
|
||||||
|
this.main = main;
|
||||||
}
|
}
|
||||||
|
|
||||||
private MainWindowController mainWindowController;
|
private MainWindowController mainWindowController;
|
||||||
|
private DBController dbController;
|
||||||
|
private Main main;
|
||||||
private Image im;
|
private Image im;
|
||||||
private int fontSize = 20;
|
private String[] responseString = new String[20];
|
||||||
private String fontFamily = "System";
|
private String posterCache;
|
||||||
|
private String apiURL = "https://www.omdbapi.com/?apikey=";
|
||||||
|
private String apiKey = "b9f9fd23";
|
||||||
|
ArrayList<Text> responseText = new ArrayList<Text>();
|
||||||
|
ArrayList<Text> nameText = new ArrayList<Text>();
|
||||||
|
|
||||||
@SuppressWarnings("deprecation") //TODO
|
void startQuery(String titel, String streamUrl){
|
||||||
void startQuery(String input){
|
URL queryURL = null;
|
||||||
URL url = null;
|
|
||||||
Scanner sc = null;
|
Scanner sc = null;
|
||||||
String apiurl = "https://www.omdbapi.com/?"; //API URL
|
|
||||||
String moviename = null;
|
String moviename = null;
|
||||||
String dataurl = null;
|
|
||||||
String retdata = null;
|
String retdata = null;
|
||||||
|
String posterPath = null;
|
||||||
InputStream is = null;
|
InputStream is = null;
|
||||||
DataInputStream dis = null;
|
BufferedReader br = null;
|
||||||
|
String fontFamily = main.getFONT_FAMILY();
|
||||||
|
posterCache = main.getPosterCache().toString();
|
||||||
|
int fontSize = (int) Math.round(mainWindowController.size);
|
||||||
|
|
||||||
|
responseText.removeAll(responseText);
|
||||||
|
nameText.removeAll(nameText);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
//get film title
|
//get film title
|
||||||
sc = new Scanner(System.in);
|
sc = new Scanner(System.in);
|
||||||
moviename = input;
|
moviename = titel;
|
||||||
|
|
||||||
// in case of no or "" Film title
|
// in case of no or "" Film title
|
||||||
if (moviename == null || moviename.equals("")) {
|
if (moviename == null || moviename.equals("")) {
|
||||||
@ -58,171 +72,119 @@ public class apiQuery{
|
|||||||
//remove unwanted blank
|
//remove unwanted blank
|
||||||
moviename = moviename.trim();
|
moviename = moviename.trim();
|
||||||
|
|
||||||
//replace blank with + for api-query
|
//replace blank with +
|
||||||
moviename = moviename.replace(" ", "+");
|
moviename = moviename.replace(" ", "+");
|
||||||
|
|
||||||
//URL wird zusammengestellt abfragetypen: http,json,xml (muss json sein um späteres trennen zu ermöglichen)
|
//queryURL is apiURL and additional parameters, response-types: http,json,xml (must be json, since the response is processed with minimal-json )
|
||||||
dataurl = apiurl + "t=" + moviename + "&plot=full&r=json";
|
queryURL = new URL(apiURL + apiKey + "&t=" + moviename + "&plot=full&r=json");
|
||||||
|
is = queryURL.openStream();
|
||||||
|
br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
|
||||||
|
|
||||||
url = new URL(dataurl);
|
//read data from response Stream
|
||||||
is = url.openStream();
|
while ((retdata = br.readLine()) != null) {
|
||||||
dis = new DataInputStream(is);
|
//cut the json response into separate strings
|
||||||
|
|
||||||
// lesen der Daten aus dem Antwort Stream
|
|
||||||
while ((retdata = dis.readLine()) != null) {
|
|
||||||
//retdata in json object parsen und anschließend das json Objekt "zerschneiden"
|
|
||||||
System.out.println(retdata);
|
System.out.println(retdata);
|
||||||
JsonObject object = Json.parse(retdata).asObject();
|
JsonObject object = Json.parse(retdata).asObject();
|
||||||
String titelV = object.getString("Title", "");
|
|
||||||
String yearV = object.getString("Year", "");
|
|
||||||
String ratedV = object.getString("Rated", "");
|
|
||||||
String releasedV = object.getString("Released", "");
|
|
||||||
String runtimeV = object.getString("Runtime", "");
|
|
||||||
String genreV = object.getString("Genre", "");
|
|
||||||
String directorV = object.getString("Director", "");
|
|
||||||
String writerV = object.getString("Writer", "");
|
|
||||||
String actorsV = object.getString("Actors", "");
|
|
||||||
String plotV = object.getString("Plot", "");
|
|
||||||
String languageV = object.getString("Language", "");
|
|
||||||
String countryV = object.getString("Country", "");
|
|
||||||
String awardsV = object.getString("Awards", "");
|
|
||||||
|
|
||||||
String metascoreV = object.getString("Metascore", "");
|
responseString[0] = object.getString("Title", "");
|
||||||
String imdbRatingV = object.getString("imdbRating", "");
|
responseString[1] = object.getString("Year", "");
|
||||||
@SuppressWarnings("unused")
|
responseString[2] = object.getString("Rated", "");
|
||||||
String imdbVotesV = object.getString("imdbVotes", "");
|
responseString[3] = object.getString("Released", "");
|
||||||
@SuppressWarnings("unused")
|
responseString[4] = object.getString("Runtime", "");
|
||||||
String imdbIDV = object.getString("imdbID", "");
|
responseString[5] = object.getString("Genre", "");
|
||||||
String typeV = object.getString("Type", "");
|
responseString[6] = object.getString("Director", "");
|
||||||
|
responseString[7] = object.getString("Writer", "");
|
||||||
|
responseString[8] = object.getString("Actors", "");
|
||||||
|
responseString[9] = object.getString("Plot", "");
|
||||||
|
responseString[10] = object.getString("Language", "");
|
||||||
|
responseString[11] = object.getString("Country", "");
|
||||||
|
responseString[12] = object.getString("Awards", "");
|
||||||
|
responseString[13] = object.getString("Metascore", "");
|
||||||
|
responseString[14] = object.getString("imdbRating", "");
|
||||||
|
responseString[15] = object.getString("Type", "");
|
||||||
|
responseString[16] = object.getString("imdbVotes", "");
|
||||||
|
responseString[17] = object.getString("imdbID", "");
|
||||||
|
responseString[18] = object.getString("Poster", "");
|
||||||
|
responseString[19] = object.getString("Response", "");
|
||||||
|
|
||||||
String posterURL = object.getString("Poster", "");
|
//adding poster to cache
|
||||||
String response = object.getString("Response", "");
|
BufferedImage originalImage = ImageIO.read(new URL(responseString[18]));//change path to where file is located
|
||||||
|
int type = originalImage.getType() == 0 ? BufferedImage.TYPE_INT_ARGB : originalImage.getType();
|
||||||
|
BufferedImage resizeImagePNG = resizeImage(originalImage, type, 198, 297);
|
||||||
|
if(System.getProperty("os.name").equals("Linux")) {
|
||||||
|
posterPath = posterCache+"/"+titel+".png";
|
||||||
|
ImageIO.write(resizeImagePNG, "png", new File(posterCache+"/"+titel+".png")); //change path where you want it saved
|
||||||
|
} else {
|
||||||
|
ImageIO.write(resizeImagePNG, "png", new File(posterCache+"\\"+titel+".png")); //change path where you want it saved
|
||||||
|
posterPath = posterCache+"\\"+titel+".png";
|
||||||
|
}
|
||||||
|
System.out.println("adding poster to cache: "+posterPath);
|
||||||
|
|
||||||
// Text titelR = new Text (object.getString("Title", "")+"\n");
|
//adding strings to the cache
|
||||||
// titelR.setFont(Font.font (fontFamily, fontSize));
|
dbController.addCache( streamUrl, responseString[0], responseString[1],responseString[2], responseString[3], responseString[4], responseString[5],
|
||||||
// Text yearR = new Text (object.getString("Year", "")+"\n");
|
responseString[6], responseString[7], responseString[8], responseString[9], responseString[10],responseString[11], responseString[12],
|
||||||
// yearR.setFont(Font.font (fontFamily, fontSize));
|
responseString[13], responseString[14], responseString[15], responseString[16], responseString[17], posterPath,
|
||||||
// Text ratedR = new Text (object.getString("Rated", "")+"\n");
|
responseString[19]);
|
||||||
// ratedR.setFont(Font.font (fontFamily, fontSize));
|
dbController.setCached(streamUrl);
|
||||||
// Text releasedR = new Text (object.getString("Released", "")+"\n");
|
|
||||||
// releasedR.setFont(Font.font (fontFamily, fontSize));
|
|
||||||
// Text runtimeR = new Text (object.getString("Runtime", "")+"\n");
|
|
||||||
// runtimeR.setFont(Font.font (fontFamily, fontSize));
|
|
||||||
// Text genreR = new Text (object.getString("Genre", ""));
|
|
||||||
// genreR.setFont(Font.font (fontFamily, fontSize));
|
|
||||||
// Text directorR = new Text (object.getString("Director", "")+"\n");
|
|
||||||
// directorR.setFont(Font.font (fontFamily, fontSize));
|
|
||||||
// Text writerR = new Text (object.getString("Writer", "")+"\n");
|
|
||||||
// writerR.setFont(Font.font (fontFamily, fontSize));
|
|
||||||
// Text actorsR = new Text (object.getString("Actors", "")+"\n");
|
|
||||||
// actorsR.setFont(Font.font (fontFamily, fontSize));
|
|
||||||
// Text plotR = new Text (object.getString("Plot", "")+"\n");
|
|
||||||
// plotR.setFont(Font.font (fontFamily, fontSize));
|
|
||||||
// Text languageR = new Text (object.getString("Language", "")+"\n");
|
|
||||||
// languageR.setFont(Font.font (fontFamily, fontSize));
|
|
||||||
// Text countryR = new Text (object.getString("Country", "")+"\n");
|
|
||||||
// countryR.setFont(Font.font (fontFamily, fontSize));
|
|
||||||
// Text awardsR = new Text (object.getString("Awards", "")+"\n");
|
|
||||||
// awardsR.setFont(Font.font (fontFamily, fontSize));
|
|
||||||
// Text metascoreR = new Text (object.getString("Metascore", "")+"\n");
|
|
||||||
// metascoreR.setFont(Font.font (fontFamily, fontSize));
|
|
||||||
// Text imdbRatingR = new Text (object.getString("imdbRating", "")+"\n");
|
|
||||||
// imdbRatingR.setFont(Font.font (fontFamily, fontSize));
|
|
||||||
// @SuppressWarnings("unused")
|
|
||||||
// Text imdbVotesR = new Text (object.getString("imdbVotes", "")+"\n");
|
|
||||||
// imdbVotesR.setFont(Font.font (fontFamily, fontSize));
|
|
||||||
// @SuppressWarnings("unused")
|
|
||||||
// Text imdbIDR = new Text (object.getString("imdbID", "")+"\n");
|
|
||||||
// imdbIDR.setFont(Font.font (fontFamily, fontSize));
|
|
||||||
// Text typeR = new Text (object.getString("Type", "")+"\n");
|
|
||||||
// typeR.setFont(Font.font (fontFamily, fontSize));
|
|
||||||
|
|
||||||
|
for(int i=0; i<20; i++){
|
||||||
|
Text text = new Text(responseString[i]+"\n");
|
||||||
|
responseText.add(text);
|
||||||
|
responseText.get(i).setFont(Font.font(fontFamily, fontSize));
|
||||||
|
}
|
||||||
|
|
||||||
if(response.equals("False")){
|
//if response == false then show mainWindowController.noFilmFound else create new Texts and add them to flowText
|
||||||
mainWindowController.ta1.appendText(mainWindowController.noFilmFound);
|
if(retdata.contains("\"Response\":\"False\"")){ //TODO + FIXME
|
||||||
im = new Image("recources/icons/close_black_2048x2048.png");
|
mainWindowController.textFlow.getChildren().add(new Text(mainWindowController.noFilmFound));
|
||||||
|
im = new Image("resources/icons/close_black_2048x2048.png");
|
||||||
mainWindowController.image1.setImage(im);
|
mainWindowController.image1.setImage(im);
|
||||||
}else{
|
}else{
|
||||||
//ausgabe des Textes in ta1 in jeweils neuer Zeile
|
nameText.add(0, new Text(mainWindowController.title+": "));
|
||||||
mainWindowController.ta1.appendText(mainWindowController.title+": "+titelV+"\n");
|
nameText.add(1, new Text(mainWindowController.year+": "));
|
||||||
mainWindowController.ta1.appendText(mainWindowController.year+": "+ yearV+"\n");
|
nameText.add(2, new Text(mainWindowController.rating+": "));
|
||||||
mainWindowController.ta1.appendText(mainWindowController.rating+": "+ratedV+"\n");
|
nameText.add(3, new Text(mainWindowController.publishedOn+": "));
|
||||||
mainWindowController.ta1.appendText(mainWindowController.publishedOn+": "+releasedV+"\n");
|
nameText.add(4, new Text(mainWindowController.duration+": "));
|
||||||
mainWindowController.ta1.appendText(mainWindowController.duration+": "+runtimeV+"\n");
|
nameText.add(5, new Text(mainWindowController.genre+": "));
|
||||||
mainWindowController.ta1.appendText(mainWindowController.genre+": "+genreV+"\n");
|
nameText.add(6, new Text(mainWindowController.director+": "));
|
||||||
mainWindowController.ta1.appendText(mainWindowController.director+": "+directorV+"\n");
|
nameText.add(7, new Text(mainWindowController.writer+": "));
|
||||||
mainWindowController.ta1.appendText(mainWindowController.writer+": "+writerV+"\n");
|
nameText.add(8, new Text(mainWindowController.actors+": "));
|
||||||
mainWindowController.ta1.appendText(mainWindowController.actors+": "+actorsV+"\n");
|
nameText.add(9, new Text(mainWindowController.plot+": "));
|
||||||
mainWindowController.ta1.appendText(mainWindowController.plot+": "+plotV+"\n");
|
nameText.add(10, new Text(mainWindowController.language+": "));
|
||||||
mainWindowController.ta1.appendText(mainWindowController.language+": "+languageV+"\n");
|
nameText.add(11, new Text(mainWindowController.country+": "));
|
||||||
mainWindowController.ta1.appendText(mainWindowController.country+": "+countryV+"\n");
|
nameText.add(12, new Text(mainWindowController.awards+": "));
|
||||||
mainWindowController.ta1.appendText(mainWindowController.awards+": "+awardsV+"\n");
|
nameText.add(13, new Text(mainWindowController.metascore+": "));
|
||||||
mainWindowController.ta1.appendText(mainWindowController.metascore+": "+metascoreV+"\n");
|
nameText.add(14, new Text(mainWindowController.imdbRating+": "));
|
||||||
mainWindowController.ta1.appendText(mainWindowController.imdbRating+": "+imdbRatingV+"\n");
|
nameText.add(15, new Text(mainWindowController.type+": "));
|
||||||
mainWindowController.ta1.appendText(mainWindowController.type+": "+typeV+"\n");
|
|
||||||
|
|
||||||
// mainWindowController.ta1.setVisible(false);
|
for(int i=0; i<nameText.size(); i++){
|
||||||
|
nameText.get(i).setFont(Font.font (fontFamily, FontWeight.BOLD, fontSize));
|
||||||
|
}
|
||||||
|
|
||||||
// Text title = new Text(15, 20, mainWindowController.title+": ");
|
mainWindowController.textFlow.getChildren().remove(0, mainWindowController.textFlow.getChildren().size());
|
||||||
// title.setFont(Font.font (fontFamily, FontWeight.BOLD, fontSize));
|
|
||||||
// Text year = new Text(15, 20, mainWindowController.year+": ");
|
|
||||||
// year.setFont(Font.font (fontFamily, FontWeight.BOLD, fontSize));
|
|
||||||
// Text rating = new Text(15, 20, mainWindowController.rating+": ");
|
|
||||||
// rating.setFont(Font.font (fontFamily, FontWeight.BOLD, fontSize));
|
|
||||||
// Text publishedOn = new Text(15, 20, mainWindowController.publishedOn+": ");
|
|
||||||
// publishedOn.setFont(Font.font (fontFamily, FontWeight.BOLD, fontSize));
|
|
||||||
// Text duration = new Text(15, 20, mainWindowController.duration+": ");
|
|
||||||
// duration.setFont(Font.font (fontFamily, FontWeight.BOLD, fontSize));
|
|
||||||
// Text genre = new Text(15, 20, mainWindowController.genre+": ");
|
|
||||||
// genre.setFont(Font.font (fontFamily, FontWeight.BOLD, fontSize));
|
|
||||||
// Text director = new Text(15, 20, mainWindowController.director+": ");
|
|
||||||
// director.setFont(Font.font (fontFamily, FontWeight.BOLD, fontSize));
|
|
||||||
// Text writer = new Text(15, 20, mainWindowController.writer+": ");
|
|
||||||
// writer.setFont(Font.font (fontFamily, FontWeight.BOLD, fontSize));
|
|
||||||
// Text actors = new Text(15, 20, mainWindowController.actors+": ");
|
|
||||||
// actors.setFont(Font.font (fontFamily, FontWeight.BOLD, fontSize));
|
|
||||||
// Text plot = new Text(15, 20, mainWindowController.plot+": ");
|
|
||||||
// plot.setFont(Font.font (fontFamily, FontWeight.BOLD, fontSize));
|
|
||||||
// Text language = new Text(15, 20, mainWindowController.language+": ");
|
|
||||||
// language.setFont(Font.font (fontFamily, FontWeight.BOLD, fontSize));
|
|
||||||
// Text country = new Text(15, 20, mainWindowController.country+": ");
|
|
||||||
// country.setFont(Font.font (fontFamily, FontWeight.BOLD, fontSize));
|
|
||||||
// Text awards = new Text(15, 20, mainWindowController.awards+": ");
|
|
||||||
// awards.setFont(Font.font (fontFamily, FontWeight.BOLD, fontSize));
|
|
||||||
// Text metascore = new Text(15, 20, mainWindowController.metascore+": ");
|
|
||||||
// metascore.setFont(Font.font (fontFamily, FontWeight.BOLD, fontSize));
|
|
||||||
// Text imdbRating = new Text(15, 20, mainWindowController.imdbRating+": ");
|
|
||||||
// imdbRating.setFont(Font.font (fontFamily, FontWeight.BOLD, fontSize));
|
|
||||||
// Text type = new Text(15, 20, mainWindowController.type+": ");
|
|
||||||
// type.setFont(Font.font (fontFamily, FontWeight.BOLD, fontSize));
|
|
||||||
//
|
|
||||||
// mainWindowController.textFlow.getChildren().remove(0, mainWindowController.textFlow.getChildren().size());
|
|
||||||
//
|
|
||||||
// ObservableList<Node> list = mainWindowController.textFlow.getChildren();
|
|
||||||
//
|
|
||||||
// list.addAll(title,titelR,year,yearR,rating,ratedR,
|
|
||||||
// publishedOn,releasedR,duration,runtimeR,genre,genreR,director,directorR,writer,writerR,
|
|
||||||
// actors,actorsR,plot,plotR,language,languageR,country,countryR,awards,awardsR,metascore,
|
|
||||||
// metascoreR,imdbRating,imdbRatingR,type,typeR);
|
|
||||||
//
|
|
||||||
|
|
||||||
if(posterURL.equals("N/A")){
|
for(int i=0;i<nameText.size(); i++){
|
||||||
im = new Image("recources/icons/close_black_2048x2048.png");
|
mainWindowController.textFlow.getChildren().addAll(nameText.get(i),responseText.get(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
//if there is no poster
|
||||||
|
if(responseString[18].equals("N/A")){
|
||||||
|
im = new Image("resources/icons/close_black_2048x2048.png");
|
||||||
}else{
|
}else{
|
||||||
im = new Image(posterURL);
|
im = new Image(responseString[18]);
|
||||||
}
|
}
|
||||||
mainWindowController.image1.setImage(im);
|
mainWindowController.image1.setImage(im);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
mainWindowController.ta1.setText(e.toString());
|
mainWindowController.textFlow.getChildren().remove(0, mainWindowController.textFlow.getChildren().size());
|
||||||
|
mainWindowController.textFlow.getChildren().add(new Text(e.toString()));
|
||||||
System.out.println(e);
|
System.out.println(e);
|
||||||
} finally {
|
} finally {
|
||||||
//closes datainputStream, InputStream,Scanner if not already done
|
//closes datainputStream, InputStream,Scanner if not already done
|
||||||
try {
|
try {
|
||||||
if (dis != null) {
|
if (br != null) {
|
||||||
dis.close();
|
br.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is != null) {
|
if (is != null) {
|
||||||
@ -232,9 +194,18 @@ public class apiQuery{
|
|||||||
if (sc != null) {
|
if (sc != null) {
|
||||||
sc.close();
|
sc.close();
|
||||||
}
|
}
|
||||||
} catch (Exception e2) {
|
} catch (Exception e) {
|
||||||
;
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static BufferedImage resizeImage(BufferedImage originalImage, int type, int IMG_WIDTH, int IMG_HEIGHT) {
|
||||||
|
BufferedImage resizedImage = new BufferedImage(IMG_WIDTH, IMG_HEIGHT, type);
|
||||||
|
Graphics2D g = resizedImage.createGraphics();
|
||||||
|
g.drawImage(originalImage, 0, 0, IMG_WIDTH, IMG_HEIGHT, null);
|
||||||
|
g.dispose();
|
||||||
|
|
||||||
|
return resizedImage;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1 +0,0 @@
|
|||||||
/* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */
|
|
@ -1,7 +1,9 @@
|
|||||||
package application;
|
package application;
|
||||||
|
|
||||||
|
import javafx.beans.property.BooleanProperty;
|
||||||
import javafx.beans.property.DoubleProperty;
|
import javafx.beans.property.DoubleProperty;
|
||||||
import javafx.beans.property.IntegerProperty;
|
import javafx.beans.property.IntegerProperty;
|
||||||
|
import javafx.beans.property.SimpleBooleanProperty;
|
||||||
import javafx.beans.property.SimpleDoubleProperty;
|
import javafx.beans.property.SimpleDoubleProperty;
|
||||||
import javafx.beans.property.SimpleIntegerProperty;
|
import javafx.beans.property.SimpleIntegerProperty;
|
||||||
import javafx.beans.property.SimpleObjectProperty;
|
import javafx.beans.property.SimpleObjectProperty;
|
||||||
@ -9,27 +11,39 @@ import javafx.beans.property.SimpleStringProperty;
|
|||||||
import javafx.beans.property.StringProperty;
|
import javafx.beans.property.StringProperty;
|
||||||
import javafx.scene.image.ImageView;
|
import javafx.scene.image.ImageView;
|
||||||
|
|
||||||
public class streamUiData {
|
public class tableData {
|
||||||
|
|
||||||
private final IntegerProperty year = new SimpleIntegerProperty();
|
private final IntegerProperty year = new SimpleIntegerProperty();
|
||||||
private final IntegerProperty season = new SimpleIntegerProperty();
|
private final IntegerProperty season = new SimpleIntegerProperty();
|
||||||
private final IntegerProperty episode = new SimpleIntegerProperty();
|
private final IntegerProperty episode = new SimpleIntegerProperty();
|
||||||
private final DoubleProperty rating = new SimpleDoubleProperty();
|
private final DoubleProperty rating = new SimpleDoubleProperty();
|
||||||
private final StringProperty resolution = new SimpleStringProperty();
|
private final StringProperty resolution = new SimpleStringProperty();
|
||||||
private final StringProperty titel = new SimpleStringProperty();
|
private final StringProperty title = new SimpleStringProperty();
|
||||||
private final StringProperty streamUrl = new SimpleStringProperty();
|
private final StringProperty streamUrl = new SimpleStringProperty();
|
||||||
private final SimpleObjectProperty<ImageView> image = new SimpleObjectProperty<>();
|
private final SimpleObjectProperty<ImageView> image = new SimpleObjectProperty<>();
|
||||||
|
private final BooleanProperty cached = new SimpleBooleanProperty();
|
||||||
|
|
||||||
//uiData ist der Typ der Daten in der TreeTabelView
|
/**
|
||||||
public streamUiData (final int year, final int season, final int episode, final double rating, final String resolution, final String titel, final String streamUrl, final ImageView image) {
|
* tableData is the data-type of tree-table-view
|
||||||
|
* @param year: the release year of the film
|
||||||
|
* @param season: season if it's a series
|
||||||
|
* @param episode: episode if it's a series
|
||||||
|
* @param rating: indicator for favourites, used for sorting the items
|
||||||
|
* @param resolution: resolution of the film
|
||||||
|
* @param titel: title of the film
|
||||||
|
* @param streamUrl: the concrete path to the file or the URL
|
||||||
|
* @param image: the favourite icon
|
||||||
|
* @param cached: indicator for caching status
|
||||||
|
*/
|
||||||
|
public tableData (final int year, final int season, final int episode, final double rating, final String resolution, final String title, final String streamUrl, final ImageView image, final boolean cached) {
|
||||||
this.year.set(year);
|
this.year.set(year);
|
||||||
this.season.set(season);
|
this.season.set(season);
|
||||||
this.episode.set(episode);
|
this.episode.set(episode);
|
||||||
this.rating.set(rating);
|
this.rating.set(rating);
|
||||||
this.resolution.set(resolution);
|
this.resolution.set(resolution);
|
||||||
this.titel.set(titel);
|
this.title.set(title);
|
||||||
this.streamUrl.set(streamUrl);
|
this.streamUrl.set(streamUrl);
|
||||||
this.image.set(image);
|
this.image.set(image);
|
||||||
|
this.cached.set(cached);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IntegerProperty yearProperty(){
|
public IntegerProperty yearProperty(){
|
||||||
@ -52,8 +66,8 @@ public class streamUiData {
|
|||||||
return resolution;
|
return resolution;
|
||||||
}
|
}
|
||||||
|
|
||||||
public StringProperty titelProperty(){
|
public StringProperty titleProperty(){
|
||||||
return titel;
|
return title;
|
||||||
}
|
}
|
||||||
|
|
||||||
public StringProperty streamUrlProperty(){
|
public StringProperty streamUrlProperty(){
|
||||||
@ -64,6 +78,10 @@ public class streamUiData {
|
|||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BooleanProperty cachedProperty(){
|
||||||
|
return cached;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public final int getYear() {
|
public final int getYear() {
|
||||||
return yearProperty().get();
|
return yearProperty().get();
|
||||||
@ -85,8 +103,8 @@ public class streamUiData {
|
|||||||
return resolutionProperty().get();
|
return resolutionProperty().get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public final String getTitel() {
|
public final String getTitle() {
|
||||||
return titelProperty().get();
|
return titleProperty().get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public final String getStreamUrl() {
|
public final String getStreamUrl() {
|
||||||
@ -97,6 +115,10 @@ public class streamUiData {
|
|||||||
return imageProperty().get();
|
return imageProperty().get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final boolean getCached(){
|
||||||
|
return cachedProperty().get();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public final void setYear(int year) {
|
public final void setYear(int year) {
|
||||||
yearProperty().set(year);
|
yearProperty().set(year);
|
||||||
@ -118,8 +140,8 @@ public class streamUiData {
|
|||||||
resolutionProperty().set(resolution);
|
resolutionProperty().set(resolution);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void setTitel(String titel) {
|
public final void setTitle(String title) {
|
||||||
titelProperty().set(titel);
|
titleProperty().set(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void setStreamUrl(String streamUrl) {
|
public final void setStreamUrl(String streamUrl) {
|
||||||
@ -129,4 +151,8 @@ public class streamUiData {
|
|||||||
public final void setImage(ImageView image) {
|
public final void setImage(ImageView image) {
|
||||||
imageProperty().set(image);
|
imageProperty().set(image);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final void setCached(boolean cached){
|
||||||
|
cachedProperty().set(cached);
|
||||||
|
}
|
||||||
}
|
}
|
@ -5,66 +5,100 @@
|
|||||||
package application;
|
package application;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.FileOutputStream;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.nio.channels.Channels;
|
import javax.swing.ProgressMonitor;
|
||||||
import java.nio.channels.ReadableByteChannel;
|
import javax.swing.ProgressMonitorInputStream;
|
||||||
|
|
||||||
public class updater extends Thread{
|
import org.apache.commons.io.FileUtils;
|
||||||
|
|
||||||
|
import com.eclipsesource.json.Json;
|
||||||
|
import com.eclipsesource.json.JsonArray;
|
||||||
|
import com.eclipsesource.json.JsonObject;
|
||||||
|
import com.eclipsesource.json.JsonValue;
|
||||||
|
|
||||||
|
import javafx.application.Platform;
|
||||||
|
|
||||||
|
public class updater implements Runnable{
|
||||||
|
|
||||||
private MainWindowController mainWindowController;
|
private MainWindowController mainWindowController;
|
||||||
private String buildURL;
|
|
||||||
private String downloadLink;
|
|
||||||
private String aktBuildNumber;
|
|
||||||
private String buildNumber;
|
private String buildNumber;
|
||||||
|
private String apiOutput;
|
||||||
|
private String updateBuildNumber; //tag_name from Github
|
||||||
|
private String browserDownloadUrl; //update download link
|
||||||
|
private String githubApi = "https://api.github.com/repos/Seil0/Project-HomeFlix/releases/latest";
|
||||||
|
|
||||||
public updater(MainWindowController m, String buildURL,String downloadLink,String aktBuildNumber,String buildNumber){
|
|
||||||
|
public updater(MainWindowController m, String buildNumber){
|
||||||
mainWindowController=m;
|
mainWindowController=m;
|
||||||
this.buildURL=buildURL;
|
|
||||||
this.downloadLink=downloadLink;
|
|
||||||
this.aktBuildNumber=aktBuildNumber;
|
|
||||||
this.buildNumber=buildNumber;
|
this.buildNumber=buildNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void run(){
|
public void run(){
|
||||||
System.out.println("check for updates ...");
|
System.out.println("check for updates ...");
|
||||||
try {
|
Platform.runLater(() -> {
|
||||||
URL url = new URL(buildURL); //URL der Datei mit aktueller Versionsnummer
|
mainWindowController.updateBtn.setText(mainWindowController.bundle.getString("checkingUpdates"));
|
||||||
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
|
});
|
||||||
aktBuildNumber = in.readLine(); //schreibt inputstream in String
|
|
||||||
in.close();
|
|
||||||
} catch (IOException e1) {
|
|
||||||
mainWindowController.showErrorMsg(mainWindowController.errorUpdateV, e1);
|
|
||||||
}
|
|
||||||
System.out.println("Build: "+buildNumber+", Update: "+aktBuildNumber);
|
|
||||||
|
|
||||||
//vergleicht die Versionsnummern, bei aktversion > version wird ein Update durchgrf<72>hrt
|
try {
|
||||||
|
URL githubApiUrl = new URL(githubApi);
|
||||||
|
BufferedReader ina = new BufferedReader(new InputStreamReader(githubApiUrl.openStream()));
|
||||||
|
apiOutput = ina.readLine();
|
||||||
|
ina.close();
|
||||||
|
} catch (IOException e1) {
|
||||||
|
Platform.runLater(() -> {
|
||||||
|
mainWindowController.showErrorMsg(mainWindowController.errorUpdateV, e1);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
JsonObject object = Json.parse(apiOutput).asObject();
|
||||||
|
JsonArray objectAssets = Json.parse(apiOutput).asObject().get("assets").asArray();
|
||||||
|
|
||||||
|
updateBuildNumber = object.getString("tag_name", "");
|
||||||
|
// updateName = object.getString("name", "");
|
||||||
|
// updateChanges = object.getString("body", "");
|
||||||
|
for (JsonValue asset : objectAssets) {
|
||||||
|
browserDownloadUrl = asset.asObject().getString("browser_download_url", "");
|
||||||
|
|
||||||
|
}
|
||||||
|
System.out.println("Build: "+buildNumber+", Update: "+updateBuildNumber);
|
||||||
|
|
||||||
|
//Compares the program BuildNumber with the current BuildNumber if program BuildNumber < current BuildNumber then perform a update
|
||||||
int iversion = Integer.parseInt(buildNumber);
|
int iversion = Integer.parseInt(buildNumber);
|
||||||
int iaktVersion = Integer.parseInt(aktBuildNumber.replace(".", ""));
|
int iaktVersion = Integer.parseInt(updateBuildNumber.replace(".", ""));
|
||||||
|
|
||||||
if(iversion >= iaktVersion){
|
if(iversion >= iaktVersion){
|
||||||
// mainWindowController.updateBtn.setText(mainWindowController.bundle.getString("updateBtnNotavail"));
|
Platform.runLater(() -> {
|
||||||
|
mainWindowController.updateBtn.setText(mainWindowController.bundle.getString("updateBtnNotavail"));
|
||||||
|
});
|
||||||
System.out.println("no update available");
|
System.out.println("no update available");
|
||||||
}else{
|
}else{
|
||||||
// mainWindowController.updateBtn.setText(mainWindowController.bundle.getString("updateBtnavail"));
|
Platform.runLater(() -> {
|
||||||
|
mainWindowController.updateBtn.setText(mainWindowController.bundle.getString("updateBtnavail"));
|
||||||
|
});
|
||||||
System.out.println("update available");
|
System.out.println("update available");
|
||||||
|
System.out.println("download link: " + browserDownloadUrl);
|
||||||
try {
|
try {
|
||||||
URL website;
|
//open new Http connection, ProgressMonitorInputStream for downloading the data
|
||||||
URL downloadURL = new URL(downloadLink);
|
HttpURLConnection conn = (HttpURLConnection) new URL(browserDownloadUrl).openConnection();
|
||||||
BufferedReader in = new BufferedReader(new InputStreamReader(downloadURL.openStream()));
|
ProgressMonitorInputStream pmis = new ProgressMonitorInputStream(null, "Downloading...", conn.getInputStream());
|
||||||
String updateDataURL = in.readLine();
|
ProgressMonitor pm = pmis.getProgressMonitor();
|
||||||
website = new URL(updateDataURL); //Update URL
|
pm.setMillisToDecideToPopup(0);
|
||||||
ReadableByteChannel rbc = Channels.newChannel(website.openStream()); //open new Stream/Channel
|
pm.setMillisToPopup(0);
|
||||||
FileOutputStream fos = new FileOutputStream("ProjectHomeFlix.jar"); //nea fileoutputstram for ProjectHomeFLix.jar
|
pm.setMinimum(0);// tell the progress bar that we start at the beginning of the stream
|
||||||
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); //gets file from 0 to max size
|
pm.setMaximum(conn.getContentLength());// tell the progress bar the total number of bytes we are going to read.
|
||||||
fos.close(); //close fos (extrem wichtig!)
|
FileUtils.copyInputStreamToFile(pmis, new File("ProjectHomeFlix_update.jar")); //download update
|
||||||
|
org.apache.commons.io.FileUtils.copyFile(new File("ProjectHomeFlix_update.jar"), new File("ProjectHomeFlix.jar")); //TODO rename update to old name
|
||||||
|
org.apache.commons.io.FileUtils.deleteQuietly(new File("ProjectHomeFlix_update.jar")); //delete update
|
||||||
Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //start again
|
Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //start again
|
||||||
System.exit(0); //finishes itself
|
System.exit(0); //finishes itself
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
//in case there is an error
|
Platform.runLater(() -> {
|
||||||
mainWindowController.showErrorMsg(mainWindowController.errorUpdateD, e);
|
mainWindowController.showErrorMsg(mainWindowController.errorUpdateD, e);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
BIN
src/libraries/commons-io-2.5.jar
Normal file
BIN
src/libraries/jfoenix-1.4.0.jar
Normal file
BIN
src/libraries/sqlite-jdbc-3.18.0.jar
Normal file
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 15 KiB |
@ -1,23 +1,35 @@
|
|||||||
# HomeFlix-Local_de_DE.properties German Local
|
#HomeFlix-Local_de_DE.properties German Local
|
||||||
|
|
||||||
|
#main window translations
|
||||||
info = Info
|
info = Info
|
||||||
settings = Einstellungen
|
settings = Einstellungen
|
||||||
streamingSettings = Stream Einst.
|
streamingSettings = Stream Einst.
|
||||||
tfPath = Pfad...
|
|
||||||
tfSearch = Suche...
|
tfSearch = Suche...
|
||||||
openFolder = Ordner \u00F6ffnen
|
openFolder = Ordner \u00F6ffnen
|
||||||
|
|
||||||
|
#settings translations
|
||||||
|
settingsHead1Label = HomeFlix Einstellungen
|
||||||
|
tfPath = Pfad...
|
||||||
chooseFolder = Ordner ausw\u00E4hlen
|
chooseFolder = Ordner ausw\u00E4hlen
|
||||||
fontSize = Schriftgr\u00F6\u00DFe:
|
mainColorLabel = Hauptfarbe:
|
||||||
|
fontsizeLabel = Schriftgr\u00F6\u00DFe:
|
||||||
|
localLabel = Sprache:
|
||||||
checkUpdates = Auf Update pr\u00FCfen
|
checkUpdates = Auf Update pr\u00FCfen
|
||||||
|
checkingUpdates = Es wird nach Updates gesucht...
|
||||||
updateBtnavail = Update verf\u00FCgbar
|
updateBtnavail = Update verf\u00FCgbar
|
||||||
updateBtnNotavail = Kein Update verf\u00FCgbar
|
updateBtnNotavail = Kein Update verf\u00FCgbar
|
||||||
autoUpdate = beim Start nach Updates suchen:
|
autoUpdateLabel = beim Start nach Updates suchen:
|
||||||
version = Version:
|
version = Version:
|
||||||
|
|
||||||
|
#column translations
|
||||||
columnName = Name
|
columnName = Name
|
||||||
columnRating = Bewertung
|
columnRating = Bewertung
|
||||||
columnStreamUrl = Datei Name
|
columnStreamUrl = Datei Name
|
||||||
columnResolution = Aufl\u00F6sung
|
columnResolution = Aufl\u00F6sung
|
||||||
columnSeason = Staffel
|
columnSeason = Staffel
|
||||||
columnYear = Jahr
|
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
|
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
|
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
|
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
|
||||||
@ -26,9 +38,10 @@ errorOpenStream = Beim \u00F6ffnen des Streams ist ein Fehler aufgetreten!
|
|||||||
errorLoad = Beim laden der Einstellungen ist ein Fehler aufgetreten!
|
errorLoad = Beim laden der Einstellungen ist ein Fehler aufgetreten!
|
||||||
errorSave = Beim speichern der Einstellungen ist ein Fehler aufgetreten!
|
errorSave = Beim speichern der Einstellungen ist ein Fehler aufgetreten!
|
||||||
noFilmFound = Kein Film mit diesem Titel gefunden!
|
noFilmFound = Kein Film mit diesem Titel gefunden!
|
||||||
linuxBug = Zurzeit werden unter Linux leider keine Dateien mit Leerzeichen unterst\u00FCtzt!
|
|
||||||
vlcNotInstalled = Um einen Film abspielen wird der VLC Media Player ben\u00F6tigt!
|
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
|
infoText = \nMaintainer: seilo@kellerkinder.xyz und \nhendrik.schutter@coptersicht.de \n(c) 2016-2017 Kellerkinder www.kellerkinder.xyz
|
||||||
|
|
||||||
|
#textFlow translations
|
||||||
title = Titel
|
title = Titel
|
||||||
year = Jahr
|
year = Jahr
|
||||||
rating = Einstufung
|
rating = Einstufung
|
||||||
@ -45,5 +58,6 @@ awards = Auszeichnungen
|
|||||||
metascore = Metascore
|
metascore = Metascore
|
||||||
imdbRating = IMDB-Bewertung
|
imdbRating = IMDB-Bewertung
|
||||||
type = Type
|
type = Type
|
||||||
|
|
||||||
firstStartHeader = Es ist kein Stammverzeichnis f\u00FCr Filme angegeben!
|
firstStartHeader = Es ist kein Stammverzeichnis f\u00FCr Filme angegeben!
|
||||||
firstStartContent = Stammverzeichniss angeben?
|
firstStartContent = Stammverzeichniss angeben?
|
@ -1,23 +1,35 @@
|
|||||||
# HomeFlix-Local_en_US.properties US-English Local and default
|
#HomeFlix-Local_en_US.properties US-English Local and default
|
||||||
|
|
||||||
|
#main window translations
|
||||||
info = Info
|
info = Info
|
||||||
settings = Settings
|
settings = Settings
|
||||||
streamingSettings = Stream Settings
|
streamingSettings = Stream Settings
|
||||||
tfPath = Path...
|
|
||||||
tfSearch = Search...
|
tfSearch = Search...
|
||||||
openFolder = open Folder
|
openFolder = open Folder
|
||||||
|
|
||||||
|
#settings translations
|
||||||
|
settingsHead1Label = HomeFlix Settings
|
||||||
|
tfPath = Path...
|
||||||
chooseFolder = choose Directory
|
chooseFolder = choose Directory
|
||||||
fontSize = font size:
|
mainColorLabel = main color:
|
||||||
|
fontsizeLabel = font size:
|
||||||
|
localLabel = local:
|
||||||
checkUpdates = check for updates
|
checkUpdates = check for updates
|
||||||
|
checkingUpdates = checking for updates...
|
||||||
updateBtnavail = update available
|
updateBtnavail = update available
|
||||||
updateBtnNotavail = no update available
|
updateBtnNotavail = no update available
|
||||||
autoUpdate = check at startup for updates:
|
autoUpdateLabel = check at startup for updates:
|
||||||
version = Version:
|
version = Version:
|
||||||
|
|
||||||
|
#column translations
|
||||||
columnName = Name
|
columnName = Name
|
||||||
columnRating = Rating
|
columnRating = Rating
|
||||||
columnStreamUrl = File Name
|
columnStreamUrl = File Name
|
||||||
columnResolution = Resolution
|
columnResolution = Resolution
|
||||||
columnSeason = Season
|
columnSeason = Season
|
||||||
columnYear = Year
|
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
|
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
|
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
|
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
|
||||||
@ -26,9 +38,10 @@ errorOpenStream = An error has occurred during opening the stream!
|
|||||||
errorLoad = An error occurred while loading the settings!
|
errorLoad = An error occurred while loading the settings!
|
||||||
errorSave = An error occurred while saving the settings!
|
errorSave = An error occurred while saving the settings!
|
||||||
noFilmFound = No film with this title found!
|
noFilmFound = No film with this title found!
|
||||||
linuxBug = Currently no files are supported with additional space under Linux unfortunately!
|
|
||||||
vlcNotInstalled = VLC Media Player is required to play a movie!
|
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
|
infoText = \nMaintainer: seilo@kellerkinder.xyz and \nhendrik.schutter@coptersicht.de \n(c) 2016-2017 Kellerkinder www.kellerkinder.xyz
|
||||||
|
|
||||||
|
#textFlow translations
|
||||||
title = Title
|
title = Title
|
||||||
year = Year
|
year = Year
|
||||||
rating = Rating
|
rating = Rating
|
||||||
@ -45,5 +58,6 @@ awards = Awards
|
|||||||
metascore = Metascore
|
metascore = Metascore
|
||||||
imdbRating = IMDB-Rating
|
imdbRating = IMDB-Rating
|
||||||
type = Type
|
type = Type
|
||||||
|
|
||||||
firstStartHeader = There is no root directory for movies!
|
firstStartHeader = There is no root directory for movies!
|
||||||
firstStartContent = Specify a root directory?
|
firstStartContent = Specify a root directory?
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.3 KiB |
Before Width: | Height: | Size: 214 B After Width: | Height: | Size: 214 B |
Before Width: | Height: | Size: 261 B After Width: | Height: | Size: 261 B |
Before Width: | Height: | Size: 131 B After Width: | Height: | Size: 131 B |
Before Width: | Height: | Size: 135 B After Width: | Height: | Size: 135 B |
Before Width: | Height: | Size: 215 B After Width: | Height: | Size: 215 B |
Before Width: | Height: | Size: 128 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 134 B After Width: | Height: | Size: 134 B |
Before Width: | Height: | Size: 131 B After Width: | Height: | Size: 131 B |
Before Width: | Height: | Size: 138 B After Width: | Height: | Size: 138 B |
@ -1 +1 @@
|
|||||||
117
|
127
|
||||||
|