Browse Source

Merge pull request #16 from Seil0/dev

release 129/0.5.2 "solidify cow"
pull/25/head
Jannik 5 years ago committed by GitHub
parent
commit
865e732445
  1. 2
      .classpath
  2. 2
      README.md
  3. 1
      bin/.gitignore
  4. BIN
      bin/application/DBController.class
  5. BIN
      bin/application/Main.class
  6. 39
      bin/application/MainWindow.fxml
  7. BIN
      bin/application/MainWindowController$1.class
  8. BIN
      bin/application/MainWindowController$2.class
  9. BIN
      bin/application/MainWindowController$3.class
  10. BIN
      bin/application/MainWindowController$4.class
  11. BIN
      bin/application/MainWindowController$5.class
  12. BIN
      bin/application/MainWindowController$6.class
  13. BIN
      bin/application/MainWindowController$7.class
  14. BIN
      bin/application/MainWindowController.class
  15. BIN
      bin/application/apiQuery.class
  16. 1
      bin/application/application.css
  17. BIN
      bin/recources/icons/menu_icon_black.png
  18. BIN
      bin/recources/icons/menu_icon_white.png
  19. 23
      bin/resources/HomeFlix-Local_de_DE.properties
  20. 25
      bin/resources/HomeFlix-Local_en_US.properties
  21. 0
      bin/resources/Homeflix_Icon_64x64.png
  22. 0
      bin/resources/Homeflix_Poster.png
  23. 0
      bin/resources/icons/close_black_2048x2048.png
  24. 0
      bin/resources/icons/ic_favorite_black_18dp_1x.png
  25. 0
      bin/resources/icons/ic_favorite_border_black_18dp_1x.png
  26. 0
      bin/resources/icons/ic_play_arrow_black_18dp_1x.png
  27. 0
      bin/resources/icons/ic_play_arrow_white_18dp_1x.png
  28. 0
      bin/resources/icons/ic_search_black_18dp_1x.png
  29. 0
      bin/resources/icons/ic_skip_next_black_18dp_1x.png
  30. 0
      bin/resources/icons/ic_skip_next_white_18dp_1x.png
  31. 0
      bin/resources/icons/ic_skip_previous_black_18dp_1x.png
  32. 0
      bin/resources/icons/ic_skip_previous_white_18dp_1x.png
  33. 124
      src/application/DBController.java
  34. 17
      src/application/Main.java
  35. 4
      src/application/MainWindow.css
  36. 39
      src/application/MainWindow.fxml
  37. 140
      src/application/MainWindowController.java
  38. 14
      src/application/apiQuery.java
  39. 1
      src/application/application.css
  40. BIN
      src/recources/icons/menu_icon_black.png
  41. BIN
      src/recources/icons/menu_icon_white.png
  42. 23
      src/resources/HomeFlix-Local_de_DE.properties
  43. 25
      src/resources/HomeFlix-Local_en_US.properties
  44. 0
      src/resources/Homeflix_Icon_64x64.png
  45. 0
      src/resources/Homeflix_Poster.png
  46. 0
      src/resources/icons/close_black_2048x2048.png
  47. 0
      src/resources/icons/ic_favorite_black_18dp_1x.png
  48. 0
      src/resources/icons/ic_favorite_border_black_18dp_1x.png
  49. 0
      src/resources/icons/ic_play_arrow_black_18dp_1x.png
  50. 0
      src/resources/icons/ic_play_arrow_white_18dp_1x.png
  51. 0
      src/resources/icons/ic_search_black_18dp_1x.png
  52. 0
      src/resources/icons/ic_skip_next_black_18dp_1x.png
  53. 0
      src/resources/icons/ic_skip_next_white_18dp_1x.png
  54. 0
      src/resources/icons/ic_skip_previous_black_18dp_1x.png
  55. 0
      src/resources/icons/ic_skip_previous_white_18dp_1x.png

2
.classpath

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<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="lib" path="src/libraries/minimal-json-0.9.4.jar"/>
<classpathentry kind="lib" path="src/libraries/commons-io-2.5.jar"/>

2
README.md

@ -4,6 +4,8 @@
Project HomeFlix is a Kellerkinder Project, that alowes you to sort all your local saved movies in clean UI.
The dev branch is **only merged** into master when a **new release** is released, so **master contains the latest released version**. Please commit all changes to [dev](https://github.com/Seil0/Project-HomeFlix/tree/dev).
**Due to some changes with the API we use(not provided by us), the query does not work at the moment!**
Librarys used in this Project:
JFoenix: https://github.com/jfoenixadmin/JFoenix
minimal-json: https://github.com/ralfstx/minimal-json

1
bin/.gitignore vendored

@ -1,2 +1 @@
/application/
/libraries/

BIN
bin/application/DBController.class

Binary file not shown.

BIN
bin/application/Main.class

Binary file not shown.

39
bin/application/MainWindow.fxml

@ -2,9 +2,11 @@
<?import com.jfoenix.controls.JFXButton?>
<?import com.jfoenix.controls.JFXColorPicker?>
<?import com.jfoenix.controls.JFXHamburger?>
<?import com.jfoenix.controls.JFXSlider?>
<?import com.jfoenix.controls.JFXTextField?>
<?import com.jfoenix.controls.JFXToggleButton?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.ChoiceBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ScrollPane?>
@ -40,16 +42,20 @@
</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">
<image>
<Image url="@../recources/Homeflix_Poster.png" />
<Image url="@../resources/Homeflix_Poster.png" />
</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="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">
<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>
</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>
<JFXButton fx:id="infoBtn" onAction="#infoBtnclicked" prefHeight="32.0" prefWidth="150.0" textAlignment="CENTER">
<font>
@ -86,16 +92,23 @@
</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">
<children>
<JFXTextField fx:id="tfPath" layoutX="14.0" layoutY="14.0" onAction="#tfPathAction" prefWidth="250.0" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="5.0" />
<JFXButton fx:id="directoryBtn" layoutX="255.0" layoutY="8.0" onAction="#directoryBtnAction" prefHeight="25.0" AnchorPane.leftAnchor="260.0" />
<JFXColorPicker fx:id="mainColor" layoutX="14.0" layoutY="45.0" onAction="#mainColorAction" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="40.0" />
<Label fx:id="sizelbl" layoutY="73.0" text="Label" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="75.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" />
<ChoiceBox fx:id="cbLocal" layoutX="14.0" layoutY="131.0" prefWidth="150.0" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="145.0" />
<JFXButton fx:id="updateBtn" layoutX="7.0" layoutY="177.0" onAction="#updateBtnAction" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="180.0" />
<Label fx:id="aulbl" layoutX="43.0" layoutY="219.0" text="Label" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="215.0" />
<JFXToggleButton fx:id="autoupdateBtn" layoutX="19.0" layoutY="215.0" onAction="#autoupdateBtnAction" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="230.0" />
<Label fx:id="versionlbl" layoutX="29.0" layoutY="297.0" text="Label" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="280.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="276.0" layoutY="82.0" onAction="#directoryBtnAction" prefHeight="25.0" AnchorPane.leftAnchor="269.0" AnchorPane.topAnchor="82.0" />
<JFXColorPicker fx:id="mainColor" layoutX="118.0" layoutY="130.0" onAction="#mainColorAction" AnchorPane.leftAnchor="118.0" AnchorPane.topAnchor="130.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="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="118.0" layoutY="208.0" prefWidth="150.0" AnchorPane.leftAnchor="118.0" AnchorPane.topAnchor="208.0" />
<JFXButton fx:id="updateBtn" layoutX="16.0" layoutY="269.0" onAction="#updateBtnAction" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="253.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="14.0" layoutY="336.0" onAction="#autoupdateBtnAction" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="320.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>
</AnchorPane>
</children>

BIN
bin/application/MainWindowController$1.class

Binary file not shown.

BIN
bin/application/MainWindowController$2.class

Binary file not shown.

BIN
bin/application/MainWindowController$3.class

Binary file not shown.

BIN
bin/application/MainWindowController$4.class

Binary file not shown.

BIN
bin/application/MainWindowController$5.class

Binary file not shown.

BIN
bin/application/MainWindowController$6.class

Binary file not shown.

BIN
bin/application/MainWindowController$7.class

Binary file not shown.

BIN
bin/application/MainWindowController.class

Binary file not shown.

BIN
bin/application/apiQuery.class

Binary file not shown.

1
bin/application/application.css

@ -1 +0,0 @@
/* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */

BIN
bin/recources/icons/menu_icon_black.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

BIN
bin/recources/icons/menu_icon_white.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

23
src/recources/HomeFlix-Local_de_DE.properties → bin/resources/HomeFlix-Local_de_DE.properties

@ -1,24 +1,35 @@
# HomeFlix-Local_de_DE.properties German Local
#HomeFlix-Local_de_DE.properties German Local
#main window translations
info = Info
settings = Einstellungen
streamingSettings = Stream Einst.
tfPath = Pfad...
tfSearch = Suche...
openFolder = Ordner \u00F6ffnen
#settings translations
settingsHead1Label = HomeFlix Einstellungen
tfPath = Pfad...
chooseFolder = Ordner ausw\u00E4hlen
fontSize = Schriftgr\u00F6\u00DFe:
mainColorLabel = Hauptfarbe:
fontsizeLabel = Schriftgr\u00F6\u00DFe:
localLabel = Sprache:
checkUpdates = Auf Update pr\u00FCfen
checkingUpdates = Es wird nach Updates gesucht...
updateBtnavail = Update verf\u00FCgbar
updateBtnNotavail = Kein Update verf\u00FCgbar
autoUpdate = beim Start nach Updates suchen:
autoUpdateLabel = beim Start nach Updates suchen:
version = Version:
#column translations
columnName = Name
columnRating = Bewertung
columnStreamUrl = Datei Name
columnResolution = Aufl\u00F6sung
columnSeason = Staffel
columnYear = Jahr
#error translations
errorUpdateV = Beim ausf\u00FChren des Updates ist ein Fehler aufgetreten! \nError: could not check update version (nvc)\nWeitere Hilfe erhalten sie unter www.kellerkinder.xyz \noder wenden sie sich an support@kellerkinder.xyz
errorUpdateD = Beim ausf\u00FChren des Updates ist ein Fehler aufgetreten! \nError: could not download update files (ndf)\nWeitere Hilfe erhalten sie unter www.kellerkinder.xyz \noder wenden sie sich an support@kellerkinder.xyz
errorPlay = Beim \u00F6ffnen der Datei ist ein Fehler aufgetreten! \nError: could not open file (nof) \nWeitere Hilfe erhalten sie unter www.kellerkinder.xyz \noder wenden sie sich an support@kellerkinder.xyz
@ -27,9 +38,10 @@ errorOpenStream = Beim \u00F6ffnen des Streams ist ein Fehler aufgetreten!
errorLoad = Beim laden der Einstellungen ist ein Fehler aufgetreten!
errorSave = Beim speichern der Einstellungen ist ein Fehler aufgetreten!
noFilmFound = Kein Film mit diesem Titel gefunden!
linuxBug = Zurzeit werden unter Linux leider keine Dateien mit Leerzeichen unterst\u00FCtzt!
vlcNotInstalled = Um einen Film abspielen wird der VLC Media Player ben\u00F6tigt!
infoText = \nMaintainer: seilo@kellerkinder.xyz und \nhendrik.schutter@coptersicht.de \n(c) 2016-2017 Kellerkinder www.kellerkinder.xyz
#textFlow translations
title = Titel
year = Jahr
rating = Einstufung
@ -46,5 +58,6 @@ awards = Auszeichnungen
metascore = Metascore
imdbRating = IMDB-Bewertung
type = Type
firstStartHeader = Es ist kein Stammverzeichnis f\u00FCr Filme angegeben!
firstStartContent = Stammverzeichniss angeben?

25
bin/recources/HomeFlix-Local_en_US.properties → bin/resources/HomeFlix-Local_en_US.properties

@ -1,24 +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
settings = Settings
streamingSettings = Stream Settings
tfPath = Path...
tfSearch = Search...
openFolder = open Folder
#settings translations
settingsHead1Label = HomeFlix Settings
tfPath = Path...
chooseFolder = choose Directory
fontSize = font size:
mainColorLabel = main color:
fontsizeLabel = font size:
localLabel = local:
checkUpdates = check for updates
checkingUpdates = checking for updates...
updateBtnavail = update available
updateBtnNotavail = no update available
autoUpdate = check at startup for updates:
autoUpdateLabel = check at startup for updates:
version = Version:
#column translations
columnName = Name
columnRating = Rating
columnStreamUrl = File Name
columnResolution = Resolution
columnSeason = Season
columnYear = Year
#error translations
errorUpdateV = An error has occurred during update! \nError: could not check update version (nvc) \nTo get help, visit www.kellerkinder.xyz \nor contcat support@kellerkinder.xyz
errorUpdateD = An error has occurred during update! \nError: could not download update files (ndf) \nTo get help, visit www.kellerkinder.xyz \nor contcat support@kellerkinder.xyz
errorPlay = An error has occurred during opening the file! \nError: could not open file (nof) \nTo get help, visit www.kellerkinder.xyz \nor contcat support@kellerkinder.xyz
@ -27,9 +38,10 @@ errorOpenStream = An error has occurred during opening the stream!
errorLoad = An error occurred while loading the settings!
errorSave = An error occurred while saving the settings!
noFilmFound = No film with this title found!
linuxBug = Currently no files are supported with additional space under Linux unfortunately!
vlcNotInstalled = VLC Media Player is required to play a movie!
infoText = \nMaintainer: seilo@kellerkinder.xyz and \nhendrik.schutter@coptersicht.de \n(c) 2016-2017 Kellerkinder www.kellerkinder.xyz
#textFlow translations
title = Title
year = Year
rating = Rating
@ -46,5 +58,6 @@ awards = Awards
metascore = Metascore
imdbRating = IMDB-Rating
type = Type
firstStartHeader = There is no root directory for movies!
firstStartContent = Specify a root directory?
firstStartContent = Specify a root directory?

0
bin/recources/Homeflix_Icon_64x64.png → bin/resources/Homeflix_Icon_64x64.png

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

0
bin/recources/Homeflix_Poster.png → bin/resources/Homeflix_Poster.png

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

0
bin/recources/icons/close_black_2048x2048.png → bin/resources/icons/close_black_2048x2048.png

Before

Width:  |  Height:  |  Size: 9.3 KiB

After

Width:  |  Height:  |  Size: 9.3 KiB

0
bin/recources/icons/ic_favorite_black_18dp_1x.png → bin/resources/icons/ic_favorite_black_18dp_1x.png

Before

Width:  |  Height:  |  Size: 214 B

After

Width:  |  Height:  |  Size: 214 B

0
bin/recources/icons/ic_favorite_border_black_18dp_1x.png → bin/resources/icons/ic_favorite_border_black_18dp_1x.png

Before

Width:  |  Height:  |  Size: 261 B

After

Width:  |  Height:  |  Size: 261 B

0
bin/recources/icons/ic_play_arrow_black_18dp_1x.png → bin/resources/icons/ic_play_arrow_black_18dp_1x.png

Before

Width:  |  Height:  |  Size: 131 B

After

Width:  |  Height:  |  Size: 131 B

0
bin/recources/icons/ic_play_arrow_white_18dp_1x.png → bin/resources/icons/ic_play_arrow_white_18dp_1x.png

Before

Width:  |  Height:  |  Size: 135 B

After

Width:  |  Height:  |  Size: 135 B

0
bin/recources/icons/ic_search_black_18dp_1x.png → bin/resources/icons/ic_search_black_18dp_1x.png

Before

Width:  |  Height:  |  Size: 215 B

After

Width:  |  Height:  |  Size: 215 B

0
bin/recources/icons/ic_skip_next_black_18dp_1x.png → bin/resources/icons/ic_skip_next_black_18dp_1x.png

Before

Width:  |  Height:  |  Size: 128 B

After

Width:  |  Height:  |  Size: 128 B

0
bin/recources/icons/ic_skip_next_white_18dp_1x.png → bin/resources/icons/ic_skip_next_white_18dp_1x.png

Before

Width:  |  Height:  |  Size: 134 B

After

Width:  |  Height:  |  Size: 134 B

0
bin/recources/icons/ic_skip_previous_black_18dp_1x.png → bin/resources/icons/ic_skip_previous_black_18dp_1x.png

Before

Width:  |  Height:  |  Size: 131 B

After

Width:  |  Height:  |  Size: 131 B

0
bin/recources/icons/ic_skip_previous_white_18dp_1x.png → bin/resources/icons/ic_skip_previous_white_18dp_1x.png

Before

Width:  |  Height:  |  Size: 138 B

After

Width:  |  Height:  |  Size: 138 B

124
src/application/DBController.java

@ -39,8 +39,8 @@ public class DBController {
private MainWindowController mainWindowController;
private Main main;
private String DB_PATH = System.getProperty("user.home") + "\\Documents\\HomeFlix" + "\\" + "Homeflix.db"; //path to database file
private Image favorite_black = new Image("recources/icons/ic_favorite_black_18dp_1x.png");
private Image favorite_border_black = new Image("recources/icons/ic_favorite_border_black_18dp_1x.png");
private Image favorite_black = new Image("resources/icons/ic_favorite_black_18dp_1x.png");
private Image favorite_border_black = new Image("resources/icons/ic_favorite_border_black_18dp_1x.png");
private List<String> filmsdbAll = new ArrayList<String>();
private List<String> filmsdbLocal = new ArrayList<String>();
private List<String> filmsdbStream = new ArrayList<String>();
@ -115,16 +115,20 @@ public class DBController {
ea.printStackTrace();
}
//getting all files from the selected directory TODO rework
String[] entries = new File(mainWindowController.getPath()).list();
if(mainWindowController.getPath().equals("") || mainWindowController.getPath() == null){
if(mainWindowController.getPath().equals("") || mainWindowController.getPath() == null){
System.out.println("Kein Pfad angegeben"); //if path == null or ""
}else{
}else if(new File(mainWindowController.getPath()).exists()) {
System.out.println(entries.length);
for(int i=0;i!=entries.length;i++){
filmsDir.add(cutOffEnd(entries[i]));
}
} else {
System.out.println(mainWindowController.getPath() + "dosen't exist!");
}
//getting all entries from the streaming lists
for(int v=0; v< mainWindowController.streamingData.size(); v++){
String fileName = mainWindowController.getStreamingPath()+"/"+mainWindowController.streamingData.get(v).getStreamUrl();
try {
@ -138,7 +142,9 @@ public class DBController {
} catch (IOException e) {
e.printStackTrace();
}
}
}
//add all entries to filmsAll and filmsdbAl, for later comparing
filmsAll.addAll(filmsDir);
filmsAll.addAll(filmsStream);
filmsdbAll.addAll(filmsdbLocal);
@ -146,6 +152,11 @@ public class DBController {
System.out.println("films in directory: "+filmsAll.size());
System.out.println("filme in db: "+filmsdbAll.size());
/**
* if filmsdbAll.size() == 0 database is empty, we need to fill it
* else check if there is something to remove or to add
* TODO separate local and streaming for better error handling
*/
if(filmsdbAll.size() == 0){
System.out.println("creating entries ...");
@ -155,7 +166,7 @@ public class DBController {
if(mainWindowController.getPath().equals("") || mainWindowController.getPath() == null){
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
{
ps.setInt(1, 0); //rating as integer 1. column
@ -198,12 +209,10 @@ public class DBController {
ps.close();
psS.close();
}catch (SQLException ea) {
System.err.println("Konnte nicht ausgeführt werden");
System.err.println("Ups! an error occured!");
ea.printStackTrace();
}
}else {
try {
try {
checkAddEntry(); //check if added a new file
@ -271,7 +280,7 @@ public class DBController {
try {
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")){
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{
@ -282,7 +291,7 @@ public class DBController {
} catch (SQLException e) {
try {
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")){
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{
@ -305,25 +314,30 @@ public class DBController {
Statement stmt = connection.createStatement();
for(int a=0; a<filmsdbLocal.size(); a++){
if(filmsDir.contains(filmsdbLocal.get(a))){
}else{
stmt.executeUpdate("delete from film_local where titel = '"+filmsdbLocal.get(a)+"'");
connection.commit();
stmt.close();
System.out.println("removed \""+filmsdbLocal.get(a)+"\" from databsae");
if(!filmsDir.contains(filmsdbLocal.get(a))){
try {
stmt.executeUpdate("delete from film_local where titel = \""+filmsdbLocal.get(a) + "\"");
connection.commit();
stmt.close();
System.out.println("removed \""+filmsdbLocal.get(a)+"\" from databsae");
} catch (Exception e) {
e.printStackTrace();
}
}
}
for(int b=0; b<filmsdbStreamURL.size(); b++){
if(filmsStreamURL.contains(filmsdbStreamURL.get(b))){
}else{
stmt.executeUpdate("delete from film_streaming where titel = '"+filmsdbStream.get(b)+"'");
connection.commit();
stmt.close();
System.out.println("removed \""+filmsdbStream.get(b)+"\" from databsae");
if(!filmsStreamURL.contains(filmsdbStreamURL.get(b))){
try {
stmt.executeUpdate("delete from film_streaming where titel = \"" + filmsdbStream.get(b) + "\"");
connection.commit();
stmt.close();
System.out.println("removed \""+filmsdbStream.get(b)+"\" from databsae");
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
/**
@ -342,9 +356,8 @@ public class DBController {
int i=0;
for(int a=0; a<filmsDir.size(); 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)");
if(!filmsdbLocal.contains(filmsDir.get(a))){
stmt.executeUpdate("insert into film_local values (0, \""+cutOffEnd(entries[a])+"\", \""+entries[a]+"\",\"favorite_border_black\",0)");
connection.commit();
stmt.close();
System.out.println("added \""+filmsDir.get(a)+"\" to databsae");
@ -361,23 +374,23 @@ public class DBController {
JsonObject object = Json.parse(new FileReader(filmsStreamData.get(b))).asObject();
JsonArray items = object.get("entries").asArray();
System.out.println(items.size()+", "+i+"; "+b);
String streamURL = items.get(i).asObject().getString("streamUrl","");
String titel = items.get(i).asObject().getString("titel","");
String streamURL = items.get(i).asObject().getString("streamUrl","");
String titel = items.get(i).asObject().getString("titel","");
if(streamURL.equals(filmsStreamURL.get(b))){
System.out.println("added \""+titel+"\"");
if(streamURL.equals(filmsStreamURL.get(b))){
System.out.println("hinzufügen \""+titel+"\"");
ps.setInt(1, items.get(i).asObject().getInt("year", 0));
ps.setInt(2, items.get(i).asObject().getInt("season", 0));
ps.setInt(3, items.get(i).asObject().getInt("episode", 0));
ps.setInt(4, 0);
ps.setString(5, items.get(i).asObject().getString("resolution", ""));
ps.setString(6, items.get(i).asObject().getString("titel",""));
ps.setString(7, items.get(i).asObject().getString("streamUrl", ""));
ps.setString(8, "favorite_border_black");
ps.setBoolean(9, false);
ps.addBatch(); // adds the entry
}
ps.setInt(1, items.get(i).asObject().getInt("year", 0));
ps.setInt(2, items.get(i).asObject().getInt("season", 0));
ps.setInt(3, items.get(i).asObject().getInt("episode", 0));
ps.setInt(4, 0);
ps.setString(5, items.get(i).asObject().getString("resolution", ""));
ps.setString(6, items.get(i).asObject().getString("titel",""));
ps.setString(7, items.get(i).asObject().getString("streamUrl", ""));
ps.setString(8, "favorite_border_black");
ps.setBoolean(9, false);
ps.addBatch(); // adds the entry
}
i++;
}
}
@ -428,14 +441,14 @@ public class DBController {
void getFavStatus(String name){
try{
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"));
stmt.close();
rs.close();
}catch(SQLException e){
try {
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"));
stmtS.close();
rsS.close();
@ -451,7 +464,7 @@ public class DBController {
System.out.println("defavorisieren ...");
try{
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();
stmt.close();
}catch(SQLException e){
@ -460,7 +473,7 @@ public class DBController {
}
try {
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();
stmt.close();
} catch (SQLException e1) {
@ -473,7 +486,7 @@ public class DBController {
System.out.println("favorisieren ...");
try{
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();
stmt.close();
}catch(SQLException e){
@ -482,7 +495,7 @@ public class DBController {
}
try {
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();
stmt.close();
} catch (SQLException e1) {
@ -494,7 +507,7 @@ 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+"';");
stmt.executeUpdate("UPDATE film_local SET cached=1 WHERE streamUrl=\""+streamUrl+"\";");
connection.commit();
stmt.close();
}catch(SQLException e){
@ -503,7 +516,7 @@ public class DBController {
}
try {
Statement stmt = connection.createStatement();
stmt.executeUpdate("UPDATE film_streaming SET cached=1 WHERE streamUrl='"+streamUrl+"';");
stmt.executeUpdate("UPDATE film_streaming SET cached=1 WHERE streamUrl=\""+streamUrl+"\";");
connection.commit();
stmt.close();
} catch (SQLException e1) {
@ -549,7 +562,7 @@ public class DBController {
void readCache(String streamUrl){
try{
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM cache WHERE streamUrl='"+streamUrl+"';");
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();
@ -598,7 +611,7 @@ public class DBController {
try{
mainWindowController.image1.setImage(im);
}catch (Exception e){
mainWindowController.image1.setImage(new Image("recources/icons/close_black_2048x2048.png"));
mainWindowController.image1.setImage(new Image("resources/icons/close_black_2048x2048.png"));
e.printStackTrace();
}
mainWindowController.image1.setImage(im);
@ -619,4 +632,3 @@ public class DBController {
}
}

17
src/application/Main.java

@ -27,7 +27,6 @@ import java.io.IOException;
import java.util.Locale;
import java.util.Optional;
import java.util.ResourceBundle;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
@ -43,7 +42,7 @@ public class Main extends Application {
Stage primaryStage;
private String path;
String currentWorkingDirectory;
String currentWorkingDirectory;
private String COLOR = "ee3523";
private String FONT_FAMILY = "System";
private String mode = "local"; //local or streaming TODO
@ -61,12 +60,12 @@ public class Main extends Application {
@Override
public void start(Stage primaryStage) throws IOException {
currentWorkingDirectory = new java.io.File( "." ).getCanonicalPath();
this.primaryStage = primaryStage;
this.primaryStage = primaryStage;
mainWindow();
}
private void mainWindow(){
try {
FXMLLoader loader = new FXMLLoader(Main.class.getResource("MainWindow.fxml"));
AnchorPane pane = loader.load();
@ -74,7 +73,7 @@ public class Main extends Application {
primaryStage.setMinWidth(900.00);
primaryStage.setResizable(false);
primaryStage.setTitle("Project HomeFlix");
primaryStage.getIcons().add(new Image(Main.class.getResourceAsStream("/recources/Homeflix_Icon_64x64.png"))); //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.setAutoUpdate(AUTO_UPDATE); //set auto-update
@ -129,7 +128,7 @@ public class Main extends Application {
mainWindowController.addDataUI();
Scene scene = new Scene(pane); //create new scene, append pane to scene
scene.getStylesheets().add(Main.class.getResource("MainWindow.css").toExternalForm());
primaryStage.setScene(scene); //append scene to stage
primaryStage.show(); //show stage
} catch (IOException e) {
@ -141,11 +140,11 @@ public class Main extends Application {
private String firstStart(){
MainWindowController.firststart = true;
switch(System.getProperty("user.language")+"_"+System.getProperty("user.country")){
case "en_US": bundle = ResourceBundle.getBundle("recources.HomeFlix-Local", Locale.US); //us_english
case "en_US": bundle = ResourceBundle.getBundle("resources.HomeFlix-Local", Locale.US); //us_english
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;
default: bundle = ResourceBundle.getBundle("recources.HomeFlix-Local", Locale.US); //default local
default: bundle = ResourceBundle.getBundle("resources.HomeFlix-Local", Locale.US); //default local
break;
}

4
src/application/MainWindow.css

@ -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; }

39
src/application/MainWindow.fxml

@ -2,9 +2,11 @@
<?import com.jfoenix.controls.JFXButton?>
<?import com.jfoenix.controls.JFXColorPicker?>
<?import com.jfoenix.controls.JFXHamburger?>
<?import com.jfoenix.controls.JFXSlider?>
<?import com.jfoenix.controls.JFXTextField?>
<?import com.jfoenix.controls.JFXToggleButton?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.ChoiceBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ScrollPane?>
@ -40,16 +42,20 @@
</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">
<image>
<Image url="@../recources/Homeflix_Poster.png" />
<Image url="@../resources/Homeflix_Poster.png" />
</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="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">
<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>
</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>
<JFXButton fx:id="infoBtn" onAction="#infoBtnclicked" prefHeight="32.0" prefWidth="150.0" textAlignment="CENTER">
<font>
@ -86,16 +92,23 @@
</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">
<children>
<JFXTextField fx:id="tfPath" layoutX="14.0" layoutY="14.0" onAction="#tfPathAction" prefWidth="250.0" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="5.0" />
<JFXButton fx:id="directoryBtn" layoutX="255.0" layoutY="8.0" onAction="#directoryBtnAction" prefHeight="25.0" AnchorPane.leftAnchor="260.0" />
<JFXColorPicker fx:id="mainColor" layoutX="14.0" layoutY="45.0" onAction="#mainColorAction" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="40.0" />
<Label fx:id="sizelbl" layoutY="73.0" text="Label" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="75.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" />
<ChoiceBox fx:id="cbLocal" layoutX="14.0" layoutY="131.0" prefWidth="150.0" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="145.0" />
<JFXButton fx:id="updateBtn" layoutX="7.0" layoutY="177.0" onAction="#updateBtnAction" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="180.0" />
<Label fx:id="aulbl" layoutX="43.0" layoutY="219.0" text="Label" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="215.0" />
<JFXToggleButton fx:id="autoupdateBtn" layoutX="19.0" layoutY="215.0" onAction="#autoupdateBtnAction" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="230.0" />
<Label fx:id="versionlbl" layoutX="29.0" layoutY="297.0" text="Label" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="280.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="276.0" layoutY="82.0" onAction="#directoryBtnAction" prefHeight="25.0" AnchorPane.leftAnchor="269.0" AnchorPane.topAnchor="82.0" />
<JFXColorPicker fx:id="mainColor" layoutX="118.0" layoutY="130.0" onAction="#mainColorAction" AnchorPane.leftAnchor="118.0" AnchorPane.topAnchor="130.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="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="118.0" layoutY="208.0" prefWidth="150.0" AnchorPane.leftAnchor="118.0" AnchorPane.topAnchor="208.0" />
<JFXButton fx:id="updateBtn" layoutX="16.0" layoutY="269.0" onAction="#updateBtnAction" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="253.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="14.0" layoutY="336.0" onAction="#autoupdateBtnAction" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="320.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>
</AnchorPane>
</children>

140
src/application/MainWindowController.java

@ -42,9 +42,11 @@ import java.util.Properties;
import java.util.ResourceBundle;
import com.jfoenix.controls.JFXButton;
import com.jfoenix.controls.JFXColorPicker;
import com.jfoenix.controls.JFXHamburger;
import com.jfoenix.controls.JFXSlider;
import com.jfoenix.controls.JFXTextField;
import com.jfoenix.controls.JFXToggleButton;
import com.jfoenix.transitions.hamburger.HamburgerBackArrowBasicTransition;
import javafx.animation.FadeTransition;
import javafx.animation.ParallelTransition;
@ -72,6 +74,7 @@ import javafx.scene.control.TreeTableColumn.SortType;
import javafx.scene.control.TreeTableView;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
@ -103,8 +106,6 @@ public class MainWindowController {
@FXML
ScrollPane scrollPane;
@FXML
private JFXButton menubtn; //TODO switch to hamburger menu
@FXML
private JFXButton playbtn;
@FXML
private JFXButton openfolderbtn;
@ -129,6 +130,8 @@ public class MainWindowController {
@FXML
private JFXButton streamingDirectoryBtn;
@FXML
private JFXHamburger menuHam;
@FXML
private JFXToggleButton autoupdateBtn;
@FXML
public JFXTextField tfPath;
@ -143,13 +146,20 @@ public class MainWindowController {
@FXML
public JFXSlider sliderFontSize;
@FXML
private Label versionlbl;
private Label versionLabel;
@FXML
private Label fontsizeLabel;
@FXML
private Label autoUpdateLabel;
@FXML
private Label settingsHead1Label;
@FXML
private Label sizelbl;
private Label mainColorLabel;
@FXML
private Label aulbl;
private Label localLabel;
@FXML
ImageView image1;
private ImageView imv1;
@FXML
@ -176,15 +186,15 @@ public class MainWindowController {
@FXML
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 settingstrue = false;
private boolean menuTrue = false; //saves the position of menuBtn (opened or closed)
private boolean settingsTrue = false;
private boolean streamingSettingsTrue = false;
private boolean autoUpdate = false;
static boolean firststart = false;
private int hashA = -2055934614;
private String version = "0.5.1";
private String buildNumber = "127";
private String versionName = "plasma cow";
private String version = "0.5.2";
private String buildNumber = "129";
private String versionName = "solidify cow";
private File dirWin = new File(System.getProperty("user.home") + "/Documents/HomeFlix");
private File dirLinux = new File(System.getProperty("user.home") + "/HomeFlix");
private File fileWin = new File(dirWin + "/config.xml");
@ -199,7 +209,6 @@ public class MainWindowController {
private String errorLoad;
private String errorSave;
private String infoText;
private String linuxBugText;
private String vlcNotInstalled;
private String currentWorkingDirectory;
private String path;
@ -240,14 +249,12 @@ public class MainWindowController {
ObservableList<tableData> localFilms = FXCollections.observableArrayList();
ObservableList<tableData> streamingFilms = FXCollections.observableArrayList();
ObservableList<tableData> streamingData = FXCollections.observableArrayList();
private ImageView menu_icon_black = new ImageView(new Image("recources/icons/menu_icon_black.png"));
private ImageView menu_icon_white = new ImageView(new Image("recources/icons/menu_icon_white.png"));
private ImageView skip_previous_white = new ImageView(new Image("recources/icons/ic_skip_previous_white_18dp_1x.png"));
private ImageView skip_previous_black = new ImageView(new Image("recources/icons/ic_skip_previous_black_18dp_1x.png"));
private ImageView skip_next_white = new ImageView(new Image("recources/icons/ic_skip_next_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_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 ImageView skip_previous_white = new ImageView(new Image("resources/icons/ic_skip_previous_white_18dp_1x.png"));
private ImageView skip_previous_black = new ImageView(new Image("resources/icons/ic_skip_previous_black_18dp_1x.png"));
private ImageView skip_next_white = new ImageView(new Image("resources/icons/ic_skip_next_white_18dp_1x.png"));
private ImageView skip_next_black = new ImageView(new Image("resources/icons/ic_skip_next_black_18dp_1x.png"));
private ImageView play_arrow_white = new ImageView(new Image("resources/icons/ic_play_arrow_white_18dp_1x.png"));
private ImageView play_arrow_black = new ImageView(new Image("resources/icons/ic_play_arrow_black_18dp_1x.png"));
private DirectoryChooser directoryChooser = new DirectoryChooser();
private MenuItem like = new MenuItem("like");
private MenuItem dislike = new MenuItem("dislike"); //TODO one option (like or dislike)
@ -259,30 +266,6 @@ public class MainWindowController {
private apiQuery ApiQuery;
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
private void playbtnclicked(){
System.out.println(System.getProperty("os.name"));
@ -308,16 +291,9 @@ public class MainWindowController {
alert.setTitle("Info");
alert.setContentText(vlcNotInstalled);
alert.showAndWait();
}else if(datPath.contains(" ")){
Alert alert = new Alert(AlertType.INFORMATION);
alert.setHeaderText("");
alert.setTitle("Info");
alert.setContentText(linuxBugText);
alert.initOwner(main.primaryStage);
alert.showAndWait();
}else{
try {
Runtime.getRuntime().exec("vlc "+getPath()+"/"+ datPath);
Runtime.getRuntime().exec(new String[] { "vlc", getPath()+"/"+ datPath});
} catch (IOException e) {
showErrorMsg(errorPlay,e);
}
@ -332,7 +308,7 @@ public class MainWindowController {
}
}else if(mode.equals("streaming")){
try {
Desktop.getDesktop().browse(new URI(datPath)); //open the streaming URL in browser (TODO other option?)
Desktop.getDesktop().browse(new URI(datPath)); //open the streaming URL in browser
} catch (URISyntaxException | IOException e) {
showErrorMsg(errorOpenStream, (IOException) e);
}
@ -375,18 +351,18 @@ public class MainWindowController {
@FXML
private void settingsBtnclicked(){
if(settingstrue == false){
if(settingsTrue == false){
if(streamingSettingsTrue == true){
streamingSettingsAnchor.setVisible(false);
streamingSettingsTrue = false;
}
settingsAnchor.setVisible(true);
settingstrue = true;
settingsTrue = true;
}else{
settingsAnchor.setVisible(false);
setPath(tfPath.getText());
saveSettings();
settingstrue = false;
settingsTrue = false;
}
}
@ -396,9 +372,9 @@ public class MainWindowController {
@FXML
private void streamingSettingsBtnclicked(){
if(streamingSettingsTrue == false){
if(settingstrue == true){
if(settingsTrue == true){
settingsAnchor.setVisible(false);
settingstrue = false;
settingsTrue = false;
}
streamingSettingsAnchor.setVisible(true);
streamingSettingsTrue = true;
@ -423,8 +399,8 @@ public class MainWindowController {
settingsAnchor.setVisible(false);
streamingSettingsAnchor.setVisible(false);
sideMenuSlideOut(); //disables side-menu
menutrue = false;
settingstrue = false;
menuTrue = false;
settingsTrue = false;
streamingSettingsTrue = false;
}
@ -589,6 +565,32 @@ public class MainWindowController {
//Initializing the actions
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>() {
@Override
public void changed(ObservableValue<? extends String> observable,String oldValue, String newValue) {
@ -858,7 +860,7 @@ public class MainWindowController {
playbtn.setGraphic(play_arrow_white);
returnBtn.setGraphic(skip_previous_white);
forwardBtn.setGraphic(skip_next_white);
menubtn.setGraphic(menu_icon_white);
menuHam.getStyleClass().add("jfx-hamburgerW");
}else{
settingsBtn.setStyle("-fx-text-fill: BLACK;");
streamingSettingsBtn.setStyle("-fx-text-fill: BLACK;");
@ -875,7 +877,7 @@ public class MainWindowController {
playbtn.setGraphic(play_arrow_black);
returnBtn.setGraphic(skip_previous_black);
forwardBtn.setGraphic(skip_next_black);
menubtn.setGraphic(menu_icon_black);
menuHam.getStyleClass().add("jfx-hamburgerB");
}
if(mode.equals("local")){
@ -920,15 +922,15 @@ public class MainWindowController {
void setLocalUI(){
switch(getLocal()){
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);
break;
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);
break;
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);
break;
}
@ -942,9 +944,12 @@ public class MainWindowController {
updateBtn.setText(bundle.getString("checkUpdates"));
directoryBtn.setText(bundle.getString("chooseFolder"));
streamingDirectoryBtn.setText(bundle.getString("chooseFolder"));
sizelbl.setText(bundle.getString("fontSize"));
aulbl.setText(bundle.getString("autoUpdate"));
versionlbl.setText(bundle.getString("version")+" "+version+" (Build: "+buildNumber+")");
settingsHead1Label.setText(bundle.getString("settingsHead1Label"));
mainColorLabel.setText(bundle.getString("mainColorLabel"));
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"));
columnRating.setText(bundle.getString("columnRating"));
columnStreamUrl.setText(bundle.getString("columnStreamUrl"));
@ -960,7 +965,6 @@ public class MainWindowController {
errorSave = bundle.getString("errorSave");
noFilmFound = bundle.getString("noFilmFound");
infoText = bundle.getString("version")+" "+version+" (Build: "+buildNumber+") "+versionName+bundle.getString("infoText");
linuxBugText = bundle.getString("linuxBug");
vlcNotInstalled = bundle.getString("vlcNotInstalled");
title = bundle.getString("title");

14
src/application/apiQuery.java

@ -38,7 +38,8 @@ public class apiQuery{
private Image im;
private String[] responseString = new String[20];
private String posterCache;
private String apiURL = "https://www.omdbapi.com/?";
private String apiURL = "https://www.omdbapi.com/?apikey=";
private String apiKey = "b9f9fd23";
ArrayList<Text> responseText = new ArrayList<Text>();
ArrayList<Text> nameText = new ArrayList<Text>();
@ -75,7 +76,7 @@ public class apiQuery{
moviename = moviename.replace(" ", "+");
//queryURL is apiURL and additional parameters, response-types: http,json,xml (must be json, since the response is processed with minimal-json )
queryURL = new URL(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"));
@ -133,12 +134,11 @@ public class apiQuery{
}
//if response == false then show mainWindowController.noFilmFound else create new Texts and add them to flowText
if(responseString[19].equals("False")){
if(retdata.contains("\"Response\":\"False\"")){ //TODO + FIXME
mainWindowController.textFlow.getChildren().add(new Text(mainWindowController.noFilmFound));
im = new Image("recources/icons/close_black_2048x2048.png");
im = new Image("resources/icons/close_black_2048x2048.png");
mainWindowController.image1.setImage(im);
}else{
//
nameText.add(0, new Text(mainWindowController.title+": "));
nameText.add(1, new Text(mainWindowController.year+": "));
nameText.add(2, new Text(mainWindowController.rating+": "));
@ -156,7 +156,6 @@ public class apiQuery{
nameText.add(14, new Text(mainWindowController.imdbRating+": "));
nameText.add(15, new Text(mainWindowController.type+": "));
for(int i=0; i<nameText.size(); i++){
nameText.get(i).setFont(Font.font (fontFamily, FontWeight.BOLD, fontSize));
}
@ -169,7 +168,7 @@ public class apiQuery{
//if there is no poster
if(responseString[18].equals("N/A")){
im = new Image("recources/icons/close_black_2048x2048.png");
im = new Image("resources/icons/close_black_2048x2048.png");
}else{
im = new Image(responseString[18]);
}
@ -178,6 +177,7 @@ public class apiQuery{
}
} catch (Exception e) {
mainWindowController.textFlow.getChildren().remove(0, mainWindowController.textFlow.getChildren().size());
mainWindowController.textFlow.getChildren().add(new Text(e.toString()));
System.out.println(e);
} finally {

1
src/application/application.css

@ -1 +0,0 @@
/* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */

BIN
src/recources/icons/menu_icon_black.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB