mirror of
https://github.com/RatzzFatzz/MKVAudioSubtitleChanger.git
synced 2026-02-11 10:05:58 +01:00
Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3205969d3b | |||
| d24aedb0af | |||
| b86c7b98a5 | |||
|
|
69c192c08b | ||
|
|
7dd01234b6 | ||
|
|
8f38abcf3a | ||
|
|
fc4e80ead0 | ||
|
|
e81b06f6fa | ||
|
|
dc770c9325 | ||
|
|
471255a09b | ||
|
|
9c8315aec7 | ||
|
|
a075dfb27c |
4
.github/workflows/release.yml
vendored
4
.github/workflows/release.yml
vendored
@@ -92,11 +92,11 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
timezoneWindows: "Berlin Standard Time"
|
timezoneWindows: "Berlin Standard Time"
|
||||||
|
|
||||||
- name: Set up JDK 17
|
- name: Set up JDK 21
|
||||||
uses: actions/setup-java@v4.7.0
|
uses: actions/setup-java@v4.7.0
|
||||||
with:
|
with:
|
||||||
distribution: temurin
|
distribution: temurin
|
||||||
java-version: 17
|
java-version: 21
|
||||||
|
|
||||||
- name: Setup workspace
|
- name: Setup workspace
|
||||||
run: mkdir artifacts
|
run: mkdir artifacts
|
||||||
|
|||||||
@@ -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).**
|
||||||
@@ -33,6 +31,7 @@ Windows (installed): `mkvaudiosubtitlechanger.jar --library "X:/Files" --attribu
|
|||||||
Keywords to identify commentary tracks (Defaults will be overwritten; Default: commentary, director)
|
Keywords to identify commentary tracks (Defaults will be overwritten; Default: commentary, director)
|
||||||
-d, --filter-date=<filterDate>
|
-d, --filter-date=<filterDate>
|
||||||
only consider files created newer than entered date (format: "dd.MM.yyyy-HH:mm:ss")
|
only consider files created newer than entered date (format: "dd.MM.yyyy-HH:mm:ss")
|
||||||
|
--debug Enable debug logging
|
||||||
-e, --excluded-directory=<excludedDirectories>...
|
-e, --excluded-directory=<excludedDirectories>...
|
||||||
Directories to be excluded, combines with config file
|
Directories to be excluded, combines with config file
|
||||||
--forced-keywords=<forcedKeywords>[, <forcedKeywords>...]...
|
--forced-keywords=<forcedKeywords>[, <forcedKeywords>...]...
|
||||||
|
|||||||
@@ -1,34 +0,0 @@
|
|||||||
mkvtoolnix: C:\Program Files\MKVToolNix
|
|
||||||
library: X:/Files
|
|
||||||
|
|
||||||
attribute-config:
|
|
||||||
1:
|
|
||||||
audio: ger
|
|
||||||
subtitle: OFF
|
|
||||||
2:
|
|
||||||
audio: eng
|
|
||||||
subtitle: ger
|
|
||||||
|
|
||||||
# Recommendations for data stored on HDDs, increase when using SSDs
|
|
||||||
#threads: 2
|
|
||||||
|
|
||||||
#forced-keywords: ["forced", "signs"]
|
|
||||||
#commentary-keywords: ["commentary", "director"]
|
|
||||||
#preferred-subtitles: ["unstyled"]
|
|
||||||
|
|
||||||
#exclude-directories:
|
|
||||||
# - "D:/Path/To/File.mkv"
|
|
||||||
# - "D:/Path/To/Directory"
|
|
||||||
|
|
||||||
# If pattern is negated, can be used to exclude files
|
|
||||||
#include-pattern: "regex"
|
|
||||||
|
|
||||||
# Only files newer than
|
|
||||||
#filter-date: 20.03.2021-10:11:12
|
|
||||||
|
|
||||||
safe-mode:
|
|
||||||
#coherent:
|
|
||||||
#force-coherent:
|
|
||||||
#only-new-files:
|
|
||||||
|
|
||||||
|
|
||||||
@@ -14,10 +14,6 @@
|
|||||||
<destName>${project.artifactId}.jar</destName>
|
<destName>${project.artifactId}.jar</destName>
|
||||||
<outputDirectory>/</outputDirectory>
|
<outputDirectory>/</outputDirectory>
|
||||||
</file>
|
</file>
|
||||||
<file>
|
|
||||||
<source>${project.basedir}/config-template.yaml</source>
|
|
||||||
<outputDirectory>/</outputDirectory>
|
|
||||||
</file>
|
|
||||||
<file>
|
<file>
|
||||||
<source></source>
|
<source></source>
|
||||||
</file>
|
</file>
|
||||||
|
|||||||
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>
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ import jakarta.validation.Validation;
|
|||||||
import jakarta.validation.Validator;
|
import jakarta.validation.Validator;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.logging.log4j.Level;
|
||||||
|
import org.apache.logging.log4j.core.config.Configurator;
|
||||||
import picocli.CommandLine;
|
import picocli.CommandLine;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -39,6 +41,9 @@ public class Main implements Runnable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
if (config.isDebug()) {
|
||||||
|
Configurator.setRootLevel(Level.DEBUG);
|
||||||
|
}
|
||||||
validate();
|
validate();
|
||||||
Config.setInstance(config);
|
Config.setInstance(config);
|
||||||
AttributeUpdaterKernel kernel = Config.getInstance().getCoherent() != null
|
AttributeUpdaterKernel kernel = Config.getInstance().getCoherent() != null
|
||||||
|
|||||||
@@ -72,6 +72,9 @@ public class Config {
|
|||||||
description = "Keywords to prefer specific subtitle tracks (Defaults will be overwritten; Default: ${DEFAULT-VALUE})")
|
description = "Keywords to prefer specific subtitle tracks (Defaults will be overwritten; Default: ${DEFAULT-VALUE})")
|
||||||
private Set<String> preferredSubtitles;
|
private Set<String> preferredSubtitles;
|
||||||
|
|
||||||
|
@CommandLine.Option(names = {"--debug"}, description = "Enable debug logging")
|
||||||
|
private boolean debug;
|
||||||
|
|
||||||
@CommandLine.Option(names = {"-l", "--library"}, required = true, description = "path to library")
|
@CommandLine.Option(names = {"-l", "--library"}, required = true, description = "path to library")
|
||||||
public void setLibraryPath(File libraryPath) {
|
public void setLibraryPath(File libraryPath) {
|
||||||
if (!libraryPath.exists()) throw new CommandLine.ParameterException(spec.commandLine(), "Path does not exist: " + libraryPath.getAbsolutePath());
|
if (!libraryPath.exists()) throw new CommandLine.ParameterException(spec.commandLine(), "Path does not exist: " + libraryPath.getAbsolutePath());
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public class DateValidator extends ConfigValidator<Date> {
|
|||||||
YAML yaml = new YAML(lastExecutionFile);
|
YAML yaml = new YAML(lastExecutionFile);
|
||||||
return parse(yaml.getString(Config.getInstance().getNormalizedLibraryPath(), DateUtils.convert(DEFAULT_DATE)));
|
return parse(yaml.getString(Config.getInstance().getNormalizedLibraryPath(), DateUtils.convert(DEFAULT_DATE)));
|
||||||
} catch (YamlInvalidContentException | IOException e) {
|
} catch (YamlInvalidContentException | IOException e) {
|
||||||
log.error("Couldn't open last-execution.properties");
|
log.error("Couldn't open last-execution.properties", e);
|
||||||
return INVALID_DATE;
|
return INVALID_DATE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public class FileFilter {
|
|||||||
BasicFileAttributes attributes = Files.readAttributes(pathName.toPath(), BasicFileAttributes.class);
|
BasicFileAttributes attributes = Files.readAttributes(pathName.toPath(), BasicFileAttributes.class);
|
||||||
return isNewer(DateUtils.convert(attributes.creationTime().toMillis()));
|
return isNewer(DateUtils.convert(attributes.creationTime().toMillis()));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.warn("File attributes could not be read.", e);
|
log.warn("File attributes could not be read", e);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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("Executing '{}': {}", file.getAbsolutePath(), 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) {
|
||||||
@@ -68,7 +69,7 @@ public class MkvFileProcessor implements FileProcessor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log.debug(fileAttributes.toString());
|
log.debug("File attributes of '{}': {}", file.getAbsolutePath(), fileAttributes.toString());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error("File could not be found or loaded: ", e);
|
log.error("File could not be found or loaded: ", e);
|
||||||
System.out.println("File could not be found or loaded: " + file.getAbsolutePath());
|
System.out.println("File could not be found or loaded: " + file.getAbsolutePath());
|
||||||
@@ -148,46 +149,50 @@ public class MkvFileProcessor implements FileProcessor {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void update(File file, FileInfoDto fileInfo) throws IOException, MkvToolNixException {
|
public void update(File file, FileInfoDto fileInfo) throws IOException, MkvToolNixException {
|
||||||
StringBuilder sb = new StringBuilder();
|
List<String> command = new ArrayList<>();
|
||||||
sb.append(format("\"%s\" ", Config.getInstance().getPathFor(MkvToolNix.MKV_PROP_EDIT)));
|
command.add(Config.getInstance().getPathFor(MkvToolNix.MKV_PROP_EDIT));
|
||||||
sb.append(format("\"%s\" ", file.getAbsolutePath()));
|
command.add(String.format(file.getAbsolutePath()));
|
||||||
|
|
||||||
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()));
|
command.addAll(format(DISABLE_DEFAULT_TRACK, track.getId()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sb.append(format(ENABLE_DEFAULT_TRACK, fileInfo.getDesiredDefaultAudioLane().getId()));
|
command.addAll(format(ENABLE_DEFAULT_TRACK, fileInfo.getDesiredDefaultAudioLane().getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
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()));
|
command.addAll(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()));
|
command.addAll(format(DISABLE_DEFAULT_TRACK, track.getId()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (fileInfo.getDesiredDefaultSubtitleLane() != null) {
|
if (fileInfo.getDesiredDefaultSubtitleLane() != null) {
|
||||||
sb.append(format(ENABLE_DEFAULT_TRACK, fileInfo.getDesiredDefaultSubtitleLane().getId()));
|
command.addAll(format(ENABLE_DEFAULT_TRACK, fileInfo.getDesiredDefaultSubtitleLane().getId()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fileInfo.areForcedTracksDifferent()) {
|
if (fileInfo.areForcedTracksDifferent()) {
|
||||||
for (FileAttribute attribute : fileInfo.getDesiredForcedSubtitleLanes()) {
|
for (FileAttribute track : fileInfo.getDesiredForcedSubtitleLanes()) {
|
||||||
sb.append(format(ENABLE_FORCED_TRACK, attribute.getId()));
|
command.addAll(format(ENABLE_FORCED_TRACK, track.getId()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info(sb.toString());
|
log.debug("Executing '{}'", String.join(" ", command));
|
||||||
InputStream inputstream = Runtime.getRuntime().exec(sb.toString()).getInputStream();
|
InputStream inputstream = Runtime.getRuntime().exec(command.toArray(new String[0])).getInputStream();
|
||||||
String output = IOUtils.toString(new InputStreamReader(inputstream));
|
String output = IOUtils.toString(new InputStreamReader(inputstream));
|
||||||
log.debug(output);
|
log.debug("Result: {}", output);
|
||||||
if (output.contains("Error")) throw new MkvToolNixException(output);
|
if (output.contains("Error")) throw new MkvToolNixException(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<String> format(String format, Object... args) {
|
||||||
|
return Arrays.asList(String.format(format, args).split(" "));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ import me.tongfei.progressbar.ProgressBar;
|
|||||||
import me.tongfei.progressbar.ProgressBarBuilder;
|
import me.tongfei.progressbar.ProgressBarBuilder;
|
||||||
import me.tongfei.progressbar.ProgressBarStyle;
|
import me.tongfei.progressbar.ProgressBarStyle;
|
||||||
import net.harawata.appdirs.AppDirsFactory;
|
import net.harawata.appdirs.AppDirsFactory;
|
||||||
import picocli.CommandLine;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -100,6 +99,12 @@ public abstract class AttributeUpdaterKernel {
|
|||||||
FileInfoDto fileInfo = new FileInfoDto(file);
|
FileInfoDto fileInfo = new FileInfoDto(file);
|
||||||
List<FileAttribute> attributes = processor.loadAttributes(file);
|
List<FileAttribute> attributes = processor.loadAttributes(file);
|
||||||
|
|
||||||
|
if (attributes == null || attributes.isEmpty()) {
|
||||||
|
statistic.total();
|
||||||
|
statistic.failure();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
List<FileAttribute> nonForcedTracks = processor.retrieveNonForcedTracks(attributes);
|
List<FileAttribute> nonForcedTracks = processor.retrieveNonForcedTracks(attributes);
|
||||||
List<FileAttribute> nonCommentaryTracks = processor.retrieveNonCommentaryTracks(attributes);
|
List<FileAttribute> nonCommentaryTracks = processor.retrieveNonCommentaryTracks(attributes);
|
||||||
|
|
||||||
@@ -122,7 +127,7 @@ public abstract class AttributeUpdaterKernel {
|
|||||||
statistic.shouldChange();
|
statistic.shouldChange();
|
||||||
commitChange(fileInfoDto);
|
commitChange(fileInfoDto);
|
||||||
break;
|
break;
|
||||||
case UNABLE_TO_APPLY:
|
case NO_SUITABLE_CONFIG:
|
||||||
statistic.noSuitableConfigFound();
|
statistic.noSuitableConfigFound();
|
||||||
break;
|
break;
|
||||||
case ALREADY_SUITED:
|
case ALREADY_SUITED:
|
||||||
@@ -143,10 +148,10 @@ public abstract class AttributeUpdaterKernel {
|
|||||||
try {
|
try {
|
||||||
processor.update(fileInfo.getFile(), fileInfo);
|
processor.update(fileInfo.getFile(), fileInfo);
|
||||||
statistic.success();
|
statistic.success();
|
||||||
log.info("Updated {}", fileInfo.getFile().getAbsolutePath());
|
log.info("Commited {} to '{}'", fileInfo.getMatchedConfig().toStringShort(), fileInfo.getFile().getAbsolutePath());
|
||||||
} catch (IOException | MkvToolNixException e) {
|
} catch (IOException | MkvToolNixException e) {
|
||||||
statistic.failedChanging();
|
statistic.failedChanging();
|
||||||
log.warn("File couldn't be updated: '{}', Error: {}", fileInfo.getFile().getAbsoluteFile(), e.getMessage());
|
log.warn("Couldn't commit {} to '{}'", fileInfo.getMatchedConfig().toStringShort(), fileInfo.getFile().getAbsoluteFile(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ public class CoherentAttributeUpdaterKernel extends AttributeUpdaterKernel {
|
|||||||
|
|
||||||
if (fileInfos.stream().allMatch(elem -> ("OFF".equals(config.getSubtitleLanguage()) || elem.getDesiredDefaultSubtitleLane() != null)
|
if (fileInfos.stream().allMatch(elem -> ("OFF".equals(config.getSubtitleLanguage()) || elem.getDesiredDefaultSubtitleLane() != null)
|
||||||
&& elem.getDesiredDefaultAudioLane() != null)) {
|
&& elem.getDesiredDefaultAudioLane() != null)) {
|
||||||
log.info("Found {}/{} match for {}", config.getAudioLanguage(), config.getSubtitleLanguage(), file.getAbsolutePath());
|
log.info("Found {} match for {}", config.toStringShort(), file.getAbsolutePath());
|
||||||
fileInfos.forEach(this::updateFile);
|
fileInfos.forEach(this::updateFile);
|
||||||
return; // match found, end process here
|
return; // match found, end process here
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,10 @@ public class AttributeConfig {
|
|||||||
return Objects.hash(audioLanguage, subtitleLanguage);
|
return Objects.hash(audioLanguage, subtitleLanguage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String toStringShort() {
|
||||||
|
return audioLanguage + ":" + subtitleLanguage;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "AttributeConfig{"
|
return "AttributeConfig{"
|
||||||
|
|||||||
@@ -40,8 +40,9 @@ public class FileInfoDto {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isSubtitleOFF() {
|
private boolean isSubtitleOFF() {
|
||||||
return desiredDefaultSubtitleLane == null && "OFF".equals(matchedConfig.getSubtitleLanguage()) &&
|
return desiredDefaultSubtitleLane == null
|
||||||
(existingDefaultSubtitleLanes != null && !existingDefaultSubtitleLanes.isEmpty());
|
&& (matchedConfig != null && "OFF".equals(matchedConfig.getSubtitleLanguage()))
|
||||||
|
&& (existingDefaultSubtitleLanes != null && !existingDefaultSubtitleLanes.isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean areForcedTracksDifferent() {
|
public boolean areForcedTracksDifferent() {
|
||||||
@@ -50,7 +51,7 @@ public class FileInfoDto {
|
|||||||
|
|
||||||
public FileStatus getStatus() {
|
public FileStatus getStatus() {
|
||||||
if (isChangeNecessary()) return FileStatus.CHANGE_NECESSARY;
|
if (isChangeNecessary()) return FileStatus.CHANGE_NECESSARY;
|
||||||
if (isUnableToApplyConfig()) return FileStatus.UNABLE_TO_APPLY;
|
if (isUnableToApplyConfig()) return FileStatus.NO_SUITABLE_CONFIG;
|
||||||
if (isAlreadySuitable()) return FileStatus.ALREADY_SUITED;
|
if (isAlreadySuitable()) return FileStatus.ALREADY_SUITED;
|
||||||
return FileStatus.UNKNOWN;
|
return FileStatus.UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package at.pcgamingfreaks.mkvaudiosubtitlechanger.model;
|
|||||||
|
|
||||||
public enum FileStatus {
|
public enum FileStatus {
|
||||||
CHANGE_NECESSARY,
|
CHANGE_NECESSARY,
|
||||||
UNABLE_TO_APPLY,
|
NO_SUITABLE_CONFIG,
|
||||||
ALREADY_SUITED,
|
ALREADY_SUITED,
|
||||||
UNKNOWN;
|
UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ 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 | %C{1} | %msg %n %throwable"
|
||||||
ThresholdFilter:
|
ThresholdFilter:
|
||||||
level: info
|
level: debug
|
||||||
Policies:
|
Policies:
|
||||||
OnStartupTriggeringPolicy:
|
OnStartupTriggeringPolicy:
|
||||||
minSize: 0
|
minSize: 0
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Configuration:
|
|||||||
Console:
|
Console:
|
||||||
name: Console_Out
|
name: Console_Out
|
||||||
PatternLayout:
|
PatternLayout:
|
||||||
Pattern: "%d{DEFAULT} | %-5level | %thread | %msg %n %throwable"
|
Pattern: "%d{DEFAULT} | %-5level | %thread | %C{1} | %msg %n %throwable"
|
||||||
ThresholdFilter:
|
ThresholdFilter:
|
||||||
level: debug
|
level: debug
|
||||||
RollingFile:
|
RollingFile:
|
||||||
@@ -12,7 +12,7 @@ Configuration:
|
|||||||
fileName: logs/application.log
|
fileName: logs/application.log
|
||||||
filePattern: logs/archive/application-%d{yyyy-MM-dd}-%i.log.gz
|
filePattern: 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 | %C{1} | %msg %n %throwable"
|
||||||
ThresholdFilter:
|
ThresholdFilter:
|
||||||
level: debug
|
level: debug
|
||||||
Policies:
|
Policies:
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ Configuration:
|
|||||||
fileName: ${sys:user.home}/AppData/Roaming/MKVAudioSubtitleChanger/logs/application.log
|
fileName: ${sys:user.home}/AppData/Roaming/MKVAudioSubtitleChanger/logs/application.log
|
||||||
filePattern: ${sys:user.home}/AppData/Roaming/MKVAudioSubtitleChanger/logs/archive/application-%d{yyyy-MM-dd}-%i.log.gz
|
filePattern: ${sys:user.home}/AppData/Roaming/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 | %C{1} | %msg %n %throwable"
|
||||||
ThresholdFilter:
|
ThresholdFilter:
|
||||||
level: info
|
level: debug
|
||||||
Policies:
|
Policies:
|
||||||
OnStartupTriggeringPolicy:
|
OnStartupTriggeringPolicy:
|
||||||
minSize: 0
|
minSize: 0
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ Configuration:
|
|||||||
fileName: logs/application.log
|
fileName: logs/application.log
|
||||||
filePattern: logs/archive/application-%d{yyyy-MM-dd}-%i.log.gz
|
filePattern: 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 | %C{1} | %msg %n %throwable"
|
||||||
ThresholdFilter:
|
ThresholdFilter:
|
||||||
level: info
|
level: debug
|
||||||
Policies:
|
Policies:
|
||||||
OnStartupTriggeringPolicy:
|
OnStartupTriggeringPolicy:
|
||||||
minSize: 0
|
minSize: 0
|
||||||
|
|||||||
Reference in New Issue
Block a user