Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
*clean up and minor improvements
*increase build number to 125
  • Loading branch information
Seil0 committed Apr 30, 2017
1 parent 8786b8e commit 96d0412
Show file tree
Hide file tree
Showing 20 changed files with 44 additions and 37 deletions.
Binary file modified bin/application/Main.class
Binary file not shown.
4 changes: 2 additions & 2 deletions bin/application/MainWindow.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@
<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>
<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" />
<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" />
<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="517.0" prefWidth="370.0" AnchorPane.bottomAnchor="5.0" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="40.0" />
</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>
Expand Down
Binary file modified bin/application/MainWindowController$1.class
Binary file not shown.
Binary file modified bin/application/MainWindowController$2.class
Binary file not shown.
Binary file modified bin/application/MainWindowController$3.class
Binary file not shown.
Binary file modified bin/application/MainWindowController$4.class
Binary file not shown.
Binary file modified bin/application/MainWindowController$5.class
Binary file not shown.
Binary file modified bin/application/MainWindowController$6.class
Binary file not shown.
Binary file modified bin/application/MainWindowController$7.class
Binary file not shown.
Binary file modified bin/application/MainWindowController.class
Binary file not shown.
Binary file modified bin/application/apiQuery.class
Binary file not shown.
Binary file modified bin/application/updater.class
Binary file not shown.
4 changes: 2 additions & 2 deletions src/application/DBController.java
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ void loadData(){
stmt.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 ORDER BY titel;");
while (rs.next()) {
if(rs.getString(8).equals("favorite_black")){
Expand All @@ -264,7 +264,7 @@ void loadData(){
}

//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{
System.out.println("refresh ...");
Statement stmt;
Expand Down
4 changes: 1 addition & 3 deletions src/application/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ public class Main extends Application {
Stage primaryStage;
private String path;
String currentWorkingDirectory;
// private String streamingPathWin = System.getProperty("user.home") + "\\Documents\\HomeFlix";
// private String streamingPathLinux = System.getProperty("user.home") + "/HomeFlix";
private String COLOR = "ee3523";
private String FONT_FAMILY = "System";
private String mode = "local"; //local or streaming TODO
Expand Down Expand Up @@ -110,7 +108,7 @@ private void mainWindow(){
mainWindowController.setMode(mode);
mainWindowController.saveSettings();
Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //start again (preventing Bugs)
System.exit(0); //finishes itse
System.exit(0); //finishes it self
}

if(!posterCache.exists()) {
Expand Down
4 changes: 2 additions & 2 deletions src/application/MainWindow.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@
<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>
<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" />
<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" />
<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="517.0" prefWidth="370.0" AnchorPane.bottomAnchor="5.0" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="40.0" />
</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>
Expand Down
37 changes: 26 additions & 11 deletions src/application/MainWindowController.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public class MainWindowController {
@FXML
ScrollPane scrollPane;
@FXML
private JFXButton menubtn;
private JFXButton menubtn; //TODO switch to hamburger menu
@FXML
private JFXButton playbtn;
@FXML
Expand Down Expand Up @@ -177,14 +177,14 @@ 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 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 = "121";
private String buildNumber = "125";
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";
Expand Down Expand Up @@ -239,7 +239,7 @@ public class MainWindowController {
ResourceBundle bundle;

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<tableData> localFilms = FXCollections.observableArrayList();
ObservableList<tableData> streamingFilms = FXCollections.observableArrayList();
ObservableList<tableData> streamingData = FXCollections.observableArrayList();
Expand Down Expand Up @@ -514,7 +514,9 @@ private void streamingDirectoryBtnAction(){
}


//"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) {
this.main = main;
Updater = new updater(this,buildURL, downloadLink, buildNumber);
Expand All @@ -531,7 +533,7 @@ void initTabel(){
columnTitel.setMaxWidth(260);
columnStreamUrl.setMaxWidth(0);
dataNameColumn.setPrefWidth(150);
dataNameEndColumn.setPrefWidth(170);
dataNameEndColumn.setPrefWidth(220);
columnRating.setStyle("-fx-alignment: CENTER;");

treeTableViewfilm.setRoot(root);
Expand Down Expand Up @@ -626,7 +628,7 @@ public void changed(ObservableValue<? extends String> observable,String oldValue
cbLocal.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {
public void changed(ObservableValue<? extends Number> ov, Number value, Number new_value) {
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);
setLocalUI();
saveSettings();
Expand Down Expand Up @@ -692,7 +694,7 @@ public void handle(ActionEvent event) {
});

/**
* TODO fix bug when sort by ASCENDING, wrong order
* FIXME fix bug when sort by ASCENDING, wrong order
*/
columnRating.sortTypeProperty().addListener(new ChangeListener<SortType>() {
@Override
Expand Down Expand Up @@ -923,7 +925,7 @@ private void sideMenuSlideOut(){
void setLocalUI(){
switch(getLocal()){
case "en_US":
bundle = ResourceBundle.getBundle("recources.HomeFlix-Local", Locale.US); //us_english
bundle = ResourceBundle.getBundle("recources.HomeFlix-Local", Locale.US); //us_English
cbLocal.getSelectionModel().select(0);
break;
case "de_DE":
Expand Down Expand Up @@ -1020,6 +1022,7 @@ void showErrorMsg(String msg, IOException exception){

//saves the Settings
public void saveSettings(){
System.out.println("saving settings ...");
OutputStream outputStream; //new output-stream
try {
props.setProperty("path", getPath()); //writes path into property
Expand Down Expand Up @@ -1056,14 +1059,26 @@ public void loadSettings(){
inputStream = new FileInputStream(fileWin);
}
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");
color = props.getProperty("color");
size = Double.parseDouble(props.getProperty("size"));
autoUpdate = Boolean.parseBoolean(props.getProperty("autoUpdate"));
local = props.getProperty("local");
mode = props.getProperty("mode");
ratingSortType = props.getProperty("ratingSortType");

switch (props.getProperty("mode")) {
case "local":
mode = "local";
break;
case "streaming":
mode = "streaming";
break;
default:
mode = "local";
break;
}

inputStream.close();
} catch (IOException e) {
if(firststart == false){
Expand Down
21 changes: 9 additions & 12 deletions src/application/apiQuery.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,14 @@ public apiQuery(MainWindowController m, DBController db, Main main){
private Image im;
private String[] responseString = new String[20];
private String posterCache;
private String apiURL = "https://www.omdbapi.com/?";
ArrayList<Text> responseText = new ArrayList<Text>();
ArrayList<Text> nameText = new ArrayList<Text>();

void startQuery(String titel, String streamUrl){
URL url = null;
URL queryURL = null;
Scanner sc = null;
String apiurl = "https://www.omdbapi.com/?"; //API URL
String moviename = null;
String dataurl = null;
String retdata = null;
String posterPath = null;
InputStream is = null;
Expand All @@ -72,17 +71,15 @@ void startQuery(String titel, String streamUrl){
//remove unwanted blank
moviename = moviename.trim();

//replace blank with + for api-query
//replace blank with +
moviename = moviename.replace(" ", "+");

//URL wird zusammengestellt abfragetypen: http,json,xml (muss json sein um späteres trennen zu ermöglichen)
dataurl = apiurl + "t=" + moviename + "&plot=full&r=json";

url = new URL(dataurl);
is = url.openStream();
//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");
is = queryURL.openStream();
br = new BufferedReader(new InputStreamReader(is, "UTF-8"));

// read data from response Stream
//read data from response Stream
while ((retdata = br.readLine()) != null) {
//cut the json response into separate strings
System.out.println(retdata);
Expand Down Expand Up @@ -197,8 +194,8 @@ void startQuery(String titel, String streamUrl){
if (sc != null) {
sc.close();
}
} catch (Exception e2) {
;
} catch (Exception e) {
e.printStackTrace();
}
}
}
Expand Down
5 changes: 1 addition & 4 deletions src/application/updater.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,7 @@ public void run(){
pm.setMillisToPopup(0);
pm.setMinimum(0);// tell the progress bar that we start at the beginning of the stream
pm.setMaximum(conn.getContentLength());// tell the progress bar the total number of bytes we are going to read.
FileUtils.copyInputStreamToFile(pmis, new File("ProjectHomeFlix.jar"));


//need to check if the old config file is compatible TODO
FileUtils.copyInputStreamToFile(pmis, new File("ProjectHomeFlix.jar"));

Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //start again
System.exit(0); //finishes itself
Expand Down
Binary file modified updates/ProjectHomeFlix.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion updates/buildNumber.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
117
125

0 comments on commit 96d0412

Please sign in to comment.