mirror of
https://github.com/RatzzFatzz/MKVAudioSubtitleChanger.git
synced 2026-02-11 02:05:56 +01:00
Add preferred-subtitle parameter
This commit is contained in:
@@ -28,6 +28,7 @@ public class ConfigLoader {
|
|||||||
new SetValidator(FORCED_KEYWORDS, false, true),
|
new SetValidator(FORCED_KEYWORDS, false, true),
|
||||||
new SetValidator(COMMENTARY_KEYWORDS, false, true),
|
new SetValidator(COMMENTARY_KEYWORDS, false, true),
|
||||||
new SetValidator(EXCLUDED_DIRECTORY, false, true),
|
new SetValidator(EXCLUDED_DIRECTORY, false, true),
|
||||||
|
new SetValidator(PREFERRED_SUBTITLES, false, true),
|
||||||
new AttributeConfigValidator(),
|
new AttributeConfigValidator(),
|
||||||
new CoherentConfigValidator(COHERENT, false),
|
new CoherentConfigValidator(COHERENT, false),
|
||||||
new BooleanValidator(FORCE_COHERENT, false)
|
new BooleanValidator(FORCE_COHERENT, false)
|
||||||
|
|||||||
@@ -23,10 +23,26 @@ public enum ConfigProperty {
|
|||||||
EXCLUDED_DIRECTORY("excluded-directories", "Directories to be excluded, combines with config file", "e", Option.UNLIMITED_VALUES),
|
EXCLUDED_DIRECTORY("excluded-directories", "Directories to be excluded, combines with config file", "e", Option.UNLIMITED_VALUES),
|
||||||
FORCED_KEYWORDS("forced-keywords", "Additional keywords to identify forced tracks", "fk", Option.UNLIMITED_VALUES),
|
FORCED_KEYWORDS("forced-keywords", "Additional keywords to identify forced tracks", "fk", Option.UNLIMITED_VALUES),
|
||||||
COMMENTARY_KEYWORDS("commentary-keywords", "Additional keywords to identify commentary tracks", "ck", Option.UNLIMITED_VALUES),
|
COMMENTARY_KEYWORDS("commentary-keywords", "Additional keywords to identify commentary tracks", "ck", Option.UNLIMITED_VALUES),
|
||||||
|
PREFERRED_SUBTITLES("preferred-subtitles", "Additional keywords to prefer specific subtitle tracks", "ps", Option.UNLIMITED_VALUES),
|
||||||
ARGUMENTS("arguments", "List of arguments", null, 0),
|
ARGUMENTS("arguments", "List of arguments", null, 0),
|
||||||
VERSION("version", "Display version", "v", 0),
|
VERSION("version", "Display version", "v", 0),
|
||||||
HELP("help", "\"For help this is\" - Yoda", "h", 0);
|
HELP("help", "\"For help this is\" - Yoda", "h", 0);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Verify at startup that there are no duplicated shortParameters.
|
||||||
|
*/
|
||||||
|
static {
|
||||||
|
Set<String> shortParameters = new HashSet<>();
|
||||||
|
for (String param : Arrays.stream(ConfigProperty.values()).map(ConfigProperty::abrv).collect(Collectors.toList())) {
|
||||||
|
if (shortParameters.contains(param)) {
|
||||||
|
throw new IllegalStateException("It is not allowed to have multiple properties with the same abbreviation!");
|
||||||
|
}
|
||||||
|
if (param != null) {
|
||||||
|
shortParameters.add(param);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private final String property;
|
private final String property;
|
||||||
private final String description;
|
private final String description;
|
||||||
private final String shortParameter;
|
private final String shortParameter;
|
||||||
@@ -47,19 +63,4 @@ public enum ConfigProperty {
|
|||||||
public int args() {
|
public int args() {
|
||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Verify at startup that there are no duplicated shortParameters.
|
|
||||||
*/
|
|
||||||
static {
|
|
||||||
Set<String> shortParameters = new HashSet<>();
|
|
||||||
for (String param: Arrays.stream(ConfigProperty.values()).map(ConfigProperty::abrv).collect(Collectors.toList())) {
|
|
||||||
if (shortParameters.contains(param)) {
|
|
||||||
throw new IllegalStateException("It is not allowed to have multiple properties with the same abbreviation!");
|
|
||||||
}
|
|
||||||
if (param != null) {
|
|
||||||
shortParameters.add(param);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user