From 44d2601d3ec014b454b1b9fbb3a47471198e1de6 Mon Sep 17 00:00:00 2001 From: RatzzFatzz Date: Tue, 4 Feb 2025 13:49:19 +0100 Subject: [PATCH] Update config parameters and descriptions --- .../mkvaudiosubtitlechanger/Main.java | 7 +++--- .../config/Config.java | 23 ++++++++++--------- .../config/SetConfigParameterTest.java | 18 +++++++-------- 3 files changed, 25 insertions(+), 23 deletions(-) diff --git a/src/main/java/at/pcgamingfreaks/mkvaudiosubtitlechanger/Main.java b/src/main/java/at/pcgamingfreaks/mkvaudiosubtitlechanger/Main.java index 3ca455f..89e5b6b 100644 --- a/src/main/java/at/pcgamingfreaks/mkvaudiosubtitlechanger/Main.java +++ b/src/main/java/at/pcgamingfreaks/mkvaudiosubtitlechanger/Main.java @@ -18,11 +18,12 @@ import java.util.Set; @Slf4j @CommandLine.Command( - name = "mkvasc", + name = "mkvaudiosubtitlechanger", usageHelpWidth = 120, customSynopsis = { - "mkvasc -a ... -l [-s]", - "Example: mkvasc -a eng:eng eng:ger -l /mnt/media/ -s" + "mkvaudiosubtitlechanger -a ... -l [-s]", + "Example: mkvaudiosubtitlechanger -a eng:eng eng:ger -l /mnt/media/ -s", + "" }, mixinStandardHelpOptions = true, versionProvider = ProjectUtil.class diff --git a/src/main/java/at/pcgamingfreaks/mkvaudiosubtitlechanger/config/Config.java b/src/main/java/at/pcgamingfreaks/mkvaudiosubtitlechanger/config/Config.java index e7364cf..02736c7 100644 --- a/src/main/java/at/pcgamingfreaks/mkvaudiosubtitlechanger/config/Config.java +++ b/src/main/java/at/pcgamingfreaks/mkvaudiosubtitlechanger/config/Config.java @@ -30,7 +30,8 @@ public class Config { @CommandLine.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; @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") 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; @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; @@ -61,15 +62,15 @@ public class Config { description = "Directories to be excluded, combines with config file") private Set excludedDirectories = new HashSet<>(); - @CommandLine.Option(names = {"-fk", "--force-keywords"}, arity = "1..*", - description = "Additional keywords to identify forced tracks (Defaults are will be overwritten; Default: ${DEFAULT-VALUE}") - private Set forcedKeywords = new HashSet<>(Arrays.asList("forced", "signs", "songs")); - @CommandLine.Option(names = {"-ck", "--commentary-keywords"}, arity = "1..*", - description = "Additional keywords to identify commentary tracks (Defaults are will be overwritten; Default: ${DEFAULT-VALUE}") - private Set commentaryKeywords = new HashSet<>(Arrays.asList("commentary", "director")); - @CommandLine.Option(names = {"-ps", "--preferred-subtiltes"}, arity = "1..*", - description = "Additional keywords to prefer specific subtitle tracks (Defaults are will be overwritten; Default: ${DEFAULT-VALUE}") - private Set preferredSubtitles = new HashSet<>(Arrays.asList("unstyled")); + @CommandLine.Option(names = {"--forced-keywords"}, arity = "1..*", defaultValue = "forced, signs, songs", split = ", ", + description = "Keywords to identify forced tracks (Defaults will be overwritten; Default: ${DEFAULT-VALUE})") + private Set forcedKeywords; + @CommandLine.Option(names = {"--commentary-keywords"}, arity = "1..*", defaultValue = "commentary, director", split = ", ", + description = "Keywords to identify commentary tracks (Defaults will be overwritten; Default: ${DEFAULT-VALUE})") + private Set commentaryKeywords; + @CommandLine.Option(names = {"--preferred-subtitles"}, arity = "1..*", defaultValue = "unstyled", split = ", ", + description = "Keywords to prefer specific subtitle tracks (Defaults will be overwritten; Default: ${DEFAULT-VALUE})") + private Set preferredSubtitles; @CommandLine.Option(names = {"-l", "--library"}, required = true, description = "path to library") public void setLibraryPath(File libraryPath) { diff --git a/src/test/java/at/pcgamingfreaks/mkvaudiosubtitlechanger/config/SetConfigParameterTest.java b/src/test/java/at/pcgamingfreaks/mkvaudiosubtitlechanger/config/SetConfigParameterTest.java index 62988f7..61b8a29 100644 --- a/src/test/java/at/pcgamingfreaks/mkvaudiosubtitlechanger/config/SetConfigParameterTest.java +++ b/src/test/java/at/pcgamingfreaks/mkvaudiosubtitlechanger/config/SetConfigParameterTest.java @@ -19,14 +19,14 @@ class SetConfigParameterTest { private static Stream provideTestCases() { return Stream.of( - Arguments.of(args("-ck", "test"), 1, (Function>) Config::getCommentaryKeywords), - Arguments.of(args("-ck", "test", "test1", "test2", "test3", "test4"), 5, (Function>) Config::getCommentaryKeywords), + Arguments.of(args("--commentary-keywords", "test"), 1, (Function>) Config::getCommentaryKeywords), + Arguments.of(args("--commentary-keywords", "test", "test1", "test2", "test3", "test4"), 5, (Function>) Config::getCommentaryKeywords), Arguments.of(args(), 2, (Function>) Config::getCommentaryKeywords), - Arguments.of(args("-fk", "test"), 1, (Function>) Config::getForcedKeywords), - Arguments.of(args("-fk", "test", "test1", "test2", "test3", "test4"), 5, (Function>) Config::getForcedKeywords), + Arguments.of(args("--forced-keywords", "test"), 1, (Function>) Config::getForcedKeywords), + Arguments.of(args("--forced-keywords", "test", "test1", "test2", "test3", "test4"), 5, (Function>) Config::getForcedKeywords), Arguments.of(args(), 3, (Function>) Config::getForcedKeywords), - Arguments.of(args("-ps", "test"), 1, (Function>) Config::getPreferredSubtitles), - Arguments.of(args("-ps", "test", "test1", "test2", "test3", "test4"), 5, (Function>) Config::getPreferredSubtitles), + Arguments.of(args("--preferred-subtitles", "test"), 1, (Function>) Config::getPreferredSubtitles), + Arguments.of(args("--preferred-subtitles", "test", "test1", "test2", "test3", "test4"), 5, (Function>) Config::getPreferredSubtitles), Arguments.of(args(), 1, (Function>) Config::getPreferredSubtitles) ); } @@ -42,9 +42,9 @@ class SetConfigParameterTest { @Test void validate() { Main sut = new Main(); - assertThrows(CommandLine.MissingParameterException.class, () -> CommandLine.populateCommand(sut, args("-ck"))); - assertThrows(CommandLine.MissingParameterException.class, () -> CommandLine.populateCommand(sut, args("-fk"))); + assertThrows(CommandLine.MissingParameterException.class, () -> CommandLine.populateCommand(sut, args("--commentary-keywords"))); + 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("-ps"))); + assertThrows(CommandLine.MissingParameterException.class, () -> CommandLine.populateCommand(sut, args("--preferred-subtitles"))); } } \ No newline at end of file