Fix execution on linux

This commit is contained in:
RatzzFatzz
2025-02-18 19:15:02 +01:00
parent e81b06f6fa
commit 8f38abcf3a
2 changed files with 11 additions and 10 deletions

View File

@@ -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) {

View File

@@ -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: