code cleanup

This commit is contained in:
Jannik 2018-02-24 17:13:52 +01:00
parent c99a97fa49
commit 71937540b0
1 changed files with 139 additions and 142 deletions

View File

@ -287,7 +287,6 @@ public class MainWindowController {
} }
}else if (mode.equals("local")) { }else if (mode.equals("local")) {
if(System.getProperty("os.name").contains("Linux")){ if(System.getProperty("os.name").contains("Linux")){
LOGGER.info("This is "+System.getProperty("os.name"));
String line; String line;
String output = ""; String output = "";
Process p; Process p;
@ -297,7 +296,7 @@ public class MainWindowController {
while ((line = input.readLine()) != null) { while ((line = input.readLine()) != null) {
output = line; output = line;
} }
System.out.println(output); LOGGER.info(output);
input.close(); input.close();
} catch (IOException e1) { } catch (IOException e1) {
e1.printStackTrace(); e1.printStackTrace();
@ -316,15 +315,13 @@ 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"));
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 { } else {
System.out.println("It seems like your operating system is not supported, please contact a developer!"); LOGGER.error(System.getProperty("os.name") + ", OS is not supported, please contact a developer! ");
System.out.println("Error code is: nsos; OS is: " + System.getProperty("os.name"));
} }
} else { } else {
IOException e = new IOException("error"); IOException e = new IOException("error");
@ -432,7 +429,7 @@ public class MainWindowController {
private void directoryBtnAction(){ private void directoryBtnAction(){
selectedFolder = directoryChooser.showDialog(null); selectedFolder = directoryChooser.showDialog(null);
if(selectedFolder == null){ if(selectedFolder == null){
System.out.println("No Directory selected"); LOGGER.warn("No Directory selected");
}else{ }else{
setPath(selectedFolder.getAbsolutePath()); setPath(selectedFolder.getAbsolutePath());
saveSettings(); saveSettings();
@ -556,7 +553,7 @@ public class MainWindowController {
ApiQuery.startQuery(name,datPath); // start api query ApiQuery.startQuery(name,datPath); // start api query
} }
}else{ }else{
System.out.println(streamingFilms.size()); LOGGER.info(streamingFilms.size());
if(streamingFilms.get(selected).getCached()==true){ if(streamingFilms.get(selected).getCached()==true){
LOGGER.info("loading from cache: "+name); LOGGER.info("loading from cache: "+name);
dbController.readCache(datPath); dbController.readCache(datPath);
@ -822,7 +819,7 @@ public class MainWindowController {
void loadStreamingSettings() { void loadStreamingSettings() {
if (getStreamingPath().equals("") || getStreamingPath().equals(null)) { if (getStreamingPath().equals("") || getStreamingPath().equals(null)) {
System.out.println("Kein Pfad angegeben"); //if path equals "" or null LOGGER.warn("Kein Pfad angegeben");
} else { } else {
String[] entries = new File(getStreamingPath()).list(); String[] entries = new File(getStreamingPath()).list();
for (int i = 0; i < entries.length; i++) { for (int i = 0; i < entries.length; i++) {
@ -837,11 +834,14 @@ public class MainWindowController {
} }
} }
} }
// removes the ending // removes the ending
private String ohneEndung(String str) { private String ohneEndung(String str) {
if (str == null) return null; if (str == null)
return null;
int pos = str.lastIndexOf("."); int pos = str.lastIndexOf(".");
if (pos == -1) return str; if (pos == -1)
return str;
return str.substring(0, pos); return str.substring(0, pos);
} }
@ -1028,9 +1028,7 @@ public class MainWindowController {
// Set expandable Exception into the dialog pane. // Set expandable Exception into the dialog pane.
alert.getDialogPane().setExpandableContent(expContent); alert.getDialogPane().setExpandableContent(expContent);
alert.showAndWait(); alert.showAndWait();
LOGGER.error("An error occurred", exception);
exception.printStackTrace();
} }
// saves the Settings // saves the Settings
@ -1139,7 +1137,6 @@ public class MainWindowController {
LOGGER.error("cloud not load mode", e); LOGGER.error("cloud not load mode", e);
} }
inputStream.close(); inputStream.close();
} catch (IOException e) { } catch (IOException e) {
if (firststart == false) { if (firststart == false) {