mirror of
https://github.com/RatzzFatzz/MKVAudioSubtitleChanger.git
synced 2026-02-11 18:15:57 +01:00
Add basic date filter
This commit is contained in:
@@ -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"));
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user