Update config parameters and descriptions

This commit is contained in:
RatzzFatzz
2025-02-04 13:49:19 +01:00
parent 36bd93bb50
commit 44d2601d3e
3 changed files with 25 additions and 23 deletions

View File

@@ -18,11 +18,12 @@ import java.util.Set;
@Slf4j @Slf4j
@CommandLine.Command( @CommandLine.Command(
name = "mkvasc", name = "mkvaudiosubtitlechanger",
usageHelpWidth = 120, usageHelpWidth = 120,
customSynopsis = { customSynopsis = {
"mkvasc -a <attributeConfig>... -l <libraryPath> [-s]", "mkvaudiosubtitlechanger -a <attributeConfig>... -l <libraryPath> [-s]",
"Example: mkvasc -a eng:eng eng:ger -l /mnt/media/ -s" "Example: mkvaudiosubtitlechanger -a eng:eng eng:ger -l /mnt/media/ -s",
""
}, },
mixinStandardHelpOptions = true, mixinStandardHelpOptions = true,
versionProvider = ProjectUtil.class versionProvider = ProjectUtil.class

View File

@@ -30,7 +30,8 @@ public class Config {
@CommandLine.Spec @CommandLine.Spec
CommandLine.Model.CommandSpec spec; CommandLine.Model.CommandSpec spec;
@CommandLine.Option(names = {"-a", "--attribute-config"}, required = true, arity = "1..*", converter = AttributeConfigConverter.class) @CommandLine.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 List<AttributeConfig> attributeConfig; private List<AttributeConfig> attributeConfig;
@Setter(AccessLevel.NONE) @Setter(AccessLevel.NONE)
@@ -51,7 +52,7 @@ public class Config {
@CommandLine.Option(names = {"-cf", "--force-coherent"}, description = "changes are only applied if it's a coherent match") @CommandLine.Option(names = {"-cf", "--force-coherent"}, description = "changes are only applied if it's a coherent match")
private boolean forceCoherent; private boolean forceCoherent;
@CommandLine.Option(names = {"-n"}, description = "sets filter-date to last successful execution (overwrites input of filter-date)") @CommandLine.Option(names = {"-n", "--only-new-file"}, description = "sets filter-date to last successful execution (overwrites input of filter-date)")
private boolean onlyNewFiles; private boolean onlyNewFiles;
@CommandLine.Option(names = {"-d", "--filter-date"}, defaultValue = CommandLine.Option.NULL_VALUE, description = "only consider files created newer than entered date (format: \"dd.MM.yyyy-HH:mm:ss\")") @CommandLine.Option(names = {"-d", "--filter-date"}, defaultValue = CommandLine.Option.NULL_VALUE, description = "only consider files created newer than entered date (format: \"dd.MM.yyyy-HH:mm:ss\")")
private Date filterDate; private Date filterDate;
@@ -61,15 +62,15 @@ public class Config {
description = "Directories to be excluded, combines with config file") description = "Directories to be excluded, combines with config file")
private Set<String> excludedDirectories = new HashSet<>(); private Set<String> excludedDirectories = new HashSet<>();
@CommandLine.Option(names = {"-fk", "--force-keywords"}, arity = "1..*", @CommandLine.Option(names = {"--forced-keywords"}, arity = "1..*", defaultValue = "forced, signs, songs", split = ", ",
description = "Additional keywords to identify forced tracks (Defaults are will be overwritten; Default: ${DEFAULT-VALUE}") description = "Keywords to identify forced tracks (Defaults will be overwritten; Default: ${DEFAULT-VALUE})")
private Set<String> forcedKeywords = new HashSet<>(Arrays.asList("forced", "signs", "songs")); private Set<String> forcedKeywords;
@CommandLine.Option(names = {"-ck", "--commentary-keywords"}, arity = "1..*", @CommandLine.Option(names = {"--commentary-keywords"}, arity = "1..*", defaultValue = "commentary, director", split = ", ",
description = "Additional keywords to identify commentary tracks (Defaults are will be overwritten; Default: ${DEFAULT-VALUE}") description = "Keywords to identify commentary tracks (Defaults will be overwritten; Default: ${DEFAULT-VALUE})")
private Set<String> commentaryKeywords = new HashSet<>(Arrays.asList("commentary", "director")); private Set<String> commentaryKeywords;
@CommandLine.Option(names = {"-ps", "--preferred-subtiltes"}, arity = "1..*", @CommandLine.Option(names = {"--preferred-subtitles"}, arity = "1..*", defaultValue = "unstyled", split = ", ",
description = "Additional keywords to prefer specific subtitle tracks (Defaults are will be overwritten; Default: ${DEFAULT-VALUE}") description = "Keywords to prefer specific subtitle tracks (Defaults will be overwritten; Default: ${DEFAULT-VALUE})")
private Set<String> preferredSubtitles = new HashSet<>(Arrays.asList("unstyled")); private Set<String> preferredSubtitles;
@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) {

View File

@@ -19,14 +19,14 @@ class SetConfigParameterTest {
private static Stream<Arguments> provideTestCases() { private static Stream<Arguments> provideTestCases() {
return Stream.of( return Stream.of(
Arguments.of(args("-ck", "test"), 1, (Function<Config, Set<String>>) Config::getCommentaryKeywords), Arguments.of(args("--commentary-keywords", "test"), 1, (Function<Config, Set<String>>) Config::getCommentaryKeywords),
Arguments.of(args("-ck", "test", "test1", "test2", "test3", "test4"), 5, (Function<Config, Set<String>>) Config::getCommentaryKeywords), Arguments.of(args("--commentary-keywords", "test", "test1", "test2", "test3", "test4"), 5, (Function<Config, Set<String>>) Config::getCommentaryKeywords),
Arguments.of(args(), 2, (Function<Config, Set<String>>) Config::getCommentaryKeywords), Arguments.of(args(), 2, (Function<Config, Set<String>>) Config::getCommentaryKeywords),
Arguments.of(args("-fk", "test"), 1, (Function<Config, Set<String>>) Config::getForcedKeywords), Arguments.of(args("--forced-keywords", "test"), 1, (Function<Config, Set<String>>) Config::getForcedKeywords),
Arguments.of(args("-fk", "test", "test1", "test2", "test3", "test4"), 5, (Function<Config, Set<String>>) Config::getForcedKeywords), Arguments.of(args("--forced-keywords", "test", "test1", "test2", "test3", "test4"), 5, (Function<Config, Set<String>>) Config::getForcedKeywords),
Arguments.of(args(), 3, (Function<Config, Set<String>>) Config::getForcedKeywords), Arguments.of(args(), 3, (Function<Config, Set<String>>) Config::getForcedKeywords),
Arguments.of(args("-ps", "test"), 1, (Function<Config, Set<String>>) Config::getPreferredSubtitles), Arguments.of(args("--preferred-subtitles", "test"), 1, (Function<Config, Set<String>>) Config::getPreferredSubtitles),
Arguments.of(args("-ps", "test", "test1", "test2", "test3", "test4"), 5, (Function<Config, Set<String>>) Config::getPreferredSubtitles), Arguments.of(args("--preferred-subtitles", "test", "test1", "test2", "test3", "test4"), 5, (Function<Config, Set<String>>) Config::getPreferredSubtitles),
Arguments.of(args(), 1, (Function<Config, Set<String>>) Config::getPreferredSubtitles) Arguments.of(args(), 1, (Function<Config, Set<String>>) Config::getPreferredSubtitles)
); );
} }
@@ -42,9 +42,9 @@ class SetConfigParameterTest {
@Test @Test
void validate() { void validate() {
Main sut = new Main(); Main sut = new Main();
assertThrows(CommandLine.MissingParameterException.class, () -> CommandLine.populateCommand(sut, args("-ck"))); assertThrows(CommandLine.MissingParameterException.class, () -> CommandLine.populateCommand(sut, args("--commentary-keywords")));
assertThrows(CommandLine.MissingParameterException.class, () -> CommandLine.populateCommand(sut, args("-fk"))); assertThrows(CommandLine.MissingParameterException.class, () -> CommandLine.populateCommand(sut, args("--forced-keywords")));
assertThrows(CommandLine.MissingParameterException.class, () -> CommandLine.populateCommand(sut, args("-e"))); assertThrows(CommandLine.MissingParameterException.class, () -> CommandLine.populateCommand(sut, args("-e")));
assertThrows(CommandLine.MissingParameterException.class, () -> CommandLine.populateCommand(sut, args("-ps"))); assertThrows(CommandLine.MissingParameterException.class, () -> CommandLine.populateCommand(sut, args("--preferred-subtitles")));
} }
} }