[IMPL] config file implemented

This commit is contained in:
RatzzFatzz
2020-02-14 21:41:49 +01:00
parent 3ac30e0683
commit 4dff50f13a
3 changed files with 65 additions and 60 deletions

View File

@@ -4,6 +4,7 @@ import model.FileAttribute;
import query.QueryBuilder;
import javax.swing.*;
import javax.swing.text.DefaultCaret;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@@ -30,6 +31,8 @@ public class GUI {
JPanel top = new JPanel(new GridLayout(1, 3, 20, 20));
outputArea = new JTextArea();
DefaultCaret caret = (DefaultCaret) outputArea.getCaret();
caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
PrintStream printStream = new PrintStream(new CustomOutputStream(outputArea));
System.setOut(printStream);
System.setErr(printStream);

View File

@@ -85,12 +85,10 @@ public class QueryBuilder {
List<String> audios = null;
try{
yaml = new YAML(new File("src/main/resources/config.yaml"));
yaml = new YAML(new File("config.yaml"));
subtitles = yaml.getStringList("subtitle", null);
audios = yaml.getStringList("audio", null);
}catch(YamlInvalidContentException | IOException e){
log.error(e.getMessage());
}
if(fileAttributes.size() > 2 && subtitles != null && audios != null){
@@ -145,8 +143,12 @@ public class QueryBuilder {
log.error("Couldn't make changes to file");
}
}else{
log.info("There were not enough lines provided to make any changes to the file");
}
}catch(YamlInvalidContentException | IOException e){
log.error(e.getMessage());
}
}
}

View File

@@ -3,5 +3,5 @@ audio:
- ger
- eng
subtitle:
- ger
- eng
- ger