minor fixes

* fixed streaming not working under linux
* minor text fixes
This commit is contained in:
Jannik 2017-07-20 14:23:50 +02:00
parent d92c496fe2
commit 1f02277f72
10 changed files with 70 additions and 57 deletions

1
bin/.gitignore vendored
View File

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

View File

@ -266,10 +266,22 @@ public class MainWindowController {
private apiQuery ApiQuery; private apiQuery ApiQuery;
DBController dbController; DBController dbController;
//TODO add streaming support to Linux!
@FXML @FXML
private void playbtnclicked(){ private void playbtnclicked(){
System.out.println(System.getProperty("os.name")); if (mode.equals("streaming")) {
if (Desktop.isDesktopSupported()) {
new Thread(() -> {
try {
Desktop.getDesktop().browse(new URI(datPath)); //open the streaming URL in browser
} catch (IOException | URISyntaxException e) {
e.printStackTrace();
showErrorMsg(errorOpenStream, (IOException) e);
}
}).start();
} else {
System.out.println("Desktop not supported");
}
}else if (mode.equals("local")) {
if(System.getProperty("os.name").contains("Linux")){ if(System.getProperty("os.name").contains("Linux")){
System.out.println("This is "+System.getProperty("os.name")); System.out.println("This is "+System.getProperty("os.name"));
String line; String line;
@ -301,23 +313,18 @@ public class MainWindowController {
} }
}else if(System.getProperty("os.name").contains("Windows") || System.getProperty("os.name").contains("Mac OS X")){ }else if(System.getProperty("os.name").contains("Windows") || System.getProperty("os.name").contains("Mac OS X")){
System.out.println("This is "+System.getProperty("os.name")); System.out.println("This is "+System.getProperty("os.name"));
if(mode.equals("local")){
try { try {
Desktop.getDesktop().open(new File(getPath()+"\\"+ datPath)); Desktop.getDesktop().open(new File(getPath()+"\\"+ datPath));
} catch (IOException e) { } catch (IOException e) {
showErrorMsg(errorPlay,e); showErrorMsg(errorPlay,e);
} }
}else if(mode.equals("streaming")){ } else {
try { System.out.println("It seems like your operating system is not supported, please contact a developer!");
Desktop.getDesktop().browse(new URI(datPath)); //open the streaming URL in browser System.out.println("Error code is: nsos; OS is: " + System.getProperty("os.name"));
} catch (URISyntaxException | IOException e) {
showErrorMsg(errorOpenStream, (IOException) e);
} }
} else { } else {
IOException e = new IOException("error"); IOException e = new IOException("error");
showErrorMsg(errorMode, e); showErrorMsg(errorMode, e);
}
} }
} }
@ -495,7 +502,6 @@ public class MainWindowController {
} }
//Initialize the tables (treeTableViewfilm and tableViewStreamingdata) //Initialize the tables (treeTableViewfilm and tableViewStreamingdata)
@SuppressWarnings({ "unchecked"}) //TODO
void initTabel(){ void initTabel(){
//film Table //film Table
@ -519,10 +525,17 @@ public class MainWindowController {
columnSeason.setCellValueFactory(cellData -> cellData.getValue().getValue().seasonProperty().asObject()); columnSeason.setCellValueFactory(cellData -> cellData.getValue().getValue().seasonProperty().asObject());
columnEpisode.setCellValueFactory(cellData -> cellData.getValue().getValue().episodeProperty().asObject()); columnEpisode.setCellValueFactory(cellData -> cellData.getValue().getValue().episodeProperty().asObject());
treeTableViewfilm.getColumns().addAll(columnTitel, columnRating, columnStreamUrl, columnResolution, columnYear, columnSeason, columnEpisode); //add columns to treeTableViewfilm
treeTableViewfilm.getColumns().get(2).setVisible(false); //hide columnStreamUrl (column with file path important for the player) treeTableViewfilm.getColumns().add(columnTitel);
treeTableViewfilm.getColumns().add(columnRating);
treeTableViewfilm.getColumns().add(columnStreamUrl);
treeTableViewfilm.getColumns().add(columnResolution);
treeTableViewfilm.getColumns().add(columnYear);
treeTableViewfilm.getColumns().add(columnSeason);
treeTableViewfilm.getColumns().add(columnEpisode);
treeTableViewfilm.getColumns().get(2).setVisible(false); //hide columnStreamUrl (column with file URL, important for opening a file/stream)
//Change-listener for TreeTable //Change-listener for treeTableViewfilm
treeTableViewfilm.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Object>() { treeTableViewfilm.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Object>() {
@Override @Override
public void changed(ObservableValue<?> observable, Object oldVal, Object newVal){ public void changed(ObservableValue<?> observable, Object oldVal, Object newVal){
@ -552,14 +565,15 @@ public class MainWindowController {
} }
}); });
//context menu for treetableview //context menu for treeTableViewfilm
treeTableViewfilm.setContextMenu(menu); treeTableViewfilm.setContextMenu(menu);
//Streaming-Settings Table //Streaming-Settings Table
dataNameColumn.setCellValueFactory(cellData -> cellData.getValue().titleProperty()); dataNameColumn.setCellValueFactory(cellData -> cellData.getValue().titleProperty());
dataNameEndColumn.setCellValueFactory(cellData -> cellData.getValue().streamUrlProperty()); dataNameEndColumn.setCellValueFactory(cellData -> cellData.getValue().streamUrlProperty());
tableViewStreamingdata.getColumns().addAll(dataNameColumn, dataNameEndColumn); tableViewStreamingdata.getColumns().add(dataNameColumn);
tableViewStreamingdata.getColumns().add(dataNameEndColumn);
tableViewStreamingdata.setItems(streamingData); tableViewStreamingdata.setItems(streamingData);
} }
@ -660,7 +674,7 @@ public class MainWindowController {
Alert alert = new Alert(AlertType.ERROR); Alert alert = new Alert(AlertType.ERROR);
alert.setTitle("Error"); alert.setTitle("Error");
alert.setHeaderText(""); alert.setHeaderText("");
alert.setContentText("There should be an error message in the future (like problem)\nIt seems as a cat has stolen the like-methode"); alert.setContentText("There should be an error message in future (like-problem).\nIt seems as a cat has stolen the \"like-methode\"!");
e.printStackTrace(); e.printStackTrace();
} }
refreshTable(); refreshTable();
@ -682,7 +696,7 @@ public class MainWindowController {
Alert alert = new Alert(AlertType.ERROR); Alert alert = new Alert(AlertType.ERROR);
alert.setTitle("Error"); alert.setTitle("Error");
alert.setHeaderText(""); alert.setHeaderText("");
alert.setContentText("There should be an error message in the future (dislike problem)"); alert.setContentText("There should be an error message in future (dislike problem)");
e.printStackTrace(); e.printStackTrace();
} }
refreshTable(); refreshTable();