Cleanup code and prepare for AI usage

This commit is contained in:
2026-07-27 21:24:35 +02:00
parent feaaa3fc83
commit c698008b0c
35 changed files with 579 additions and 486 deletions
@@ -1,45 +1,14 @@
package de.jeyp91.googlecalendar;
import com.google.common.io.Resources;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import java.io.IOException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
public class CalendarConfigProvider {
private static JSONObject googleCalendarConfig = null;
private static JSONObject getGoogleCalendarConfig() {
if(googleCalendarConfig == null) {
//JSON parser object to parse read file
JSONParser jsonParser = new JSONParser();
URL url = Resources.getResource("Google_Calendar_Config.json");
String jsonConfig = null;
try {
jsonConfig = Resources.toString(url, StandardCharsets.UTF_8);
//Read JSON file
googleCalendarConfig = (JSONObject) jsonParser.parse(jsonConfig);
} catch (IOException | ParseException e) {
e.printStackTrace();
}
}
return googleCalendarConfig;
}
private static String GOOGLE_CALENDAR_ID = "825f79shtm9n3uknj99iuu2qho";
public static String getCalendarUrl() {
JSONObject leagueConfig = (JSONObject) getGoogleCalendarConfig().get(String.valueOf(1));
return (String) leagueConfig.get("url");
return GOOGLE_CALENDAR_ID + "@group.calendar.google.com";
}
public static String getCalendarId() {
JSONObject leagueConfig = (JSONObject) getGoogleCalendarConfig().get(String.valueOf(1));
return (String) leagueConfig.get("id");
return GOOGLE_CALENDAR_ID;
}
}