[IMPL] Changed to CLI tool

This commit is contained in:
2020-06-04 00:53:33 +02:00
parent aef1fdf9a5
commit e0a21b5d7c
10 changed files with 43 additions and 461 deletions

View File

@@ -1,9 +1,32 @@
package at.pcgamingfreaks.mkvaudiosubtitlechanger;
import at.pcgamingfreaks.yaml.YAML;
import at.pcgamingfreaks.yaml.YamlInvalidContentException;
import at.pcgamingfreaks.yaml.YamlKeyNotFoundException;
import lombok.extern.log4j.Log4j2;
import java.io.File;
import java.io.IOException;
@Log4j2
public class Main {
public static void main(String[] args) {
MKVToolProperties.getInstance().defineMKVToolNixPath();
AttributeUpdaterKernel kernel = new AttributeUpdaterKernel();
kernel.execute();
if(checkIfMKVToolNixIsValid()){
AttributeUpdaterKernel kernel = new AttributeUpdaterKernel();
kernel.execute(args[0]);
}else{
log.error("MKVToolNix was not found! Please recheck path");
}
}
private static boolean checkIfMKVToolNixIsValid() {
try{
String path = new YAML(new File("config.yml")).getString("mkvtoolnixPath");
MKVToolProperties.getInstance().setMkvmergePath(path + "mkvmerge");
MKVToolProperties.getInstance().setMkvpropeditPath(path + "mkvproperties");
}catch(YamlKeyNotFoundException | IOException | YamlInvalidContentException e){
e.printStackTrace();
}
return new File(MKVToolProperties.getInstance().getMkvmergePath()).isFile() && new File(MKVToolProperties.getInstance().getMkvpropeditPath()).isFile();
}
}