mirror of
https://github.com/RatzzFatzz/MKVAudioSubtitleChanger.git
synced 2026-02-11 10:05:58 +01:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b86c7b98a5 | |||
|
|
69c192c08b | ||
|
|
7dd01234b6 | ||
|
|
8f38abcf3a |
@@ -12,13 +12,11 @@ A streamlined solution for managing MKV files, this program leverages MKVToolNix
|
|||||||
## Execution
|
## Execution
|
||||||
### Minimal usage
|
### Minimal usage
|
||||||
Portable: `java -jar mkvaudiosubtitlechanger-<version>.jar --library "X:/Files" --attribute-config eng:ger eng:OFF`
|
Portable: `java -jar mkvaudiosubtitlechanger-<version>.jar --library "X:/Files" --attribute-config eng:ger eng:OFF`
|
||||||
|
Windows & Linux (installed): `mkvaudiosubtitlechanger --library "X:/Files" --attribute-config eng:ger eng:OFF`
|
||||||
Windows (installed): `mkvaudiosubtitlechanger.jar --library "X:/Files" --attribute-config eng:ger eng:OFF`
|
|
||||||
|
|
||||||
### Safe usage (best for testing before applying to whole library)
|
### Safe usage (best for testing before applying to whole library)
|
||||||
Portable: `java -jar mkvaudiosubtitlechanger-<version>.jar --library "X:/Files" --attribute-config eng:ger eng:OFF --safe-mode`
|
Portable: `java -jar mkvaudiosubtitlechanger-<version>.jar --library "X:/Files" --attribute-config eng:ger eng:OFF --safe-mode`
|
||||||
|
Windows & Linux (installed): `mkvaudiosubtitlechanger --library "X:/Files" --attribute-config eng:ger eng:OFF --safe-mode`
|
||||||
Windows (installed): `mkvaudiosubtitlechanger.jar --library "X:/Files" --attribute-config eng:ger eng:OFF --safe-mode`
|
|
||||||
|
|
||||||
**Attribute-config must be entered in pairs: `audio:subtitle`; Example: `jpn:eng`. More about this topic
|
**Attribute-config must be entered in pairs: `audio:subtitle`; Example: `jpn:eng`. More about this topic
|
||||||
[here](https://github.com/RatzzFatzz/MKVAudioSubtitleChanger/wiki/Attribute-Config).**
|
[here](https://github.com/RatzzFatzz/MKVAudioSubtitleChanger/wiki/Attribute-Config).**
|
||||||
|
|||||||
5
pom.xml
5
pom.xml
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>at.pcgamingfreaks</groupId>
|
<groupId>at.pcgamingfreaks</groupId>
|
||||||
<artifactId>MKVAudioSubtitleChanger</artifactId>
|
<artifactId>MKVAudioSubtitleChanger</artifactId>
|
||||||
<version>4.0.0</version>
|
<version>4.0.2</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<mainClass>at.pcgamingfreaks.mkvaudiosubtitlechanger.Main</mainClass>
|
<mainClass>at.pcgamingfreaks.mkvaudiosubtitlechanger.Main</mainClass>
|
||||||
@@ -27,8 +27,7 @@
|
|||||||
<resource>
|
<resource>
|
||||||
<directory>src/main/resources</directory>
|
<directory>src/main/resources</directory>
|
||||||
<includes>
|
<includes>
|
||||||
<include>log4j2.yml</include>
|
<include>log4j2.yaml</include>
|
||||||
<include>log4j2-debug.yml</include>
|
|
||||||
</includes>
|
</includes>
|
||||||
</resource>
|
</resource>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -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