Browse Source

added sort by favourite

*added sort by favourite
*fixed a fwe minor bugs
pull/7/head
Seil0 6 years ago
parent
commit
e88e7087ac
  1. 1
      .classpath
  2. BIN
      bin/application/DBController.class
  3. BIN
      bin/application/Main.class
  4. 2
      bin/application/MainWindow.fxml
  5. BIN
      bin/application/MainWindowController$1.class
  6. BIN
      bin/application/MainWindowController$2.class
  7. BIN
      bin/application/MainWindowController$3.class
  8. BIN
      bin/application/MainWindowController$4.class
  9. BIN
      bin/application/MainWindowController$5.class
  10. BIN
      bin/application/MainWindowController$6.class
  11. BIN
      bin/application/MainWindowController$7.class
  12. BIN
      bin/application/MainWindowController.class
  13. BIN
      bin/application/apiQuery.class
  14. BIN
      bin/application/streamUiData.class
  15. BIN
      bin/application/updater.class
  16. 2
      src/application/DBController.java
  17. 12
      src/application/Main.java
  18. 2
      src/application/MainWindow.fxml
  19. 140
      src/application/MainWindowController.java
  20. 98
      src/application/apiQuery.java
  21. 2
      src/application/streamUiData.java
  22. 54
      src/application/updater.java
  23. BIN
      updates/ProjectHomeFlix.jar
  24. 2
      updates/buildNumber.txt

1
.classpath

@ -7,5 +7,6 @@
<classpathentry kind="lib" path="src/libraries/commons-lang3-3.5.jar"/>
<classpathentry kind="lib" path="src/libraries/jfoenix-1.1.0.jar"/>
<classpathentry kind="lib" path="src/libraries/sqlite-jdbc-3.16.1.jar"/>
<classpathentry kind="lib" path="C:/Users/Jannik/Downloads/flow-8.0.7.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

BIN
bin/application/DBController.class

Binary file not shown.

BIN
bin/application/Main.class

Binary file not shown.

2
bin/application/MainWindow.fxml

@ -16,11 +16,13 @@
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.TextFlow?>
<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>
<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" />
<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" />
<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" />
<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 name="System Bold" size="14.0" />

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.

BIN
bin/application/streamUiData.class

Binary file not shown.

BIN
bin/application/updater.class

Binary file not shown.

2
src/application/DBController.java

@ -195,7 +195,7 @@ public class DBController {
ps.close();
psS.close();
}catch (SQLException ea) {
System.err.println("Konnte nicht ausgef<EFBFBD>hrt werden");
System.err.println("Konnte nicht ausgeführt werden");
ea.printStackTrace();
}
}else {

12
src/application/Main.java

@ -25,7 +25,6 @@ import java.io.File;
import java.io.IOException;
import java.util.Locale;
import java.util.Optional;
import java.util.Properties;
import java.util.ResourceBundle;
import javafx.application.Application;
@ -41,7 +40,7 @@ import javafx.stage.Stage;
public class Main extends Application {
public Stage primaryStage;
private Stage primaryStage;
private String path;
private String streamingPathWin = System.getProperty("user.home") + "\\Documents\\HomeFlix";
private String streamingPathLinux = System.getProperty("user.home") + "/HomeFlix";
@ -56,7 +55,6 @@ public class Main extends Application {
private File dirLinux = new File(System.getProperty("user.home") + "/HomeFlix"); //Linux: /home/"User"/HomeFlix
private File fileWin = new File(dirWin + "/config.xml"); //Windows: C:/Users/"User"/Documents/HomeFlix/config.xml
private File fileLinux = new File(dirLinux + "/config.xml"); //Linux: /home/"User"/HomeFlix/config.xml
Properties props = new Properties();
@Override
public void start(Stage primaryStage) {
@ -64,7 +62,7 @@ public class Main extends Application {
mainWindow();
}
public void mainWindow(){
private void mainWindow(){
try {
FXMLLoader loader = new FXMLLoader(Main.class.getResource("MainWindow.fxml"));
@ -91,7 +89,7 @@ public class Main extends Application {
mainWindowController.setAutoUpdate(autoUpdate);
mainWindowController.setLocal(local);
mainWindowController.setMode(mode);
mainWindowController.saveSettings("l");
mainWindowController.saveSettings();
Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //start again (preventing Bugs)
System.exit(0); //finishes itself
}
@ -107,7 +105,7 @@ public class Main extends Application {
mainWindowController.setAutoUpdate(autoUpdate);
mainWindowController.setLocal(local);
mainWindowController.setMode(mode);
mainWindowController.saveSettings("k");
mainWindowController.saveSettings();
Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //start again (preventing Bugs)
System.exit(0); //finishes itself
}
@ -141,7 +139,7 @@ public class Main extends Application {
switch(System.getProperty("user.language")+"_"+System.getProperty("user.country")){
case "en_US": bundle = ResourceBundle.getBundle("recources.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("recources.HomeFlix-Local", Locale.GERMAN); //German
break;
default: bundle = ResourceBundle.getBundle("recources.HomeFlix-Local", Locale.US); //default local
break;

2
src/application/MainWindow.fxml

@ -16,11 +16,13 @@
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.TextFlow?>
<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>
<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" />
<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" />
<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" />
<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 name="System Bold" size="14.0" />

140
src/application/MainWindowController.java

@ -32,19 +32,19 @@ import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.lang.Thread.State;
import java.math.BigInteger;
import java.net.URI;
import java.net.URISyntaxException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Locale;
import java.util.Properties;
import java.util.ResourceBundle;
import org.apache.commons.lang3.SystemUtils;
import com.jfoenix.controls.JFXButton;
import com.jfoenix.controls.JFXColorPicker;
import com.jfoenix.controls.JFXDialog;
import com.jfoenix.controls.JFXSlider;
import com.jfoenix.controls.JFXTextArea;
import com.jfoenix.controls.JFXTextField;
@ -66,11 +66,13 @@ import javafx.scene.control.ChoiceBox;
import javafx.scene.control.ContextMenu;
import javafx.scene.control.Label;
import javafx.scene.control.MenuItem;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.TextArea;
import javafx.scene.control.TreeItem;
import javafx.scene.control.TreeTableColumn;
import javafx.scene.control.TreeTableColumn.SortType;
import javafx.scene.control.TreeTableView;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
@ -81,12 +83,11 @@ import javafx.scene.layout.Priority;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.scene.text.TextFlow;
import javafx.stage.DirectoryChooser;
import javafx.util.Duration;
public class MainWindowController {
private ObservableList<String> locals = FXCollections.observableArrayList("english (en_US)", "deutsch (de_DE)");
public class MainWindowController {
@FXML
private AnchorPane anpane;
@FXML
@ -104,6 +105,10 @@ public class MainWindowController {
@FXML
JFXTextArea ta1;
@FXML
TextFlow textFlow;
@FXML
ScrollPane scrollPane;
@FXML
private JFXButton menubtn;
@FXML
private JFXButton playbtn;
@ -140,12 +145,10 @@ public class MainWindowController {
@FXML
public JFXColorPicker mainColor;
@FXML
public ChoiceBox<String> cbLocal = new ChoiceBox<>(locals);
public ChoiceBox<String> cbLocal = new ChoiceBox<>();
@FXML
public JFXSlider sliderFontSize;
@FXML
private JFXDialog dialog = new JFXDialog();
@FXML
private Label versionlbl;
@FXML
private Label sizelbl;
@ -155,7 +158,6 @@ public class MainWindowController {
ImageView image1;
private ImageView imv1;
@FXML
TreeItem<streamUiData> root = new TreeItem<>(new streamUiData(1, 1, 1, 5.0,"1", "filme","1", imv1));
@FXML
@ -186,9 +188,9 @@ public class MainWindowController {
private boolean streamingSettingsTrue = false;
static boolean firststart = false;
private int hashA = -2055934614;
private String version = "0.4.99";
private String buildNumber = "114";
private String versionName = "plasma cow (pre Release)";
private String version = "0.5.0";
private String buildNumber = "117";
private String versionName = "plasma cow";
private String buildURL = "https://raw.githubusercontent.com/Seil0/Project-HomeFlix/master/updates/buildNumber.txt";
private String downloadLink = "https://raw.githubusercontent.com/Seil0/Project-HomeFlix/master/updates/downloadLink.txt";
private File dirWin = new File(System.getProperty("user.home") + "/Documents/HomeFlix");
@ -243,8 +245,9 @@ public class MainWindowController {
ResourceBundle bundle;
private ObservableList<streamUiData> filterData = FXCollections.observableArrayList();
ObservableList<streamUiData> newData = FXCollections.observableArrayList();
ObservableList<streamUiData> streamData = FXCollections.observableArrayList();
private ObservableList<String> locals = FXCollections.observableArrayList("english (en_US)", "deutsch (de_DE)");
ObservableList<streamUiData> newData = FXCollections.observableArrayList(); //TODO rename to localFilms
ObservableList<streamUiData> streamData = FXCollections.observableArrayList(); //TODO rename to streamingFilms
ObservableList<streamUiData> 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"));
@ -279,7 +282,7 @@ public class MainWindowController {
if(settingstrue == true){
settingsAnchor.setVisible(false);
setPath(tfPath.getText());
saveSettings("a");
saveSettings();
settingstrue = false;
}
if(streamingSettingsTrue == true){
@ -387,7 +390,7 @@ public class MainWindowController {
}else{
settingsAnchor.setVisible(false);
setPath(tfPath.getText());
saveSettings("b");
saveSettings();
settingstrue = false;
}
}
@ -419,7 +422,7 @@ public class MainWindowController {
setMode("local");
switchBtn.setText("streaming");
}
saveSettings("c");
saveSettings();
root.getChildren().remove(0,root.getChildren().size());
addDataUI();
settingsAnchor.setVisible(false);
@ -439,7 +442,7 @@ public class MainWindowController {
@FXML
private void tfPathAction(){
setPath(tfPath.getText());
saveSettings("d");
saveSettings();
}
@FXML
@ -449,7 +452,7 @@ public class MainWindowController {
System.out.println("No Directory selected");
}else{
setPath(selectedFolder.getAbsolutePath());
saveSettings("e");
saveSettings();
tfPath.setText(getPath());
try {
Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //start again
@ -469,7 +472,13 @@ public class MainWindowController {
@FXML
private void updateBtnAction(){
Updater.update(buildURL, downloadLink, aktBuildNumber, buildNumber);
// Updater.update(buildURL, downloadLink, aktBuildNumber, buildNumber);
System.out.println(Updater.getState());
if(Updater.getState() == State.NEW){
Updater.start();
}else{
Updater.run();
}
}
@FXML
@ -479,7 +488,7 @@ public class MainWindowController {
}else{
setAutoUpdate("0");
}
saveSettings("f");
saveSettings();
}
@FXML
@ -494,7 +503,7 @@ public class MainWindowController {
System.out.println("No Directory selected");
}else{
setStreamingPath(selectedStreamingFolder.getAbsolutePath());
saveSettings("g");
saveSettings();
tfStreamingPath.setText(getStreamingPath());
try {
Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //start again
@ -508,8 +517,8 @@ public class MainWindowController {
//"Main" Method called in Main.java main() when starting
public void setMain(Main main) {
Updater = new updater(this);
void setMain(Main main) {
Updater = new updater(this,buildURL, downloadLink, aktBuildNumber, buildNumber);
ApiQuery = new apiQuery(this);
dbController = new DBController(this);
}
@ -572,17 +581,22 @@ public class MainWindowController {
//Initializing the actions
void initActions(){
//TODO unterscheiden zwischen streaming und local
tfsearch.textProperty().addListener(new ChangeListener<String>() {
@Override
public void changed(ObservableValue<? extends String> observable,String oldValue, String newValue) {
int counter = newData.size();
ObservableList<streamUiData> helpData;
filterData.removeAll(filterData);
root.getChildren().remove(0,root.getChildren().size());
for(int i = 0; i < counter; i++){
if(newData.get(i).getTitel().toLowerCase().contains(tfsearch.getText().toLowerCase())){
filterData.add(newData.get(i)); //add data from newDaten to filteredData where title contains search input
if(mode.equals("local")){
helpData = newData;
}else{
helpData = streamData;
}
for(int i = 0; i < helpData.size(); i++){
if(helpData.get(i).getTitel().toLowerCase().contains(tfsearch.getText().toLowerCase())){
filterData.add(helpData.get(i)); //add data from newDaten to filteredData where title contains search input
}
}
@ -602,7 +616,7 @@ public class MainWindowController {
local = local.substring(local.length()-6,local.length()-1);
setLocal(local);
setLocalUI();
saveSettings("h");
saveSettings();
}
});
@ -611,7 +625,7 @@ public class MainWindowController {
public void changed(ObservableValue<? extends Number> ov,Number old_val, Number new_val) {
setSize(sliderFontSize.getValue());
ta1.setFont(Font.font("System", size));
saveSettings("i");
saveSettings();
}
});
@ -658,6 +672,58 @@ public class MainWindowController {
refreshTable();
}
});
/**
* TODO fix bug when sort by ASCENDING, wrong order
*/
columnRating.sortTypeProperty().addListener(new ChangeListener<SortType>() {
@Override
public void changed(ObservableValue<? extends SortType> paramObservableValue, SortType paramT1, SortType paramT2) {
System.out.println("NAME Clicked -- sortType = " + paramT1 + ", SortType=" + paramT2);
ArrayList<Integer> fav_true = new ArrayList<Integer>();
ArrayList<Integer> fav_false = new ArrayList<Integer>();
ObservableList<streamUiData> helpData;
filterData.removeAll(filterData);
root.getChildren().remove(0,root.getChildren().size());
if(mode.equals("local")){
helpData = newData;
}else{
helpData = streamData;
}
for(int i = 0;i<helpData.size();i++){
if(helpData.get(i).getRating()==1.0){
fav_true.add(i);
}else{
fav_false.add(i);
}
}
if(paramT2.toString().equals("DESCENDING")){
System.out.println("Absteigend");
for(int i = 0;i<fav_true.size();i++){
filterData.add(helpData.get(fav_true.get(i)));
}
for(int i = 0;i<fav_false.size();i++){
filterData.add(helpData.get(fav_false.get(i)));
}
}else{
for(int i = 0;i<fav_false.size();i++){
filterData.add(helpData.get(fav_false.get(i)));
}
for(int i = 0;i<fav_true.size();i++){
filterData.add(helpData.get(fav_true.get(i)));
}
}
System.out.println(filterData.size());
for(int i = 0; i < filterData.size(); i++){
// 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
}
}
});
}
//initialize UI elements
@ -671,11 +737,12 @@ public class MainWindowController {
mainColor.setValue(Color.valueOf(getColor()));
updateBtn.setFont(Font.font("System", 12));
cbLocal.setItems(locals);
//TODO rework!
if(autoUpdate.equals("1")){
autoupdateBtn.setSelected(true);
Updater.update(buildURL, downloadLink, aktBuildNumber, buildNumber);
Updater.start();
}else{
autoupdateBtn.setSelected(false);
}
@ -834,7 +901,7 @@ public class MainWindowController {
parallelTransition.play();
}
public void setLocalUI(){
void setLocalUI(){
switch(getLocal()){
case "en_US":
bundle = ResourceBundle.getBundle("recources.HomeFlix-Local", Locale.US); //us_english
@ -898,7 +965,7 @@ public class MainWindowController {
type = bundle.getString("type");
}
public void showErrorMsg(String msg, IOException exception){
void showErrorMsg(String msg, IOException exception){
Alert alert = new Alert(AlertType.ERROR);
alert.setTitle("Error");
alert.setHeaderText("");
@ -932,8 +999,7 @@ public class MainWindowController {
}
//saves the Settings
public void saveSettings(String a){
System.out.println("saving, "+a);
public void saveSettings(){
OutputStream outputStream; //new output-stream
try {
props.setProperty("path", getPath()); //writes path into property
@ -993,7 +1059,7 @@ public class MainWindowController {
StringBuilder sb = new StringBuilder(input);
sb.delete(0, 2);
this.color = sb.toString();
saveSettings("j");
saveSettings();
}
//getter and setter

98
src/application/apiQuery.java

@ -14,7 +14,13 @@ import java.util.Scanner;
import com.eclipsesource.json.Json;
import com.eclipsesource.json.JsonObject;
import javafx.collections.ObservableList;
import javafx.scene.Node;
import javafx.scene.image.Image;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.scene.text.FontWeight;
import javafx.scene.text.Text;
public class apiQuery{
@ -24,6 +30,8 @@ public class apiQuery{
private MainWindowController mainWindowController;
private Image im;
private int fontSize = 20;
private String fontFamily = "System";
@SuppressWarnings("deprecation") //TODO
void startQuery(String input){
@ -78,7 +86,7 @@ public class apiQuery{
String languageV = object.getString("Language", "");
String countryV = object.getString("Country", "");
String awardsV = object.getString("Awards", "");
String posterURL = object.getString("Poster", "");
String metascoreV = object.getString("Metascore", "");
String imdbRatingV = object.getString("imdbRating", "");
@SuppressWarnings("unused")
@ -86,15 +94,56 @@ public class apiQuery{
@SuppressWarnings("unused")
String imdbIDV = object.getString("imdbID", "");
String typeV = object.getString("Type", "");
String posterURL = object.getString("Poster", "");
String response = object.getString("Response", "");
// Text titelR = new Text (object.getString("Title", "")+"\n");
// titelR.setFont(Font.font (fontFamily, fontSize));
// Text yearR = new Text (object.getString("Year", "")+"\n");
// yearR.setFont(Font.font (fontFamily, fontSize));
// Text ratedR = new Text (object.getString("Rated", "")+"\n");
// ratedR.setFont(Font.font (fontFamily, fontSize));
// 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));
if(response.equals("False")){
mainWindowController.ta1.appendText(mainWindowController.noFilmFound);
im = new Image("recources/icons/close_black_2048x2048.png");
mainWindowController.image1.setImage(im);
}else{
//ausgabe des Textes in ta1 in jeweils neuer Zeile //TODO formatting
//ausgabe des Textes in ta1 in jeweils neuer Zeile
mainWindowController.ta1.appendText(mainWindowController.title+": "+titelV+"\n");
mainWindowController.ta1.appendText(mainWindowController.year+": "+ yearV+"\n");
mainWindowController.ta1.appendText(mainWindowController.rating+": "+ratedV+"\n");
@ -111,6 +160,51 @@ public class apiQuery{
mainWindowController.ta1.appendText(mainWindowController.metascore+": "+metascoreV+"\n");
mainWindowController.ta1.appendText(mainWindowController.imdbRating+": "+imdbRatingV+"\n");
mainWindowController.ta1.appendText(mainWindowController.type+": "+typeV+"\n");
// mainWindowController.ta1.setVisible(false);
// Text title = new Text(15, 20, mainWindowController.title+": ");
// 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")){
im = new Image("recources/icons/close_black_2048x2048.png");

2
src/application/streamUiData.java

@ -16,7 +16,7 @@ public class streamUiData {
private final IntegerProperty episode = new SimpleIntegerProperty();
private final DoubleProperty rating = new SimpleDoubleProperty();
private final StringProperty resolution = new SimpleStringProperty();
final StringProperty titel = new SimpleStringProperty();
private final StringProperty titel = new SimpleStringProperty();
private final StringProperty streamUrl = new SimpleStringProperty();
private final SimpleObjectProperty<ImageView> image = new SimpleObjectProperty<>();

54
src/application/updater.java

@ -12,15 +12,23 @@ import java.net.URL;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
public class updater {
public class updater extends Thread{
public updater(MainWindowController m){
private MainWindowController mainWindowController;
private String buildURL;
private String downloadLink;
private String aktBuildNumber;
private String buildNumber;
public updater(MainWindowController m, String buildURL,String downloadLink,String aktBuildNumber,String buildNumber){
mainWindowController=m;
this.buildURL=buildURL;
this.downloadLink=downloadLink;
this.aktBuildNumber=aktBuildNumber;
this.buildNumber=buildNumber;
}
private MainWindowController mainWindowController;
void update(String buildURL,String downloadLink,String aktBuildNumber,String buildNumber){
public void run(){
System.out.println("check for updates ...");
try {
URL url = new URL(buildURL); //URL der Datei mit aktueller Versionsnummer
@ -37,27 +45,27 @@ public class updater {
int iaktVersion = Integer.parseInt(aktBuildNumber.replace(".", ""));
if(iversion >= iaktVersion){
mainWindowController.updateBtn.setText(mainWindowController.bundle.getString("updateBtnNotavail"));
// mainWindowController.updateBtn.setText(mainWindowController.bundle.getString("updateBtnNotavail"));
System.out.println("no update available");
}else{
mainWindowController.updateBtn.setText(mainWindowController.bundle.getString("updateBtnavail"));
// mainWindowController.updateBtn.setText(mainWindowController.bundle.getString("updateBtnavail"));
System.out.println("update available");
try {
URL website;
URL downloadURL = new URL(downloadLink);
BufferedReader in = new BufferedReader(new InputStreamReader(downloadURL.openStream()));
String updateDataURL = in.readLine();
website = new URL(updateDataURL); //Update URL
ReadableByteChannel rbc = Channels.newChannel(website.openStream()); //open new Stream/Channel
FileOutputStream fos = new FileOutputStream("ProjectHomeFlix.jar"); //nea fileoutputstram for ProjectHomeFLix.jar
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); //gets file from 0 to max size
fos.close(); //close fos (extrem wichtig!)
Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //start again
System.exit(0); //finishes itself
} catch (IOException e) {
//in case there is an error
mainWindowController.showErrorMsg(mainWindowController.errorUpdateD, e);
}
try {
URL website;
URL downloadURL = new URL(downloadLink);
BufferedReader in = new BufferedReader(new InputStreamReader(downloadURL.openStream()));
String updateDataURL = in.readLine();
website = new URL(updateDataURL); //Update URL
ReadableByteChannel rbc = Channels.newChannel(website.openStream()); //open new Stream/Channel
FileOutputStream fos = new FileOutputStream("ProjectHomeFlix.jar"); //nea fileoutputstram for ProjectHomeFLix.jar
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); //gets file from 0 to max size
fos.close(); //close fos (extrem wichtig!)
Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //start again
System.exit(0); //finishes itself
} catch (IOException e) {
//in case there is an error
mainWindowController.showErrorMsg(mainWindowController.errorUpdateD, e);
}
}
}
}

BIN
updates/ProjectHomeFlix.jar

Binary file not shown.

2
updates/buildNumber.txt

@ -1 +1 @@
104
117

Loading…
Cancel
Save

Du besuchst diese Seite mit einem veralteten IPv4-Internetzugang. Möglicherweise treten in Zukunft Probleme mit der Erreichbarkeit und Performance auf. Bitte frage deinen Internetanbieter oder Netzwerkadministrator nach IPv6-Unterstützung.
You are visiting this site with an outdated IPv4 internet access. You may experience problems with accessibility and performance in the future. Please ask your ISP or network administrator for IPv6 support.
Weitere Infos | More Information
Klicke zum schließen | Click to close