mirror of
https://github.com/RatzzFatzz/MKVAudioSubtitleChanger.git
synced 2026-02-11 02:05:56 +01:00
[ADDED] First README & [FIX] path checking
This commit is contained in:
20
README.md
20
README.md
@@ -0,0 +1,20 @@
|
|||||||
|
config.yml example:
|
||||||
|
|
||||||
|
```
|
||||||
|
mkvtoolnixPath: /usr/bin
|
||||||
|
config:
|
||||||
|
1:
|
||||||
|
audio:
|
||||||
|
- jpn
|
||||||
|
subtitle:
|
||||||
|
- ger
|
||||||
|
- eng
|
||||||
|
2:
|
||||||
|
audio:
|
||||||
|
- ger
|
||||||
|
- eng
|
||||||
|
subtitle:
|
||||||
|
- OFF
|
||||||
|
```
|
||||||
|
Config file needs to be placed in the same directory as the jar.
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public class AttributeUpdaterKernel {
|
|||||||
public void execute(String path) {
|
public void execute(String path) {
|
||||||
List<AttributeConfig> configPattern = ConfigUtil.loadConfig();
|
List<AttributeConfig> configPattern = ConfigUtil.loadConfig();
|
||||||
List<File> allValidPaths = collector.loadFiles(path);
|
List<File> allValidPaths = collector.loadFiles(path);
|
||||||
if(! allValidPaths.isEmpty()){
|
if(! allValidPaths.isEmpty() && configPattern != null){
|
||||||
for(File file : allValidPaths){
|
for(File file : allValidPaths){
|
||||||
List<FileAttribute> attributes = collector.loadAttributes(file);
|
List<FileAttribute> attributes = collector.loadAttributes(file);
|
||||||
for(AttributeConfig config : configPattern){
|
for(AttributeConfig config : configPattern){
|
||||||
@@ -32,7 +32,7 @@ public class AttributeUpdaterKernel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
log.error("Path is not valid!");
|
log.error("Path is not valid or config has errors!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,9 @@ public class Main {
|
|||||||
private static boolean checkIfMKVToolNixIsValid() {
|
private static boolean checkIfMKVToolNixIsValid() {
|
||||||
try{
|
try{
|
||||||
String path = new YAML(new File("config.yml")).getString("mkvtoolnixPath");
|
String path = new YAML(new File("config.yml")).getString("mkvtoolnixPath");
|
||||||
|
if(! path.endsWith(File.separator)){
|
||||||
|
path += File.separator;
|
||||||
|
}
|
||||||
MKVToolProperties.getInstance().setMkvmergePath(path + "mkvmerge");
|
MKVToolProperties.getInstance().setMkvmergePath(path + "mkvmerge");
|
||||||
MKVToolProperties.getInstance().setMkvpropeditPath(path + "mkvproperties");
|
MKVToolProperties.getInstance().setMkvpropeditPath(path + "mkvproperties");
|
||||||
}catch(YamlKeyNotFoundException | IOException | YamlInvalidContentException e){
|
}catch(YamlKeyNotFoundException | IOException | YamlInvalidContentException e){
|
||||||
|
|||||||
Reference in New Issue
Block a user