mirror of
https://github.com/RatzzFatzz/MKVAudioSubtitleChanger.git
synced 2026-02-11 02:05:56 +01:00
Fix execution on linux
This commit is contained in:
@@ -39,16 +39,17 @@ public class MkvFileProcessor implements FileProcessor {
|
|||||||
Map<String, Object> jsonMap;
|
Map<String, Object> jsonMap;
|
||||||
List<FileAttribute> fileAttributes = new ArrayList<>();
|
List<FileAttribute> fileAttributes = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
String command = format("\"%s\"", Config.getInstance().getPathFor(MkvToolNix.MKV_MERGE));
|
String[] command = new String[]{
|
||||||
String[] arguments = new String[]{
|
Config.getInstance().getPathFor(MkvToolNix.MKV_MERGE),
|
||||||
command,
|
|
||||||
"--identify",
|
"--identify",
|
||||||
"--identification-format",
|
"--identification-format",
|
||||||
"json",
|
"json",
|
||||||
file.getAbsoluteFile().toString()
|
file.getAbsolutePath()
|
||||||
};
|
};
|
||||||
|
|
||||||
InputStream inputStream = Runtime.getRuntime().exec(arguments).getInputStream();
|
log.debug("{}", String.join(" ", command));
|
||||||
|
InputStream inputStream = Runtime.getRuntime().exec(command)
|
||||||
|
.getInputStream();
|
||||||
jsonMap = mapper.readValue(inputStream, Map.class);
|
jsonMap = mapper.readValue(inputStream, Map.class);
|
||||||
List<Map<String, Object>> tracks = (List<Map<String, Object>>) jsonMap.get("tracks");
|
List<Map<String, Object>> tracks = (List<Map<String, Object>>) jsonMap.get("tracks");
|
||||||
if (tracks == null) {
|
if (tracks == null) {
|
||||||
@@ -154,7 +155,7 @@ public class MkvFileProcessor implements FileProcessor {
|
|||||||
|
|
||||||
if (fileInfo.isAudioDifferent()) {
|
if (fileInfo.isAudioDifferent()) {
|
||||||
if (fileInfo.getExistingDefaultAudioLanes() != null && !fileInfo.getExistingDefaultAudioLanes().isEmpty()) {
|
if (fileInfo.getExistingDefaultAudioLanes() != null && !fileInfo.getExistingDefaultAudioLanes().isEmpty()) {
|
||||||
for (FileAttribute track: fileInfo.getExistingDefaultAudioLanes()) {
|
for (FileAttribute track : fileInfo.getExistingDefaultAudioLanes()) {
|
||||||
sb.append(format(DISABLE_DEFAULT_TRACK, track.getId()));
|
sb.append(format(DISABLE_DEFAULT_TRACK, track.getId()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -162,14 +163,14 @@ public class MkvFileProcessor implements FileProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!fileInfo.getExistingForcedAudioLanes().isEmpty()) {
|
if (!fileInfo.getExistingForcedAudioLanes().isEmpty()) {
|
||||||
for (FileAttribute track: fileInfo.getExistingForcedAudioLanes()) {
|
for (FileAttribute track : fileInfo.getExistingForcedAudioLanes()) {
|
||||||
sb.append(format(DISABLE_FORCED_TRACK, track.getId()));
|
sb.append(format(DISABLE_FORCED_TRACK, track.getId()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fileInfo.isSubtitleDifferent()) {
|
if (fileInfo.isSubtitleDifferent()) {
|
||||||
if (fileInfo.getExistingDefaultSubtitleLanes() != null && !fileInfo.getExistingDefaultSubtitleLanes().isEmpty()) {
|
if (fileInfo.getExistingDefaultSubtitleLanes() != null && !fileInfo.getExistingDefaultSubtitleLanes().isEmpty()) {
|
||||||
for (FileAttribute track: fileInfo.getExistingDefaultSubtitleLanes()) {
|
for (FileAttribute track : fileInfo.getExistingDefaultSubtitleLanes()) {
|
||||||
sb.append(format(DISABLE_DEFAULT_TRACK, track.getId()));
|
sb.append(format(DISABLE_DEFAULT_TRACK, track.getId()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ Configuration:
|
|||||||
Appenders:
|
Appenders:
|
||||||
RollingFile:
|
RollingFile:
|
||||||
name: FileAppender
|
name: FileAppender
|
||||||
fileName: /var/log/MKVAudioSubtitleChanger/application.log
|
fileName: ${sys:user.home}/.local/mkvaudiosubtitlechanger/logs/application.log
|
||||||
filePattern: /var/log/MKVAudioSubtitleChanger/archive/application-%d{yyyy-MM-dd}-%i.log.gz
|
filePattern: ${sys:user.home}/.local/mkvaudiosubtitlechanger/logs/archive/application-%d{yyyy-MM-dd}-%i.log.gz
|
||||||
PatternLayout:
|
PatternLayout:
|
||||||
Pattern: "%d{DEFAULT} | %-5level | %thread | %msg %n %throwable"
|
Pattern: "%d{DEFAULT} | %-5level | %thread | %msg %n %throwable"
|
||||||
ThresholdFilter:
|
ThresholdFilter:
|
||||||
|
|||||||
Reference in New Issue
Block a user