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/
/resources/

View File

@ -266,10 +266,22 @@ public class MainWindowController {
private apiQuery ApiQuery;
DBController dbController;
//TODO add streaming support to Linux!
@FXML
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")){
System.out.println("This is "+System.getProperty("os.name"));
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")){
System.out.println("This is "+System.getProperty("os.name"));
if(mode.equals("local")){
try {
Desktop.getDesktop().open(new File(getPath()+"\\"+ datPath));
} catch (IOException e) {
showErrorMsg(errorPlay,e);
}
}else if(mode.equals("streaming")){
try {
Desktop.getDesktop().browse(new URI(datPath)); //open the streaming URL in browser
} catch (URISyntaxException | IOException e) {
showErrorMsg(errorOpenStream, (IOException) e);
} else {
System.out.println("It seems like your operating system is not supported, please contact a developer!");
System.out.println("Error code is: nsos; OS is: " + System.getProperty("os.name"));
}
} else {
IOException e = new IOException("error");
showErrorMsg(errorMode, e);
}
}
}
@ -495,7 +502,6 @@ public class MainWindowController {
}
//Initialize the tables (treeTableViewfilm and tableViewStreamingdata)
@SuppressWarnings({ "unchecked"}) //TODO
void initTabel(){
//film Table
@ -519,10 +525,17 @@ public class MainWindowController {
columnSeason.setCellValueFactory(cellData -> cellData.getValue().getValue().seasonProperty().asObject());
columnEpisode.setCellValueFactory(cellData -> cellData.getValue().getValue().episodeProperty().asObject());
treeTableViewfilm.getColumns().addAll(columnTitel, columnRating, columnStreamUrl, columnResolution, columnYear, columnSeason, columnEpisode);
treeTableViewfilm.getColumns().get(2).setVisible(false); //hide columnStreamUrl (column with file path important for the player)
//add columns to treeTableViewfilm
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>() {
@Override
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);
//Streaming-Settings Table
dataNameColumn.setCellValueFactory(cellData -> cellData.getValue().titleProperty());
dataNameEndColumn.setCellValueFactory(cellData -> cellData.getValue().streamUrlProperty());
tableViewStreamingdata.getColumns().addAll(dataNameColumn, dataNameEndColumn);
tableViewStreamingdata.getColumns().add(dataNameColumn);
tableViewStreamingdata.getColumns().add(dataNameEndColumn);
tableViewStreamingdata.setItems(streamingData);
}
@ -660,7 +674,7 @@ public class MainWindowController {
Alert alert = new Alert(AlertType.ERROR);
alert.setTitle("Error");
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();
}
refreshTable();
@ -682,7 +696,7 @@ public class MainWindowController {
Alert alert = new Alert(AlertType.ERROR);
alert.setTitle("Error");
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();
}
refreshTable();