clean up
*clean up and minor improvements *increase build number to 125
This commit is contained in:
@ -245,7 +245,7 @@ public class DBController {
|
||||
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")){
|
||||
@ -264,7 +264,7 @@ public class DBController {
|
||||
}
|
||||
|
||||
//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;
|
||||
|
@ -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
|
||||
@ -110,7 +108,7 @@ public class Main extends Application {
|
||||
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()) {
|
||||
|
@ -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>
|
||||
|
@ -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
|
||||
@ -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";
|
||||
@ -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();
|
||||
@ -514,7 +514,9 @@ public class MainWindowController {
|
||||
}
|
||||
|
||||
|
||||
//"Main" Method called in Main.java main() when starting
|
||||
/**"Main" Method called in Main.java main() when starting
|
||||
* Initialize other objects: Updater, dbController and ApiQuery
|
||||
*/
|
||||
void setMain(Main main) {
|
||||
this.main = main;
|
||||
Updater = new updater(this,buildURL, downloadLink, buildNumber);
|
||||
@ -531,7 +533,7 @@ public class MainWindowController {
|
||||
columnTitel.setMaxWidth(260);
|
||||
columnStreamUrl.setMaxWidth(0);
|
||||
dataNameColumn.setPrefWidth(150);
|
||||
dataNameEndColumn.setPrefWidth(170);
|
||||
dataNameEndColumn.setPrefWidth(220);
|
||||
columnRating.setStyle("-fx-alignment: CENTER;");
|
||||
|
||||
treeTableViewfilm.setRoot(root);
|
||||
@ -626,7 +628,7 @@ public class MainWindowController {
|
||||
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();
|
||||
@ -692,7 +694,7 @@ public class MainWindowController {
|
||||
});
|
||||
|
||||
/**
|
||||
* TODO fix bug when sort by ASCENDING, wrong order
|
||||
* FIXME fix bug when sort by ASCENDING, wrong order
|
||||
*/
|
||||
columnRating.sortTypeProperty().addListener(new ChangeListener<SortType>() {
|
||||
@Override
|
||||
@ -923,7 +925,7 @@ public class MainWindowController {
|
||||
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":
|
||||
@ -1020,6 +1022,7 @@ public class MainWindowController {
|
||||
|
||||
//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
|
||||
@ -1056,14 +1059,26 @@ public class MainWindowController {
|
||||
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){
|
||||
|
@ -38,15 +38,14 @@ public class apiQuery{
|
||||
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;
|
||||
@ -72,17 +71,15 @@ public class apiQuery{
|
||||
//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);
|
||||
@ -197,8 +194,8 @@ public class apiQuery{
|
||||
if (sc != null) {
|
||||
sc.close();
|
||||
}
|
||||
} catch (Exception e2) {
|
||||
;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -75,10 +75,7 @@ public class updater extends Thread{
|
||||
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
|
||||
|
Reference in New Issue
Block a user