mirror of
https://github.com/RatzzFatzz/MKVAudioSubtitleChanger.git
synced 2026-02-11 02:05:56 +01:00
Remove attribute config as required option
This commit is contained in:
@@ -1,11 +1,6 @@
|
||||
package at.pcgamingfreaks.mkvaudiosubtitlechanger.impl;
|
||||
|
||||
import at.pcgamingfreaks.mkvaudiosubtitlechanger.impl.processors.AttributeUpdater;
|
||||
import at.pcgamingfreaks.mkvaudiosubtitlechanger.impl.processors.CoherentAttributeUpdater;
|
||||
import at.pcgamingfreaks.mkvaudiosubtitlechanger.impl.processors.SingleFileAttributeUpdater;
|
||||
import at.pcgamingfreaks.mkvaudiosubtitlechanger.impl.processors.CachedFileProcessor;
|
||||
import at.pcgamingfreaks.mkvaudiosubtitlechanger.impl.processors.FileProcessor;
|
||||
import at.pcgamingfreaks.mkvaudiosubtitlechanger.impl.processors.MkvFileProcessor;
|
||||
import at.pcgamingfreaks.mkvaudiosubtitlechanger.impl.processors.*;
|
||||
import at.pcgamingfreaks.mkvaudiosubtitlechanger.model.InputConfig;
|
||||
import at.pcgamingfreaks.mkvaudiosubtitlechanger.util.ProjectUtil;
|
||||
import lombok.Getter;
|
||||
@@ -19,8 +14,8 @@ import picocli.CommandLine;
|
||||
name = "mkvaudiosubtitlechanger",
|
||||
usageHelpAutoWidth = true,
|
||||
customSynopsis = {
|
||||
"mkvaudiosubtitlechanger -a <attributeConfig> [...<attributeConfig>] -l <libraryPath> [-s]",
|
||||
"Example: mkvaudiosubtitlechanger -a eng:eng eng:ger -l /mnt/media/ -s",
|
||||
"mkvaudiosubtitlechanger [-a <attributeConfig> [...<attributeConfig>]] [-s] <libraryPath>",
|
||||
"Example: mkvaudiosubtitlechanger -a eng:eng eng:ger -s /mnt/media/",
|
||||
""
|
||||
},
|
||||
requiredOptionMarker = '*',
|
||||
@@ -41,10 +36,11 @@ public class CommandRunner implements Runnable {
|
||||
|
||||
FileFilter fileFilter = new FileFilter(config.getExcluded(), config.getIncludePattern(), config.getFilterDate());
|
||||
FileProcessor fileProcessor = new CachedFileProcessor(new MkvFileProcessor(config.getMkvToolNix(), fileFilter));
|
||||
AttributeChangeProcessor attributeChangeProcessor = new AttributeChangeProcessor(config.getPreferredSubtitles().toArray(new String[0]), config.getForcedKeywords(), config.getCommentaryKeywords(), config.getHearingImpaired());
|
||||
|
||||
AttributeUpdater kernel = config.getCoherent() != null
|
||||
? new CoherentAttributeUpdater(config, fileProcessor)
|
||||
: new SingleFileAttributeUpdater(config, fileProcessor);
|
||||
? new CoherentAttributeUpdater(config, fileProcessor, attributeChangeProcessor)
|
||||
: new SingleFileAttributeUpdater(config, fileProcessor, attributeChangeProcessor);
|
||||
kernel.execute();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public abstract class AttributeUpdater {
|
||||
|
||||
private final ExecutorService executor;
|
||||
|
||||
public AttributeUpdater(InputConfig config, FileProcessor fileProcessor) {
|
||||
public AttributeUpdater(InputConfig config, FileProcessor fileProcessor, AttributeChangeProcessor attributeChangeProcessor) {
|
||||
this.config = config;
|
||||
this.fileProcessor = fileProcessor;
|
||||
this.attributeChangeProcessor = attributeChangeProcessor;
|
||||
|
||||
@@ -28,12 +28,13 @@ public class InputConfig implements CommandLine.IVersionProvider {
|
||||
@CommandLine.Spec
|
||||
CommandLine.Model.CommandSpec spec;
|
||||
|
||||
@Option(names = {"-a", "--attribute-config"}, required = true, arity = "1..*", converter = AttributeConfigConverter.class,
|
||||
description = "List of audio:subtitle pairs used to match in order and update files accordingly (e.g. jpn:eng jpn:ger)")
|
||||
private AttributeConfig[] attributeConfig;
|
||||
@ValidFile(message = "does not exist")
|
||||
@Option(names = {"-l", "--library"}, required = true, description = "path to library")
|
||||
@CommandLine.Parameters(description = "path to library")
|
||||
private File libraryPath;
|
||||
|
||||
@Option(names = {"-a", "--attribute-config"}, arity = "1..*", converter = AttributeConfigConverter.class,
|
||||
description = "List of audio:subtitle pairs used to match in order and update files accordingly (e.g. jpn:eng jpn:ger)")
|
||||
private AttributeConfig[] attributeConfig = new AttributeConfig[0];
|
||||
@ValidMkvToolNix(message = "does not exist")
|
||||
@Option(names = {"-m", "--mkvtoolnix"}, defaultValue = "${DEFAULT_MKV_TOOL_NIX}", description = "path to mkvtoolnix installation")
|
||||
private File mkvToolNix;
|
||||
@@ -90,8 +91,8 @@ public class InputConfig implements CommandLine.IVersionProvider {
|
||||
return new StringJoiner(", ", InputConfig.class.getSimpleName() + "[", "]")
|
||||
.add("configPath=" + configPath)
|
||||
.add("spec=" + spec)
|
||||
.add("attributeConfig=" + Arrays.toString(attributeConfig))
|
||||
.add("libraryPath=" + libraryPath)
|
||||
.add("attributeConfig=" + Arrays.toString(attributeConfig))
|
||||
.add("mkvToolNix=" + mkvToolNix)
|
||||
.add("safeMode=" + safeMode)
|
||||
.add("threads=" + threads)
|
||||
|
||||
Reference in New Issue
Block a user