minor tweak to Wotufa importer, added AtParty importer

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2025-01-02 19:29:52 +01:00
parent 87c67f4aee
commit c561be4b9c
6 changed files with 256 additions and 9 deletions
@@ -38,8 +38,9 @@ public class Util {
public static final String VCALENDAR = "VCALENDAR";
public static final Pattern GERMAN_DATE_PATTERN = Pattern.compile("^\\D*(\\d\\d?)\\.(\\d\\d?)\\.(\\d{4})\\D");
public static final Pattern GERMAN_DATE_PATTERN_LONG = Pattern.compile("(\\d\\d?)\\.\\s*(\\w+)\\s+(\\d{4})\\D");
public static final Pattern GERMAN_TIME_PATTERN = Pattern.compile("(\\d\\d?):(\\d\\d?)(:(\\d\\d?))?\\D");
private static final Pattern BG_IMAGE_URL = Pattern.compile("background(-image)?:\\surl\\(([^)]+)\\)");
private static final Pattern BG_IMAGE_URL = Pattern.compile("background(-image)?:\\surl\\('?([^)]+)'?\\)");
private static final System.Logger LOG = System.getLogger(Util.class.getSimpleName());
private Util(){}
@@ -110,6 +111,19 @@ public class Util {
return error("Failed to find date");
}
public static Result<LocalDate> parseLongGermanDate(String s){
var match = GERMAN_DATE_PATTERN_LONG.matcher(" "+s+" ");
if (match.find()){
var day = Integer.parseInt(match.group(1));
var res = toNumericMonth(match.group(2));
var month = res.optional();
if (month.isEmpty()) return transform(res);
var year = Integer.parseInt(match.group(3));
return Payload.of(LocalDate.of(year,month.get(),day));
}
return error("Failed to find date");
}
public static Result<LocalTime> parseGermanTime(String s){
var match = GERMAN_TIME_PATTERN.matcher(s);
if (match.find()){