worked on dbcontroller part 3
fixed a few bugs, prepared for favorites
This commit is contained in:
parent
e63665add0
commit
4fe2d7b4be
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -137,7 +137,8 @@ public class DBController {
|
||||||
System.out.println(rs.getString(1));
|
System.out.println(rs.getString(1));
|
||||||
System.out.println(rs.getString(2));
|
System.out.println(rs.getString(2));
|
||||||
System.out.println(rs.getString(3)+"\n");
|
System.out.println(rs.getString(3)+"\n");
|
||||||
}
|
}
|
||||||
|
stmt.close();
|
||||||
rs.close();
|
rs.close();
|
||||||
|
|
||||||
System.out.println("Streaming Entries: \n");
|
System.out.println("Streaming Entries: \n");
|
||||||
|
@ -151,7 +152,8 @@ public class DBController {
|
||||||
System.out.println(rsS.getString(5));
|
System.out.println(rsS.getString(5));
|
||||||
System.out.println(rsS.getString(6));
|
System.out.println(rsS.getString(6));
|
||||||
System.out.println(rsS.getString(7)+"\n");
|
System.out.println(rsS.getString(7)+"\n");
|
||||||
}
|
}
|
||||||
|
stmt.close();
|
||||||
rsS.close();
|
rsS.close();
|
||||||
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
|
@ -164,19 +166,30 @@ public class DBController {
|
||||||
//gibt die Favorisierung eines bestimmten Films
|
//gibt die Favorisierung eines bestimmten Films
|
||||||
public void getFavStatus(String name){
|
public void getFavStatus(String name){
|
||||||
try{
|
try{
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmta = connection.createStatement();
|
||||||
ResultSet rs = stmt.executeQuery("SELECT titel, rating FROM film_local WHERE titel = '"+name+"';" ); //SQL Befehl
|
ResultSet rs = stmta.executeQuery("SELECT titel, rating FROM film_local WHERE titel = '"+name+"';" ); //SQL Befehl
|
||||||
System.out.println("local:"+rs.getInt("rating"));
|
System.out.println("local:"+rs.getString("rating"));
|
||||||
|
stmta.close();
|
||||||
|
rs.close();
|
||||||
}catch(SQLException e){
|
}catch(SQLException e){
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Statement stmtS = connection.createStatement();
|
System.out.println("streaming");
|
||||||
ResultSet rsS = stmtS.executeQuery("SELECT titel, rating FROM film_streaming WHERE titel = '"+name+"';" );
|
Statement stmtSa = connection.createStatement();
|
||||||
System.out.println("streaming:"+rsS.getInt("rating"));
|
ResultSet rsS = stmtSa.executeQuery("SELECT titel, rating FROM film_streaming WHERE titel = '"+name+"';" );
|
||||||
|
System.out.println("streaming:"+rsS.getString("rating"));
|
||||||
|
stmtSa.close();
|
||||||
|
rsS.close();
|
||||||
} catch (SQLException e1) {
|
} catch (SQLException e1) {
|
||||||
System.out.println("Ups! an error occured!");
|
// System.out.println("Ups! an error occured!");
|
||||||
e1.printStackTrace();
|
e1.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// System.out.println("Ups! an error occured!");
|
||||||
|
// e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//setzt die Defavorisierung eines bestimmten Films
|
//setzt die Defavorisierung eines bestimmten Films
|
||||||
public void defavorisieren(String name){
|
public void defavorisieren(String name){
|
||||||
|
|
|
@ -105,7 +105,7 @@ public class Main extends Application {
|
||||||
Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //start again (preventing Bugs)
|
Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //start again (preventing Bugs)
|
||||||
System.exit(0); //finishes itself
|
System.exit(0); //finishes itself
|
||||||
}
|
}
|
||||||
mainWindowController.loadStreamingSettings();
|
// mainWindowController.loadStreamingSettings();
|
||||||
mainWindowController.applyColor(); //setzt die Theme Farbe
|
mainWindowController.applyColor(); //setzt die Theme Farbe
|
||||||
mainWindowController.cbLocal.getSelectionModel().select(mainWindowController.getLocal()); //setzt local
|
mainWindowController.cbLocal.getSelectionModel().select(mainWindowController.getLocal()); //setzt local
|
||||||
mainWindowController.mainColor.setValue(Color.valueOf(mainWindowController.getColor()));
|
mainWindowController.mainColor.setValue(Color.valueOf(mainWindowController.getColor()));
|
||||||
|
|
|
@ -102,7 +102,8 @@ public class MainWindowController {
|
||||||
private TreeTableView<streamUiData> treeTableViewfilm;
|
private TreeTableView<streamUiData> treeTableViewfilm;
|
||||||
@FXML
|
@FXML
|
||||||
private TableView<streamUiData> tableViewStreamingdata;
|
private TableView<streamUiData> tableViewStreamingdata;
|
||||||
@FXML JFXTextArea ta1;
|
@FXML
|
||||||
|
JFXTextArea ta1;
|
||||||
@FXML
|
@FXML
|
||||||
private JFXButton menubtn;
|
private JFXButton menubtn;
|
||||||
@FXML
|
@FXML
|
||||||
|
@ -151,7 +152,8 @@ public class MainWindowController {
|
||||||
private Label sizelbl;
|
private Label sizelbl;
|
||||||
@FXML
|
@FXML
|
||||||
private Label aulbl;
|
private Label aulbl;
|
||||||
@FXML ImageView image1;
|
@FXML
|
||||||
|
ImageView image1;
|
||||||
|
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
|
@ -425,12 +427,12 @@ public class MainWindowController {
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private void debugBtnclicked(){
|
private void debugBtnclicked(){
|
||||||
dbController.main(); //TODO das muss vor einen anderen Befehl warum auch immer
|
// dbController.ausgeben();
|
||||||
dbController.getFavStatus("House of Cards");
|
dbController.getFavStatus("Zootopia");
|
||||||
dbController.favorisieren("House of Cards");
|
dbController.favorisieren("Zootopia");
|
||||||
dbController.getFavStatus("House of Cards");
|
dbController.getFavStatus("Zootopia");
|
||||||
// dbController.defavorisieren("House of Cards");
|
dbController.defavorisieren("Zootopia");
|
||||||
// dbController.getFavStatus("House of Cards");
|
dbController.getFavStatus("Zootopia");
|
||||||
//for testing
|
//for testing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -517,9 +519,10 @@ public class MainWindowController {
|
||||||
ApiQuery = new apiQuery(this);
|
ApiQuery = new apiQuery(this);
|
||||||
dbController = new DBController(this);
|
dbController = new DBController(this);
|
||||||
|
|
||||||
System.out.println("Mode: "+mode);
|
System.out.println("Mode: "+mode); //TODO debugging
|
||||||
|
|
||||||
// dbController.main();
|
loadStreamingSettings();
|
||||||
|
dbController.main();
|
||||||
|
|
||||||
debugBtn.setDisable(false); //debugging btn for tests
|
debugBtn.setDisable(false); //debugging btn for tests
|
||||||
debugBtn.setVisible(true);
|
debugBtn.setVisible(true);
|
||||||
|
@ -728,7 +731,7 @@ public class MainWindowController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void loadStreamingSettings(){
|
private void loadStreamingSettings(){
|
||||||
if(getStreamingPath().equals("")||getStreamingPath().equals(null)){
|
if(getStreamingPath().equals("")||getStreamingPath().equals(null)){
|
||||||
System.out.println("Kein Pfad angegeben"); //falls der Pfad null oder "" ist
|
System.out.println("Kein Pfad angegeben"); //falls der Pfad null oder "" ist
|
||||||
}else{
|
}else{
|
||||||
|
|
Loading…
Reference in New Issue