Add basic date filter

This commit is contained in:
2023-04-02 20:11:42 +02:00
parent 943308dd59
commit 7ee51421e0
6 changed files with 93 additions and 2 deletions

View File

@@ -38,6 +38,8 @@ public class Config {
private Integer coherent;
private boolean forceCoherent;
private boolean onlyNewFiles;
private Date filterDate;
private Set<String> forcedKeywords = new HashSet<>(Arrays.asList("forced", "signs", "songs"));
private Set<String> commentaryKeywords = new HashSet<>(Arrays.asList("commentary", "director"));

View File

@@ -24,6 +24,8 @@ public class ConfigLoader {
new ThreadValidator(THREADS, false, 2),
new MkvToolNixPathValidator(MKV_TOOL_NIX, true, Path.of("C:\\Program Files\\MKVToolNix").toFile()),
new BooleanValidator(SAFE_MODE, false),
new BooleanValidator(ONLY_NEW_FILES, false),
new DateValidator(FILTER_DATE, false),
new PatternValidator(INCLUDE_PATTERN, false, Pattern.compile(".*")),
new SetValidator(FORCED_KEYWORDS, false, true),
new SetValidator(COMMENTARY_KEYWORDS, false, true),

View File

@@ -0,0 +1,22 @@
package at.pcgamingfreaks.mkvaudiosubtitlechanger.config.validator;
import at.pcgamingfreaks.mkvaudiosubtitlechanger.model.ConfigProperty;
import at.pcgamingfreaks.mkvaudiosubtitlechanger.util.DateUtils;
import java.util.Date;
public class DateValidator extends ConfigValidator<Date> {
public DateValidator(ConfigProperty property, boolean required) {
super(property, required, null);
}
@Override
Date parse(String value) {
return DateUtils.convert(value); // TODO fix null return value
}
@Override
boolean isValid(Date result) {
return result != null;
}
}