From baffe582047de9538c109046b27724f4004280ff Mon Sep 17 00:00:00 2001 From: Julian Arndt Date: Sun, 26 Jan 2025 22:03:10 +0100 Subject: [PATCH] Refactor API Football to v3 --- .vscode/launch.json | 40 + build.gradle | 36 +- gradle/gradle-daemon-jvm.properties | 2 + gradle/wrapper/gradle-wrapper.properties | 2 +- src/main/java/de/jeyp91/App.java | 26 +- src/main/java/de/jeyp91/ResourceProvider.java | 4 +- src/main/java/de/jeyp91/S3Provider.java | 111 +- .../apifootball/APIFootballConnector.java | 28 +- .../jeyp91/apifootball/APIFootballMatch.java | 78 +- .../APIFootballMatchesProvider.java | 2 +- .../apifootball/APIFootballUpdater.java | 88 +- .../TeamIDMatcherTemplateCreator.java | 2 +- .../java/de/jeyp91/tippliga/TLWMatchday.java | 15 +- .../tippliga/TLWMatchesCreatorFootball.java | 2 +- .../tippligaforum/MatchesListCreator.java | 10 +- .../MatchesListForumUpdater.java | 2 +- src/main/resources/Tippliga/Ligen_v3.json | 97 ++ .../Tippliga_Configs/tl_2025_v3.json | 1231 +++++++++++++++++ .../Tippliga_Configs/wtl_2025_v3.json | 152 ++ src/test/java/de/jeyp91/S3ProviderTest.java | 5 +- .../apifootball/APIFootballUpdaterTest.java | 8 +- .../tippliga/TLWMatchesCreatorTipperTest.java | 4 - .../jeyp91/tippliga/TLWTeamsCreatorTest.java | 5 +- .../tippligaforum/MatchesListCreatorTest.java | 11 +- 24 files changed, 1719 insertions(+), 242 deletions(-) create mode 100644 .vscode/launch.json create mode 100644 gradle/gradle-daemon-jvm.properties create mode 100644 src/main/resources/Tippliga/Ligen_v3.json create mode 100644 src/main/resources/Tippliga_Configs/tl_2025_v3.json create mode 100644 src/main/resources/Tippliga_Configs/wtl_2025_v3.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..aebe6f6 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,40 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "java", + "name": "APIFootballUpdater", + "request": "launch", + "mainClass": "de.jeyp91.App", + "envFile": "${workspaceFolder}/.env", + "args": " --mode APIFootballUpdater --season 2025 --league 1 --configFile Tippliga" + }, + { + "type": "java", + "name": "MatchesUpdaterFootball", + "request": "launch", + "mainClass": "de.jeyp91.App", + "envFile": "${workspaceFolder}/.env", + "args": " --mode MatchesUpdaterFootball --season 2025 --league 1 --configFile Tippliga" + }, + { + "type": "java", + "name": "MatchdaysUpdater", + "request": "launch", + "mainClass": "de.jeyp91.App", + "envFile": "${workspaceFolder}/.env", + "args": " --mode MatchdaysUpdater --season 2025 --league 1 --configFile Tippliga" + }, + { + "type": "java", + "name": "MatchesResultsUpdater", + "request": "launch", + "mainClass": "de.jeyp91.App", + "envFile": "${workspaceFolder}/.env", + "args": " --mode MatchesResultsUpdater --season 2025 --league 2 --configFile Tippliga" + } + ] +} \ No newline at end of file diff --git a/build.gradle b/build.gradle index 704480e..039a7bb 100644 --- a/build.gradle +++ b/build.gradle @@ -2,12 +2,13 @@ * This file was generated by the Gradle 'init' task. */ -apply plugin: 'java' -apply plugin: 'application' +plugins { + id 'com.github.ben-manes.versions' version '0.52.0' + id 'java' + id 'application' +} mainClassName = 'App' -sourceCompatibility = 16 -targetCompatibility = 16 version = '1.0' compileJava.options.encoding = 'UTF-8' compileTestJava.options.encoding = 'UTF-8' @@ -18,23 +19,22 @@ repositories { } dependencies { - implementation 'mysql:mysql-connector-java:8.0.32' + implementation 'mysql:mysql-connector-java:8.0.33' implementation 'org.apache.httpcomponents:httpclient:4.5.14' implementation 'com.googlecode.json-simple:json-simple:1.1.1' - implementation 'com.google.code.gson:gson:2.10.1' - implementation platform('com.amazonaws:aws-java-sdk-bom:1.12.429') - implementation 'com.amazonaws:aws-java-sdk-s3:1.12.429' - implementation 'com.google.auth:google-auth-library-oauth2-http:1.16.0' - implementation 'com.google.api-client:google-api-client:2.2.0' - implementation 'com.google.apis:google-api-services-calendar:v3-rev20220715-2.0.0' - implementation 'com.google.guava:guava:31.1-jre' - implementation 'commons-cli:commons-cli:1.5.0' + implementation 'com.google.code.gson:gson:2.11.0' + implementation 'com.google.auth:google-auth-library-oauth2-http:1.31.0' + implementation 'com.google.api-client:google-api-client:2.7.2' + implementation 'com.google.apis:google-api-services-calendar:v3-rev20250115-2.0.0' + implementation 'com.google.guava:guava:33.4.0-jre' + implementation 'commons-cli:commons-cli:1.9.0' implementation 'net.sourceforge.argparse4j:argparse4j:0.9.0' - implementation 'org.apache.logging.log4j:log4j-api:2.20.0' - implementation 'org.apache.logging.log4j:log4j-core:2.20.0' - implementation 'javax.xml.bind:jaxb-api:2.3.1' + implementation 'org.apache.logging.log4j:log4j-api:3.0.0-beta2' + implementation 'org.apache.logging.log4j:log4j-core:3.0.0-beta2' + implementation 'javax.xml.bind:jaxb-api:2.4.0-b180830.0359' + implementation 'software.amazon.awssdk:s3:2.30.6' testImplementation 'junit:junit:4.13.2' - testImplementation 'org.testng:testng:7.7.0' + testImplementation 'org.testng:testng:7.10.2' } jar { @@ -50,4 +50,4 @@ jar { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } } duplicatesStrategy = DuplicatesStrategy.INCLUDE -} \ No newline at end of file +} diff --git a/gradle/gradle-daemon-jvm.properties b/gradle/gradle-daemon-jvm.properties new file mode 100644 index 0000000..ef4314f --- /dev/null +++ b/gradle/gradle-daemon-jvm.properties @@ -0,0 +1,2 @@ +#This file is generated by updateDaemonJvm +toolchainVersion=22 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 2092c33..e4c3d2e 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ #Tue May 26 17:58:07 CEST 2020 -distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-all.zip +distributionUrl=https://services.gradle.org/distributions/gradle-8.12.1-bin.zip distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStorePath=wrapper/dists diff --git a/src/main/java/de/jeyp91/App.java b/src/main/java/de/jeyp91/App.java index 9868bd3..31bc3be 100644 --- a/src/main/java/de/jeyp91/App.java +++ b/src/main/java/de/jeyp91/App.java @@ -1,15 +1,4 @@ package de.jeyp91; -import de.jeyp91.apifootball.APIFootballUpdater; -import de.jeyp91.googlecalendar.TippligaGoogleEventManager; -import de.jeyp91.tippligaforum.MatchesListForumUpdater; -import de.jeyp91.tippliga.*; -import de.jeyp91.tippligaforum.TippligaConfigProvider; -import de.jeyp91.tippligaforum.TippligaSQLConnector; -import de.jeyp91.whatsapp.WhatsAppNotifier; -import net.sourceforge.argparse4j.ArgumentParsers; -import net.sourceforge.argparse4j.inf.ArgumentParser; -import net.sourceforge.argparse4j.inf.ArgumentParserException; -import net.sourceforge.argparse4j.inf.Namespace; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -19,6 +8,21 @@ import org.apache.logging.log4j.core.config.builder.api.ConfigurationBuilderFact import org.apache.logging.log4j.core.config.builder.api.RootLoggerComponentBuilder; import org.apache.logging.log4j.core.config.builder.impl.BuiltConfiguration; +import de.jeyp91.apifootball.APIFootballUpdater; +import de.jeyp91.tippliga.TLWMatchdaysUpdater; +import de.jeyp91.tippliga.TLWMatchesCreatorFootball; +import de.jeyp91.tippliga.TLWMatchesResultsUpdater; +import de.jeyp91.tippliga.TLWMatchesUpdaterFootball; +import de.jeyp91.tippliga.TLWTeamsUpdater; +import de.jeyp91.tippligaforum.MatchesListForumUpdater; +import de.jeyp91.tippligaforum.TippligaConfigProvider; +import de.jeyp91.tippligaforum.TippligaSQLConnector; +import de.jeyp91.whatsapp.WhatsAppNotifier; +import net.sourceforge.argparse4j.ArgumentParsers; +import net.sourceforge.argparse4j.inf.ArgumentParser; +import net.sourceforge.argparse4j.inf.ArgumentParserException; +import net.sourceforge.argparse4j.inf.Namespace; + /** * Hello world! * diff --git a/src/main/java/de/jeyp91/ResourceProvider.java b/src/main/java/de/jeyp91/ResourceProvider.java index fa1e626..2a0618a 100644 --- a/src/main/java/de/jeyp91/ResourceProvider.java +++ b/src/main/java/de/jeyp91/ResourceProvider.java @@ -27,8 +27,8 @@ public class ResourceProvider { return array; } - public static JSONArray getLigenConfig(int season) { - return getJSONArrayFromResource("Tippliga/" + season + "_Ligen.json"); + public static JSONArray getLigenConfig() { + return getJSONArrayFromResource("Tippliga/Ligen_v3.json"); } public static JSONArray getTeamIDMatcherConfig() { diff --git a/src/main/java/de/jeyp91/S3Provider.java b/src/main/java/de/jeyp91/S3Provider.java index 3492a84..1564421 100644 --- a/src/main/java/de/jeyp91/S3Provider.java +++ b/src/main/java/de/jeyp91/S3Provider.java @@ -1,95 +1,100 @@ package de.jeyp91; -import com.amazonaws.AmazonServiceException; -import com.amazonaws.SdkClientException; -import com.amazonaws.regions.Regions; -import com.amazonaws.services.s3.AmazonS3; -import com.amazonaws.services.s3.AmazonS3ClientBuilder; -import com.amazonaws.services.s3.model.S3Object; -import com.amazonaws.services.s3.model.S3ObjectInputStream; -import org.json.simple.JSONObject; -import org.json.simple.parser.JSONParser; -import org.json.simple.parser.ParseException; - import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; +import java.nio.charset.StandardCharsets; + +import org.json.simple.JSONObject; +import org.json.simple.parser.JSONParser; +import org.json.simple.parser.ParseException; + +import software.amazon.awssdk.auth.credentials.EnvironmentVariableCredentialsProvider; +import software.amazon.awssdk.core.exception.SdkClientException; +import software.amazon.awssdk.core.sync.RequestBody; +import software.amazon.awssdk.regions.Region; +import software.amazon.awssdk.services.s3.S3Client; +import software.amazon.awssdk.services.s3.model.GetObjectRequest; +import software.amazon.awssdk.services.s3.model.PutObjectRequest; +import software.amazon.awssdk.services.s3.model.S3Exception; public class S3Provider { - private static final Regions AWS_DEFAULT_REGION = Regions.EU_CENTRAL_1; + private static final Region AWS_DEFAULT_REGION = Region.EU_CENTRAL_1; private static final String BUCKET_NAME = "tlw-database-tool-api-football-data"; + private final S3Client s3; + + public S3Provider() { + s3 = S3Client.builder() + .region(AWS_DEFAULT_REGION) + .credentialsProvider(EnvironmentVariableCredentialsProvider.create()) + .build(); + } private void writeToS3(String filename, String content) { - final AmazonS3 s3 = AmazonS3ClientBuilder - .standard() - .withRegion(AWS_DEFAULT_REGION) - .build(); try { - s3.putObject(BUCKET_NAME, filename, content); - } catch (AmazonServiceException e) { - System.err.println(e.getErrorMessage()); + this.s3.putObject( + PutObjectRequest.builder() + .bucket(BUCKET_NAME) + .key(filename) + .build(), + RequestBody.fromString(content) + ); + } catch (S3Exception e) { + System.err.println(e.awsErrorDetails().errorMessage()); } } - public void writeFixturesToS3(int league, String content) { - writeToS3("fixtures/" + league + ".json", content); + public void writeFixturesToS3(int season, int league, String content) { + writeToS3(v3Filepath("fixtures", season, league), content); } - public void writeRoundsToS3(int league, String content) { - writeToS3("rounds/" + league + ".json", content); + public void writeRoundsToS3(int season, int league, String content) { + writeToS3(v3Filepath("rounds", season, league), content); } private String getFileFromS3(String filename) { - final AmazonS3 s3 = AmazonS3ClientBuilder - .standard() - .withRegion(AWS_DEFAULT_REGION) - .build(); StringBuilder builder = new StringBuilder(); try { - S3Object o = s3.getObject(BUCKET_NAME, filename); - S3ObjectInputStream s3is = o.getObjectContent(); - BufferedReader reader = new BufferedReader(new InputStreamReader(s3is)); + GetObjectRequest getObjectRequest = GetObjectRequest.builder() + .bucket(BUCKET_NAME) + .key(filename) + .build(); + BufferedReader reader = new BufferedReader(new InputStreamReader( + this.s3.getObject(getObjectRequest), StandardCharsets.UTF_8)); String line; while ((line = reader.readLine()) != null) { builder.append(line); } } catch (SdkClientException | IOException e) { e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + throw e; } return builder.toString(); } - String getFixturesStringFromS3(int league) { - return getFileFromS3("fixtures/" + league + ".json"); + public JSONObject getFixturesJSONFromS3(int season, int league) { + return stringToJSONObject(getFileFromS3(v3Filepath("fixtures", season, league))); } - public JSONObject getFixturesJSONFromS3(int league) { - String fixturesString = getFixturesStringFromS3(league); + public JSONObject getRoundsJSONFromS3(int season, int league) { + return stringToJSONObject(getFileFromS3(v3Filepath("rounds", season, league))); + } + + private JSONObject stringToJSONObject(String rawData) { JSONParser parser = new JSONParser(); - JSONObject jsonObject = null; + JSONObject data = null; try { - jsonObject = (JSONObject) parser.parse(fixturesString); + data = (JSONObject) parser.parse(rawData); } catch (ParseException e) { /* TODO */ e.printStackTrace(); } - return jsonObject; + return data; } - private String getRoundsStringFromS3(int league) { - return getFileFromS3("rounds/" + league + ".json"); - } - - public JSONObject getRoundsJSONFromS3(int league) { - String fixturesString = getRoundsStringFromS3(league); - JSONParser parser = new JSONParser(); - JSONObject jsonObject = null; - try { - jsonObject = (JSONObject) parser.parse(fixturesString); - } catch (ParseException e) { - /* TODO */ - e.printStackTrace(); - } - return jsonObject; - } + private String v3Filepath (String prefix, int season, int league) { + return "v3/" + prefix + "_" + season + "_" + league + ".json"; + } } diff --git a/src/main/java/de/jeyp91/apifootball/APIFootballConnector.java b/src/main/java/de/jeyp91/apifootball/APIFootballConnector.java index 787da93..6355ea3 100644 --- a/src/main/java/de/jeyp91/apifootball/APIFootballConnector.java +++ b/src/main/java/de/jeyp91/apifootball/APIFootballConnector.java @@ -1,14 +1,15 @@ package de.jeyp91.apifootball; -import de.jeyp91.S3Provider; +import java.util.ArrayList; +import java.util.HashMap; + import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; -import java.util.ArrayList; -import java.util.HashMap; +import de.jeyp91.S3Provider; public class APIFootballConnector { @@ -33,7 +34,7 @@ public class APIFootballConnector { APIFootballMatch matchWithID = null; - ArrayList allMatches = getMatchesFromLeagueFromFile(league); + ArrayList allMatches = getMatchesFromLeagueFromFile(this.season, league); for (APIFootballMatch singleMatch : allMatches) { if (singleMatch.getAPIFootBallMatchID() == id) { matchWithID = singleMatch; @@ -48,7 +49,7 @@ public class APIFootballConnector { ArrayList matchesOfMatchday = new ArrayList<>(); - ArrayList allMatches = getMatchesFromLeagueFromFile(league); + ArrayList allMatches = getMatchesFromLeagueFromFile(this.season, league); for (APIFootballMatch singleMatch : allMatches) { if (singleMatch.getMatchday() == matchday) { matchesOfMatchday.add(singleMatch); @@ -58,15 +59,15 @@ public class APIFootballConnector { return matchesOfMatchday; } - public ArrayList getMatchesFromLeagueFromFile(int leagueId) { + public ArrayList getMatchesFromLeagueFromFile(int season, int leagueId) { ArrayList matchesList = new ArrayList<>(); S3Provider prov = new S3Provider(); if(!this.matches.containsKey(leagueId)) { - this.matches.put(leagueId, prov.getFixturesJSONFromS3(leagueId)); + this.matches.put(leagueId, prov.getFixturesJSONFromS3(season, leagueId)); } - JSONObject matches = this.matches.get(leagueId); - JSONArray matchArray = (JSONArray) (((JSONObject)matches.get("api")).get("fixtures")); + JSONObject matchesObject = this.matches.get(leagueId); + JSONArray matchArray = (JSONArray) (matchesObject.get("response")); for(int i = 0; i < matchArray.size(); i++) { try { @@ -83,19 +84,18 @@ public class APIFootballConnector { public JSONObject getMatchdays(int leagueId) { S3Provider prov = new S3Provider(); if(!this.rounds.containsKey(leagueId)) { - this.rounds.put(leagueId, prov.getRoundsJSONFromS3(leagueId)); + this.rounds.put(leagueId, prov.getRoundsJSONFromS3(this.season, leagueId)); } return this.rounds.get(leagueId); } - public JSONObject getTeamsForLeague(int league) throws Exception { - String url = "https://v2.api-football.com/teams/league/" + league; - String content = new APIFootballUpdater().getRawData(url); + public JSONObject getTeamsForLeague(int season, int league) throws Exception { + String requestPath = "teams"; + String content = new APIFootballUpdater().getRawData(requestPath, season, league); return stringToJSONObject(content); } public static JSONObject stringToJSONObject(String rawData) { - JSONParser parser = new JSONParser(); JSONObject data = null; try { diff --git a/src/main/java/de/jeyp91/apifootball/APIFootballMatch.java b/src/main/java/de/jeyp91/apifootball/APIFootballMatch.java index 0813e2a..adc4893 100644 --- a/src/main/java/de/jeyp91/apifootball/APIFootballMatch.java +++ b/src/main/java/de/jeyp91/apifootball/APIFootballMatch.java @@ -1,35 +1,31 @@ package de.jeyp91.apifootball; -import de.jeyp91.BaseMatch; import org.json.simple.JSONArray; import org.json.simple.JSONObject; +import de.jeyp91.BaseMatch; + public class APIFootballMatch extends BaseMatch { private int matchId; private int leagueId; - private String teamNameHome; - private String teamNameGuest; private String round; public APIFootballMatch(JSONObject json, int season) throws Exception { - this.matchId = Integer.parseInt(json.get("fixture_id").toString()); - // TODO - this.leagueId = Integer.parseInt(json.get("league_id").toString()); - this.teamIdHome = Integer.parseInt(((JSONObject) json.get("homeTeam")).get("team_id").toString()); - this.teamIdGuest = Integer.parseInt(((JSONObject) json.get("awayTeam")).get("team_id").toString()); - this.teamNameHome = ((JSONObject) json.get("homeTeam")).get("team_name").toString(); - this.teamNameGuest = ((JSONObject) json.get("awayTeam")).get("team_name").toString(); - this.goalsHome = getNumberOrNull(json.get("goalsHomeTeam")); - this.goalsGuest = getNumberOrNull(json.get("goalsAwayTeam")); - this.round = json.get("round").toString(); + this.matchId = Integer.parseInt(((JSONObject) json.get("fixture")).get("id").toString()); + this.leagueId = Integer.parseInt(((JSONObject) json.get("league")).get("id").toString()); + this.teamIdHome = Integer.valueOf(((JSONObject) ((JSONObject) json.get("teams")).get("home")).get("id").toString()); + this.teamIdGuest = Integer.valueOf(((JSONObject) ((JSONObject) json.get("teams")).get("away")).get("id").toString()); + this.teamNameHome = ((JSONObject) ((JSONObject) json.get("teams")).get("home")).get("name").toString(); + this.teamNameGuest = ((JSONObject) ((JSONObject) json.get("teams")).get("away")).get("name").toString(); + this.round = ((JSONObject) json.get("league")).get("round").toString(); try { this.matchday = getMatchdayFromRoundString(season, this.round, this.leagueId); } catch (Exception e) { throw new Exception("Did not find matchday for league '" + this.leagueId + "': '" + json.get("round").toString() + "'"); } - this.matchDatetime = (String) json.get("event_date"); - this.status = parseStatus(json.get("statusShort").toString()); + this.matchDatetime = (String) ((JSONObject) json.get("fixture")).get("date"); + this.status = parseStatus(((JSONObject) ((JSONObject) json.get("fixture")).get("status")).get("short").toString()); this.parseResult(json); } @@ -39,15 +35,15 @@ public class APIFootballMatch extends BaseMatch { public static int getMatchdayFromRoundString(int season, String round, int leagueId) { round = round.replace(" ", "_"); - Integer matchday = null; + Integer matchday = -1; if (round.startsWith("Regular_Season_-_")) { - matchday = Integer.parseInt(round.replace("Regular_Season_-_", "")); + matchday = Integer.valueOf(round.replace("Regular_Season_-_", "")); } else { APIFootballConnector con = APIFootballConnector.getAPIFootballConnectorInstance(season); JSONObject roundsObject = con.getMatchdays(leagueId); - JSONArray roundsArray = (JSONArray)(((JSONObject) roundsObject.get("api")).get("fixtures")); + JSONArray roundsArray = (JSONArray)(roundsObject.get("response")); for (int i = 0; i < roundsArray.size(); i++) { - if(roundsArray.get(i).toString().equals(round)) { + if(roundsArray.get(i).toString().replace("_", " ").equals(round.replace("_", " "))) { matchday = i + 1; break; } @@ -57,15 +53,7 @@ public class APIFootballMatch extends BaseMatch { } private Integer getNumberOrNull(Object object) { - return object != null ? Integer.parseInt(object.toString()) : null; - } - - public String getTeamNameHome() { - return this.teamNameHome; - } - - public String getTeamNameGuest() { - return this.teamNameGuest; + return object != null ? Integer.valueOf(object.toString()) : null; } public String getRound() { @@ -73,36 +61,24 @@ public class APIFootballMatch extends BaseMatch { } private int parseStatus(String statusShort) { - switch (statusShort) { - case "TBD": - case "NS": return 0; - case "FT": - case "AET": - case "PEN": return 3; - default: return 1; - } + return switch (statusShort) { + case "TBD", "NS" -> 0; + case "FT", "AET", "PEN" -> 3; + default -> 1; + }; } private void parseResult(JSONObject json) { Object resultFulltime = ((JSONObject) json.get("score")).get("fulltime"); - if(resultFulltime != null) { - String[] result = resultFulltime.toString().split("-"); - this.goalsHome = Integer.parseInt(result[0]); - this.goalsGuest = Integer.parseInt(result[1]); - } + this.goalsHome = getNumberOrNull(((JSONObject) resultFulltime).get("home")); + this.goalsGuest = getNumberOrNull(((JSONObject) resultFulltime).get("away")); Object resultExtratime = ((JSONObject) json.get("score")).get("extratime"); - if(resultExtratime != null) { - String[] result = resultExtratime.toString().split("-"); - this.goalsOvertimeHome = this.goalsHome + Integer.parseInt(result[0]); - this.goalsOvertimeGuest = this.goalsGuest + Integer.parseInt(result[1]); - } + this.goalsOvertimeHome = getNumberOrNull(((JSONObject) resultExtratime).get("home")); + this.goalsOvertimeGuest = getNumberOrNull(((JSONObject) resultExtratime).get("away")); Object resultPenalty = ((JSONObject) json.get("score")).get("penalty"); - if(resultPenalty != null) { - String[] result = resultPenalty.toString().split("-"); - this.goalsPenaltyHome = this.goalsOvertimeHome + Integer.parseInt(result[0]); - this.goalsPenaltyGuest = this.goalsOvertimeGuest + Integer.parseInt(result[1]); - } + this.goalsPenaltyHome = getNumberOrNull(((JSONObject) resultPenalty).get("home")); + this.goalsPenaltyGuest = getNumberOrNull(((JSONObject) resultPenalty).get("away")); } } diff --git a/src/main/java/de/jeyp91/apifootball/APIFootballMatchesProvider.java b/src/main/java/de/jeyp91/apifootball/APIFootballMatchesProvider.java index 3c3c0cf..49e7d6d 100644 --- a/src/main/java/de/jeyp91/apifootball/APIFootballMatchesProvider.java +++ b/src/main/java/de/jeyp91/apifootball/APIFootballMatchesProvider.java @@ -9,7 +9,7 @@ public class APIFootballMatchesProvider { APIFootballConnector conn; public APIFootballMatchesProvider(int season) { - this.conn = APIFootballConnector.getAPIFootballConnectorInstance(season - 1); + this.conn = APIFootballConnector.getAPIFootballConnectorInstance(season); } public ArrayList getAPIFootballMatchesFromConfig(JSONObject matchdayConfig) { diff --git a/src/main/java/de/jeyp91/apifootball/APIFootballUpdater.java b/src/main/java/de/jeyp91/apifootball/APIFootballUpdater.java index 7f8f9b5..636d8fa 100644 --- a/src/main/java/de/jeyp91/apifootball/APIFootballUpdater.java +++ b/src/main/java/de/jeyp91/apifootball/APIFootballUpdater.java @@ -1,7 +1,9 @@ package de.jeyp91.apifootball; -import de.jeyp91.ResourceProvider; -import de.jeyp91.S3Provider; +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.util.HashSet; + import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; @@ -12,29 +14,30 @@ import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; -import java.io.*; -import java.util.HashSet; +import de.jeyp91.ResourceProvider; +import de.jeyp91.S3Provider; public class APIFootballUpdater { private static final Logger logger = LogManager.getLogger(APIFootballUpdater.class); + private static final String baseurl = "https://v3.football.api-sports.io/"; public APIFootballUpdater() { } - public void updateFixtures(int league) { - String apiFootballUrl = "https://v2.api-football.com/fixtures/league/" + league + "?timezone=Europe/Berlin"; + public void updateFixtures(int season, int league) { + String requestPath = "fixtures"; S3Provider prov = new S3Provider(); try { - String content = getRawData(apiFootballUrl); - prov.writeFixturesToS3(league, content); + String content = getRawData(requestPath, season, league); + prov.writeFixturesToS3(season, league, content); } catch (Exception e) { if(e.getMessage().toLowerCase().contains("rate limit'")) { try { Thread.sleep(1000 * 60); - String content = getRawData(apiFootballUrl); - prov.writeFixturesToS3(league, content); + String content = getRawData(requestPath, season, league); + prov.writeFixturesToS3(season, league, content); } catch (InterruptedException interruptedException) { interruptedException.printStackTrace(); } catch (Exception exception) { @@ -49,7 +52,7 @@ public class APIFootballUpdater { public void updateAllFixtures(int season) { HashSet leagues = getLeagues(season); for (Integer league : leagues) { - updateFixtures(league); + updateFixtures(season, league); try { Thread.sleep(1000*6); } catch (InterruptedException e) { @@ -61,7 +64,7 @@ public class APIFootballUpdater { public void updateAllRounds(int season) { HashSet leagues = getLeagues(season); for (Integer league : leagues) { - updateRounds(league); + updateRounds(season, league); try { Thread.sleep(1000*6); } catch (InterruptedException e) { @@ -70,18 +73,18 @@ public class APIFootballUpdater { } } - public void updateRounds(int league) { - String apiFootballUrl = "https://v2.api-football.com/fixtures/rounds/" + league; + public void updateRounds(int season, int league) { + String requestPath = "fixtures/rounds"; S3Provider prov = new S3Provider(); try { - String content = getRawData(apiFootballUrl); - prov.writeRoundsToS3(league, content); + String content = getRawData(requestPath, season, league); + prov.writeRoundsToS3(season, league, content); } catch (Exception e) { if(e.getMessage().toLowerCase().contains("rate limit'")) { try { Thread.sleep(1000 * 60); - String content = getRawData(apiFootballUrl); - prov.writeRoundsToS3(league, content); + String content = getRawData(requestPath, season, league); + prov.writeRoundsToS3(season, league, content); } catch (InterruptedException interruptedException) { interruptedException.printStackTrace(); } catch (Exception exception) { @@ -93,46 +96,21 @@ public class APIFootballUpdater { } } - public String getRawData(String requestUrl) throws Exception { + public String getRawData(String requestPath, int season, int league) throws Exception { HttpClient client = HttpClientBuilder.create().build(); + String requestUrl = baseurl + requestPath + "?season=" + (season-1) + "&league=" + league + "&timezone=Europe/Berlin"; HttpGet request = new HttpGet(requestUrl); // add request header - request.addHeader("X-RapidAPI-Key", "a607e6a7437d9d52f3ac73e0b2704d0b"); - - HttpResponse response = null; - try { - response = client.execute(request); - } catch (IOException e) { - /* TODO */ - e.printStackTrace(); - } - - BufferedReader rd = null; - try { - assert response != null; - rd = new BufferedReader( - new InputStreamReader(response.getEntity().getContent()) - ); - } catch (IOException e) { - /* TODO */ - e.printStackTrace(); - } + request.addHeader("x-rapidapi-host", "v3.football.api-sports.io"); + request.addHeader("x-rapidapi-key", "a607e6a7437d9d52f3ac73e0b2704d0b"); + HttpResponse response = client.execute(request); + BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent())); StringBuilder result = new StringBuilder(); - String line = ""; - while (true) { - try { - line = rd.readLine(); - } catch (Exception e) { - /* TODO */ - e.printStackTrace(); - } - - // Stop reading if last line was found. - if (line == null) break; - + String line; + while ((line = rd.readLine()) != null) { result.append(line); } checkErrors(requestUrl, result.toString()); @@ -140,7 +118,7 @@ public class APIFootballUpdater { } public HashSet getLeagues(int season) { - JSONArray leaguesArray = ResourceProvider.getLigenConfig(season); + JSONArray leaguesArray = ResourceProvider.getLigenConfig(); HashSet leagues = new HashSet<>(); for (Object leagueObject : leaguesArray) { JSONObject leagueJSONObject = (JSONObject) leagueObject; @@ -152,10 +130,10 @@ public class APIFootballUpdater { public void checkErrors(String requestUrl, String result) throws Exception { JSONObject resultObject = stringToJSONObject(result); - boolean containsError = ((JSONObject) resultObject.get("api")).containsKey("error"); - int results = Integer.parseInt(((JSONObject) resultObject.get("api")).get("results").toString()); + boolean containsError = !((JSONArray) resultObject.get("errors")).isEmpty(); + int results = Integer.parseInt(resultObject.get("results").toString()); if(containsError) { - String errorMessage = ((JSONObject) resultObject.get("api")).get("error").toString(); + String errorMessage = resultObject.get("errors").toString(); throw new Exception(requestUrl + " returned error: '" + errorMessage + "'"); } else if (results == 0) { String statusMessage = ((JSONObject) resultObject.get("api")).get("status").toString(); diff --git a/src/main/java/de/jeyp91/teamidmatcher/TeamIDMatcherTemplateCreator.java b/src/main/java/de/jeyp91/teamidmatcher/TeamIDMatcherTemplateCreator.java index fe9ddaa..2e8d7e8 100644 --- a/src/main/java/de/jeyp91/teamidmatcher/TeamIDMatcherTemplateCreator.java +++ b/src/main/java/de/jeyp91/teamidmatcher/TeamIDMatcherTemplateCreator.java @@ -10,7 +10,7 @@ public class TeamIDMatcherTemplateCreator { public TeamIDMatcherTemplateCreator(int season, int league) throws Exception { this.con = APIFootballConnector.getAPIFootballConnectorInstance(season); - JSONObject apiObject = con.getTeamsForLeague(league); + JSONObject apiObject = con.getTeamsForLeague(season, league); JSONObject teamsObject = (JSONObject) apiObject.get("api"); this.teams = (JSONArray) teamsObject.get("teams"); } diff --git a/src/main/java/de/jeyp91/tippliga/TLWMatchday.java b/src/main/java/de/jeyp91/tippliga/TLWMatchday.java index 5b59060..73514a3 100644 --- a/src/main/java/de/jeyp91/tippliga/TLWMatchday.java +++ b/src/main/java/de/jeyp91/tippliga/TLWMatchday.java @@ -6,11 +6,6 @@ import java.sql.SQLException; public class TLWMatchday { - final Integer STATUS_NOTSTARTED = 0; - final Integer STATUS_STARTED = 1; - final Integer STATUS_PROVISIONAL_RESULT_AVAILABLE = 2; - final Integer STATUS_FINISHED = 3; - private Integer season = null; private Integer league = null; private Integer matchday = null; @@ -34,15 +29,15 @@ public class TLWMatchday { final int MATCHES = 9; try { - this.season = Integer.parseInt(rset.getString(SEASON)); - this.league = Integer.parseInt(rset.getString(LEAGUE)); - this.matchday = Integer.parseInt(rset.getString(MATCHDAY)); - this.status = Integer.parseInt(rset.getString(STATUS)); + this.season = Integer.valueOf(rset.getString(SEASON)); + this.league = Integer.valueOf(rset.getString(LEAGUE)); + this.matchday = Integer.valueOf(rset.getString(MATCHDAY)); + this.status = Integer.valueOf(rset.getString(STATUS)); this.deliveryDate = rset.getString(DELIVERY_DATE); this.deliveryDate2 = rset.getString(DELIVERY_DATE_2); this.deliveryDate3 = rset.getString(DELIVERY_DATE_3); this.matchdayName = rset.getString(MATCHDAY_NAME); - this.matches = Integer.parseInt(rset.getString(MATCHES)); + this.matches = Integer.valueOf(rset.getString(MATCHES)); } catch (SQLException e) { /* TODO */ e.printStackTrace(); diff --git a/src/main/java/de/jeyp91/tippliga/TLWMatchesCreatorFootball.java b/src/main/java/de/jeyp91/tippliga/TLWMatchesCreatorFootball.java index 8f89e74..efc4f97 100644 --- a/src/main/java/de/jeyp91/tippliga/TLWMatchesCreatorFootball.java +++ b/src/main/java/de/jeyp91/tippliga/TLWMatchesCreatorFootball.java @@ -26,7 +26,7 @@ public class TLWMatchesCreatorFootball extends TLWMatchesCreatorBase { this.season = season; this.league = league; - this.conn = APIFootballConnector.getAPIFootballConnectorInstance(season - 1); + this.conn = APIFootballConnector.getAPIFootballConnectorInstance(season); TippligaConfigProvider prov = new TippligaConfigProvider(season); this.config = prov.getTippligaConfig(configFileName); diff --git a/src/main/java/de/jeyp91/tippligaforum/MatchesListCreator.java b/src/main/java/de/jeyp91/tippligaforum/MatchesListCreator.java index 545951f..1ea4cfc 100644 --- a/src/main/java/de/jeyp91/tippligaforum/MatchesListCreator.java +++ b/src/main/java/de/jeyp91/tippligaforum/MatchesListCreator.java @@ -11,10 +11,14 @@ public class MatchesListCreator { private final JSONObject mainObject = new JSONObject(); private final String country; private final String leagueName; + private int season; + private int league; - public MatchesListCreator(int league) { + public MatchesListCreator(int season, int league) { + this.season = season; + this.league = league; S3Provider prov = new S3Provider(); - JSONObject leagueConfig = prov.getFixturesJSONFromS3(league); + JSONObject leagueConfig = prov.getFixturesJSONFromS3(season, league); JSONObject api = (JSONObject) leagueConfig.get("api"); JSONArray matchesAPIFootball = (JSONArray) api.get("fixtures"); @@ -42,7 +46,7 @@ public class MatchesListCreator { Long leagueId = (Long) matchAPIFootball.get("league_id"); String matchdayString = matchAPIFootball.get("round").toString(); - int matchday = APIFootballMatch.getMatchdayFromRoundString(2021, matchdayString, leagueId.intValue()); + int matchday = APIFootballMatch.getMatchdayFromRoundString(this.season, matchdayString, leagueId.intValue()); String matchtime = matchAPIFootball.get("event_date").toString().replace("T", " ").substring(0, 16); Long fixtureId = (Long) matchAPIFootball.get("fixture_id"); diff --git a/src/main/java/de/jeyp91/tippligaforum/MatchesListForumUpdater.java b/src/main/java/de/jeyp91/tippligaforum/MatchesListForumUpdater.java index 318ce92..2e6ca84 100644 --- a/src/main/java/de/jeyp91/tippligaforum/MatchesListForumUpdater.java +++ b/src/main/java/de/jeyp91/tippligaforum/MatchesListForumUpdater.java @@ -24,7 +24,7 @@ public class MatchesListForumUpdater { } public void updateLeague(int season, int league) { - MatchesListCreator creator = new MatchesListCreator(league); + MatchesListCreator creator = new MatchesListCreator(season, league); String content = creator.getMatchesBeautiful(); String contentWithCodeBBCode = "[code]" + content + "[/code]"; Integer postId = getPostId(season, creator.getCountry(), creator.getLeagueName()); diff --git a/src/main/resources/Tippliga/Ligen_v3.json b/src/main/resources/Tippliga/Ligen_v3.json new file mode 100644 index 0000000..4ef55bf --- /dev/null +++ b/src/main/resources/Tippliga/Ligen_v3.json @@ -0,0 +1,97 @@ +[ + { + "country": "Germany", + "name": "Bundesliga", + "league_id": 78 + }, + { + "country": "Germany", + "name": "2. Bundesliga", + "league_id": 79 + }, + { + "country": "Germany", + "name": "3. Liga", + "league_id": 80 + }, + { + "country": "Germany", + "name": "Regionalliga - Bayern", + "league_id": 83 + }, + { + "country": "Germany", + "name": "Regionalliga - SudWest", + "league_id": 86 + }, + { + "country": "Germany", + "name": "U19 Bundesliga", + "league_id": 488 + }, + { + "country": "Germany", + "name": "Frauen Bundesliga", + "league_id": 82 + }, + { + "country": "Germany", + "name": "DFB Pokal", + "league_id": 81 + }, + { + "country": "Germany", + "name": "Super Cup", + "league_id": 529 + }, + { + "country": "England", + "name": "Premier League", + "league_id": 39 + }, + { + "country": "Spain", + "name": "La Liga", + "league_id": 140 + }, + { + "country": "Italy", + "name": "Serie A", + "league_id": 135 + }, + { + "country": "France", + "name": "Ligue 1", + "league_id": 61 + }, + { + "country": "Turkey", + "name": "Süper Lig", + "league_id": 203 + }, + { + "country": "Netherlands", + "name": "Eredivisie", + "league_id": 88 + }, + { + "country": "World", + "name": "UEFA Champions League", + "league_id": 2 + }, + { + "country": "World", + "name": "UEFA Europa League", + "league_id": 3 + }, + { + "country": "World", + "name": "UEFA Europa Conference League", + "league_id": 848 + }, + { + "country": "World", + "name": "UEFA Super Cup", + "league_id": 531 + } +] \ No newline at end of file diff --git a/src/main/resources/Tippliga_Configs/tl_2025_v3.json b/src/main/resources/Tippliga_Configs/tl_2025_v3.json new file mode 100644 index 0000000..84502ad --- /dev/null +++ b/src/main/resources/Tippliga_Configs/tl_2025_v3.json @@ -0,0 +1,1231 @@ +{ + "numberOfMatchdays": 39, + "matchesPerMatchday": 12, + "pointMode": 4, + "pointsTendency": 1, + "pointsDifference": 2, + "pointsDirectHit": 3, + "ko": 0, + "matchdayConfig": [ + { + "TLWMatchday": 1, + "matchesConfig": [ + { + "type": "AllMatchesOfMatchday", + "matchesLeague": 79, + "leagueMatchday": 1, + "showTable": false + }, + { + "matchday": 1, + "matchtime": "2024-08-02 19:00", + "match": "TSV 1860 Munich - FC Saarbrücken", + "showTable": false, + "matchLeague": 80, + "type": "SingleMatch", + "matchId": 1236707 + }, + { + "matchday": 1, + "matchtime": "2024-08-03 14:00", + "match": "Rot-weiss Essen - Alemannia Aachen", + "showTable": false, + "matchLeague": 80, + "type": "SingleMatch", + "matchId": 1236708 + }, + { + "matchday": 1, + "matchtime": "2024-08-04 16:30", + "match": "Energie Cottbus - Arminia Bielefeld", + "showTable": false, + "matchLeague": 80, + "type": "SingleMatch", + "matchId": 1236715 + } + ] + }, + { + "TLWMatchday": 2, + "matchesConfig": [ + { + "type": "AllMatchesOfMatchday", + "matchesLeague": 79, + "leagueMatchday": 2, + "showTable": false + }, + { + "matchday": 2, + "matchtime": "2024-08-09 19:00", + "match": "Dynamo Dresden - Energie Cottbus", + "showTable": false, + "matchLeague": 80, + "type": "SingleMatch", + "matchId": 1236722 + }, + { + "matchday": 2, + "matchtime": "2024-08-10 14:00", + "match": "SpVgg Unterhaching - FC Ingolstadt 04", + "showTable": false, + "matchLeague": 80, + "type": "SingleMatch", + "matchId": 1236717 + }, + { + "matchday": 2, + "matchtime": "2024-08-10 14:00", + "match": "SV Wehen - Hansa Rostock", + "showTable": false, + "matchLeague": 80, + "type": "SingleMatch", + "matchId": 1236721 + } + ] + }, + { + "TLWMatchday": 3, + "matchesConfig": [ + { + "type": "AllMatchesOfMatchday", + "matchesLeague": 78, + "leagueMatchday": 1, + "showTable": true + }, + { + "matchday": 3, + "matchtime": "2024-08-24 20:30", + "match": "1.FC Köln - Eintracht Braunschweig", + "showTable": false, + "matchLeague": 79, + "type": "SingleMatch", + "matchId": 1226183 + }, + { + "matchday": 3, + "matchtime": "2024-08-25 13:30", + "match": "SV Darmstadt 98 - FC Nurnberg", + "showTable": false, + "matchLeague": 79, + "type": "SingleMatch", + "matchId": 1226184 + }, + { + "matchday": 3, + "matchtime": "2024-08-23 19:00", + "match": "Erzgebirge AUE - Dynamo Dresden", + "showTable": false, + "matchLeague": 80, + "type": "SingleMatch", + "matchId": 1236727 + } + ] + }, + { + "TLWMatchday": 4, + "matchesConfig": [ + { + "type": "AllMatchesOfMatchday", + "matchesLeague": 78, + "leagueMatchday": 2, + "showTable": true + }, + { + "matchday": 4, + "matchtime": "2024-08-31 13:00", + "match": "FC Nurnberg - FC Magdeburg", + "showTable": false, + "matchLeague": 79, + "type": "SingleMatch", + "matchId": 1226197 + }, + { + "matchday": 4, + "matchtime": "2024-08-31 20:30", + "match": "FC Kaiserslautern - Hertha Berlin", + "showTable": false, + "matchLeague": 79, + "type": "SingleMatch", + "matchId": 1226198 + }, + { + "matchday": 4, + "matchtime": "2024-08-31 14:00", + "match": "FC Ingolstadt 04 - TSV 1860 Munich", + "showTable": false, + "matchLeague": 80, + "type": "SingleMatch", + "matchId": 1236744 + } + ] + }, + { + "TLWMatchday": 5, + "matchesConfig": [ + { + "type": "AllMatchesOfMatchday", + "matchesLeague": 78, + "leagueMatchday": 3, + "showTable": true + }, + { + "matchday": 5, + "matchtime": "2024-09-14 13:00", + "match": "SSV ULM 1846 - FC Nurnberg", + "showTable": false, + "matchLeague": 79, + "type": "SingleMatch", + "matchId": 1226208 + }, + { + "matchday": 5, + "matchtime": "2024-09-14 20:30", + "match": "1.FC Köln - FC Magdeburg", + "showTable": false, + "matchLeague": 79, + "type": "SingleMatch", + "matchId": 1226201 + }, + { + "matchday": 5, + "matchtime": "2024-09-14 14:00", + "match": "TSV 1860 München - Dynamo Dresden", + "showTable": false, + "matchLeague": 80, + "type": "SingleMatch", + "matchId": 1236751 + } + ] + }, + { + "TLWMatchday": 6, + "matchesConfig": [ + { + "type": "AllMatchesOfMatchday", + "matchesLeague": 78, + "leagueMatchday": 4, + "showTable": true + }, + { + "matchday": 6, + "matchtime": "2024-09-21 13:00", + "match": "FC Nurnberg - Hertha Berlin", + "showTable": false, + "matchLeague": 79, + "type": "SingleMatch", + "matchId": 1226214 + }, + { + "matchday": 6, + "matchtime": "2024-09-21 20:30", + "match": "FC Kaiserslautern - Hamburger SV", + "showTable": false, + "matchLeague": 79, + "type": "SingleMatch", + "matchId": 1226215 + }, + { + "matchday": 6, + "matchtime": "2024-09-21 13:00", + "match": "Fortuna Düsseldorf - 1.FC Köln", + "showTable": false, + "matchLeague": 79, + "type": "SingleMatch", + "matchId": 1226210 + } + ] + }, + { + "TLWMatchday": 7, + "matchesConfig": [ + { + "type": "AllMatchesOfMatchday", + "matchesLeague": 78, + "leagueMatchday": 5, + "showTable": true + }, + { + "matchday": 7, + "matchtime": "2024-09-28 20:30", + "match": "Preußen Münster - FC Schalke 04", + "showTable": false, + "matchLeague": 79, + "type": "SingleMatch", + "matchId": 1226226 + }, + { + "matchday": 7, + "matchtime": "2024-09-29 13:30", + "match": "Hannover 96 - 1. FC Nürnberg", + "showTable": false, + "matchLeague": 79, + "type": "SingleMatch", + "matchId": 1226222 + }, + { + "matchday": 6, + "matchtime": "2024-10-01 21:00", + "match": "Bayer Leverkusen - AC Milan", + "showTable": false, + "matchLeague": 2, + "type": "SingleMatch", + "matchId": 1299005 + } + ] + }, + { + "TLWMatchday": 8, + "matchesConfig": [ + { + "type": "AllMatchesOfMatchday", + "matchesLeague": 78, + "leagueMatchday": 6, + "showTable": true + }, + { + "matchday": 8, + "matchtime": "2024-10-05 13:00", + "match": "1. FC Nürnberg - Preußen Münster", + "showTable": false, + "matchLeague": 79, + "type": "SingleMatch", + "matchId": 1226234 + }, + { + "matchday": 8, + "matchtime": "2024-10-05 20:30", + "match": "FC Schalke 04 - Hertha BSC", + "showTable": false, + "matchLeague": 79, + "type": "SingleMatch", + "matchId": 1226232 + }, + { + "matchday": 8, + "matchtime": "2024-10-06 13:30", + "match": "Fortuna Düsseldorf - Hamburger SV", + "showTable": false, + "matchLeague": 79, + "type": "SingleMatch", + "matchId": 1226229 + } + ] + }, + { + "TLWMatchday": 9, + "matchesConfig": [ + { + "type": "AllMatchesOfMatchday", + "matchesLeague": 78, + "leagueMatchday": 7, + "showTable": true + }, + { + "matchday": 9, + "matchtime": "2024-10-19 20:30", + "match": "1. FC Kaiserslautern - SC Paderborn 07", + "showTable": false, + "matchLeague": 79, + "type": "SingleMatch", + "matchId": 1226242 + }, + { + "matchday": 9, + "matchtime": "2024-10-20 13:30", + "match": "SpVgg Greuther Fürth - 1. FC Nürnberg", + "showTable": false, + "matchLeague": 79, + "type": "SingleMatch", + "matchId": 1226240 + }, + { + "matchday": 10, + "matchtime": "2024-10-20 19:30", + "match": "SpVgg Unterhaching - TSV 1860 München", + "showTable": false, + "matchLeague": 80, + "type": "SingleMatch", + "matchId": 1236802 + } + ] + }, + { + "TLWMatchday": 10, + "matchesConfig": [ + { + "type": "AllMatchesOfMatchday", + "matchesLeague": 78, + "leagueMatchday": 8, + "showTable": true + }, + { + "matchday": 10, + "matchtime": "2024-10-25 18:30", + "match": "1. FC Nürnberg - SSV Jahn Regensburg", + "showTable": false, + "matchLeague": 79, + "type": "SingleMatch", + "matchId": 1226252 + }, + { + "matchday": 10, + "matchtime": "2024-10-26 20:30", + "match": "Fortuna Düsseldorf - 1. FC Kaiserslautern", + "showTable": false, + "matchLeague": 79, + "type": "SingleMatch", + "matchId": 1226248 + }, + { + "matchday": 10, + "matchtime": "2024-10-26 13:00", + "match": "Karlsruher SC - Hertha BSC", + "showTable": false, + "matchLeague": 79, + "type": "SingleMatch", + "matchId": 1226249 + } + ] + }, + { + "TLWMatchday": 11, + "matchesConfig": [ + { + "type": "AllMatchesOfMatchday", + "matchesLeague": 78, + "leagueMatchday": 9, + "showTable": true + }, + { + "matchday": 11, + "matchtime": "2024-11-02 20:30", + "match": "Hertha BSC - 1.FC Köln", + "showTable": false, + "matchLeague": 79, + "type": "SingleMatch", + "matchId": 1226259 + }, + { + "matchday": 11, + "matchtime": "2024-11-03 13:30", + "match": "Hamburger SV - 1. FC Nürnberg", + "showTable": false, + "matchLeague": 79, + "type": "SingleMatch", + "matchId": 1226255 + }, + { + "matchday": 8, + "matchtime": "2024-11-05 21:00", + "match": "Liverpool - Bayer Leverkusen", + "showTable": false, + "matchLeague": 2, + "type": "SingleMatch", + "matchId": 1299044 + } + ] + }, + { + "TLWMatchday": 12, + "matchesConfig": [ + { + "type": "AllMatchesOfMatchday", + "matchesLeague": 78, + "leagueMatchday": 10, + "showTable": true + }, + { + "matchday": 12, + "matchtime": "2024-11-08 18:30", + "match": "1. FC Nürnberg - 1. FC Kaiserslautern", + "showTable": false, + "matchLeague": 79, + "type": "SingleMatch", + "matchId": 1226270 + }, + { + "matchday": 12, + "matchtime": "2024-11-09 20:30", + "match": "Fortuna Düsseldorf - SC Paderborn 07", + "showTable": false, + "matchLeague": 79, + "type": "SingleMatch", + "matchId": 1226266 + }, + { + "matchday": 11, + "matchtime": "2024-11-10 17:30", + "match": "Chelsea - Arsenal", + "showTable": false, + "matchLeague": 39, + "type": "SingleMatch", + "matchId": 1208125 + } + ] + }, + { + "TLWMatchday": 13, + "matchesConfig": [ + { + "type": "AllMatchesOfMatchday", + "matchesLeague": 78, + "leagueMatchday": 11, + "showTable": true + }, + { + "matchday": 13, + "matchtime": "2024-11-22 18:30", + "match": "SC Paderborn 07 - 1. FC Nürnberg", + "showTable": false, + "matchLeague": 79, + "type": "SingleMatch", + "matchId": 1226276 + }, + { + "matchday": 13, + "matchtime": "2024-11-23 20:30", + "match": "Hamburger SV - FC Schalke 04", + "showTable": false, + "matchLeague": 79, + "type": "SingleMatch", + "matchId": 1226274 + }, + { + "matchday": 9, + "matchtime": "2024-11-26 21:00", + "match": "Bayern München - Paris Saint Germain", + "showTable": false, + "matchLeague": 2, + "type": "SingleMatch", + "matchId": 1299060 + } + ] + }, + { + "TLWMatchday": 14, + "matchesConfig": [ + { + "type": "AllMatchesOfMatchday", + "matchesLeague": 78, + "leagueMatchday": 12, + "showTable": true + }, + { + "matchday": 14, + "matchtime": "2024-11-30 20:30", + "match": "SV Darmstadt 98 - Preußen Münster", + "showTable": false, + "matchLeague": 79, + "type": "SingleMatch", + "matchId": 1226283 + }, + { + "matchday": 14, + "matchtime": "2024-12-01 13:30", + "match": "1. FC Nürnberg - Fortuna Düsseldorf", + "showTable": false, + "matchLeague": 79, + "type": "SingleMatch", + "matchId": 1226287 + }, + { + "matchday": 13, + "matchtime": "2024-12-01 17:00", + "match": "Liverpool - Manchester City", + "showTable": false, + "matchLeague": 39, + "type": "SingleMatch", + "matchId": 1208147 + } + ] + }, + { + "TLWMatchday": 15, + "matchesConfig": [ + { + "type": "AllMatchesOfMatchday", + "matchesLeague": 78, + "leagueMatchday": 13, + "showTable": true + }, + { + "matchday": 15, + "matchtime": "2024-12-06 18:30", + "match": "SV Elversberg - 1. FC Nürnberg", + "showTable": false, + "matchLeague": 79, + "type": "SingleMatch", + "matchId": 1226296 + }, + { + "matchday": 15, + "matchtime": "2024-12-07 20:30", + "match": "Preußen Münster - 1. FC Magdeburg", + "showTable": false, + "matchLeague": 79, + "type": "SingleMatch", + "matchId": 1226298 + }, + { + "matchday": 10, + "matchtime": "2024-12-11 21:00", + "match": "Borussia Dortmund - Barcelona", + "showTable": false, + "matchLeague": 2, + "type": "SingleMatch", + "matchId": 1299086 + } + ] + }, + { + "TLWMatchday": 16, + "matchesConfig": [ + { + "type": "AllMatchesOfMatchday", + "matchesLeague": 78, + "leagueMatchday": 14, + "showTable": true + }, + { + "matchday": 16, + "matchtime": "2024-12-15 13:30", + "match": "1.FC Köln - 1. FC Nürnberg", + "showTable": false, + "matchLeague": 79, + "type": "SingleMatch", + "matchId": 1226300 + }, + { + "matchday": 16, + "matchtime": "2024-12-14 20:30", + "match": "SV Darmstadt 98 - 1. FC Kaiserslautern", + "showTable": false, + "matchLeague": 79, + "type": "SingleMatch", + "matchId": 1226301 + }, + { + "matchday": 10, + "matchtime": "2024-12-12 21:00", + "match": "Lyon - Eintracht Frankfurt", + "showTable": false, + "matchLeague": 3, + "type": "SingleMatch", + "matchId": 1299231 + } + ] + }, + { + "TLWMatchday": 17, + "matchesConfig": [ + { + "type": "AllMatchesOfMatchday", + "matchesLeague": 78, + "leagueMatchday": 15, + "showTable": true + }, + { + "matchday": 17, + "matchtime": "2024-12-21 20:30", + "match": "1. FC Nürnberg - Eintracht Braunschweig", + "showTable": false, + "matchLeague": 79, + "type": "SingleMatch", + "matchId": 1226314 + }, + { + "matchday": 19, + "matchtime": "2024-12-21 14:00", + "match": "Erzgebirge Aue - TSV 1860 München", + "showTable": false, + "matchLeague": 80, + "type": "SingleMatch", + "matchId": 1236887 + }, + { + "matchday": 17, + "matchtime": "2024-12-22 17:30", + "match": "Tottenham - Liverpool", + "showTable": false, + "matchLeague": 39, + "type": "SingleMatch", + "matchId": 1208191 + } + ] + }, + { + "TLWMatchday": 18, + "matchesConfig": [ + { + "matchday": 18, + "matchtime": "2024-12-29 01:00", + "match": "Lazio - Atalanta", + "showTable": false, + "matchLeague": 135, + "type": "SingleMatch", + "matchId": 1223770 + }, + { + "matchday": 18, + "matchtime": "2024-12-29 18:00", + "match": "Juventus - Fiorentina", + "showTable": false, + "matchLeague": 135, + "type": "SingleMatch", + "matchId": 1223769 + }, + { + "matchday": 18, + "matchtime": "2024-12-29 20:45", + "match": "AC Milan - AS Roma", + "showTable": false, + "matchLeague": 135, + "type": "SingleMatch", + "matchId": 1223771 + }, + { + "matchday": 19, + "matchtime": "2025-01-04 18:00", + "match": "Fiorentina - Napoli", + "showTable": false, + "matchLeague": 135, + "type": "SingleMatch", + "matchId": 1223777 + }, + { + "matchday": 19, + "matchtime": "2025-01-05 20:45", + "match": "AS Roma - Lazio", + "showTable": false, + "matchLeague": 135, + "type": "SingleMatch", + "matchId": 1223782 + }, + { + "matchday": 18, + "matchtime": "2024-12-26 16:00", + "match": "Nottingham Forest - Tottenham", + "showTable": false, + "matchLeague": 39, + "type": "SingleMatch", + "matchId": 1208200 + }, + { + "matchday": 18, + "matchtime": "2024-12-26 16:00", + "match": "Newcastle - Aston Villa", + "showTable": false, + "matchLeague": 39, + "type": "SingleMatch", + "matchId": 1208199 + }, + { + "matchday": 19, + "matchtime": "2024-12-30 20:45", + "match": "Aston Villa - Brighton", + "showTable": false, + "matchLeague": 39, + "type": "SingleMatch", + "matchId": 1208203 + }, + { + "matchday": 19, + "matchtime": "2024-12-30 21:00", + "match": "Manchester United - Newcastle", + "showTable": false, + "matchLeague": 39, + "type": "SingleMatch", + "matchId": 1208210 + }, + { + "matchday": 19, + "matchtime": "2024-12-29 18:15", + "match": "West Ham - Liverpool", + "showTable": false, + "matchLeague": 39, + "type": "SingleMatch", + "matchId": 1208212 + }, + { + "matchday": 20, + "matchtime": "2025-01-04 18:30", + "match": "Brighton - Arsenal", + "showTable": false, + "matchLeague": 39, + "type": "SingleMatch", + "matchId": 1208215 + }, + { + "matchday": 19, + "matchtime": "2025-01-04 20:45", + "match": "Verona - Udinese", + "showTable": false, + "matchLeague": 135, + "type": "SingleMatch", + "matchId": 1223778 + } + ] + }, + { + "TLWMatchday": 19, + "matchesConfig": [ + { + "type": "AllMatchesOfMatchday", + "matchesLeague": 78, + "leagueMatchday": 16, + "showTable": true + }, + { + "matchday": 19, + "matchtime": "2025-01-11 21:00", + "match": "Sevilla - Valencia", + "showTable": false, + "matchLeague": 140, + "type": "SingleMatch", + "matchId": 1208659 + }, + { + "matchday": 20, + "matchtime": "2025-01-11 18:00", + "match": "Torino - Juventus", + "showTable": false, + "matchLeague": 135, + "type": "SingleMatch", + "matchId": 1223792 + }, + { + "matchday": 17, + "matchtime": "2025-01-12 01:00", + "match": "Auxerre - Lille", + "showTable": false, + "matchLeague": 61, + "type": "SingleMatch", + "matchId": 1213893 + } + ] + }, + { + "TLWMatchday": 20, + "matchesConfig": [ + { + "type": "AllMatchesOfMatchday", + "matchesLeague": 78, + "leagueMatchday": 17, + "showTable": true + }, + { + "matchday": 21, + "matchtime": "2025-01-14 21:00", + "match": "Nottingham Forest - Liverpool", + "showTable": false, + "matchLeague": 39, + "type": "SingleMatch", + "matchId": 1208228 + }, + { + "matchday": 21, + "matchtime": "2025-01-15 21:00", + "match": "Arsenal - Tottenham", + "showTable": false, + "matchLeague": 39, + "type": "SingleMatch", + "matchId": 1208223 + }, + { + "matchday": 19, + "matchtime": "2025-01-14 20:45", + "match": "Atalanta - Juventus", + "showTable": false, + "matchLeague": 135, + "type": "SingleMatch", + "matchId": 1223775 + } + ] + }, + { + "TLWMatchday": 21, + "matchesConfig": [ + { + "type": "AllMatchesOfMatchday", + "matchesLeague": 78, + "leagueMatchday": 18, + "showTable": true + }, + { + "matchday": 18, + "matchtime": "2025-01-18 20:30", + "match": "Hamburger SV - 1.FC Köln", + "showTable": false, + "matchLeague": 79, + "type": "SingleMatch", + "matchId": 1226319 + }, + { + "matchday": 18, + "matchtime": "2025-01-19 13:30", + "match": "1. FC Nürnberg - Karlsruher SC", + "showTable": false, + "matchLeague": 79, + "type": "SingleMatch", + "matchId": 1226322 + }, + { + "matchday": 11, + "matchtime": "2025-01-21 21:00", + "match": "Atletico Madrid - Bayer Leverkusen", + "showTable": false, + "matchLeague": 2, + "type": "SingleMatch", + "matchId": 1299094 + } + ] + }, + { + "TLWMatchday": 22, + "matchesConfig": [ + { + "type": "AllMatchesOfMatchday", + "matchesLeague": 78, + "leagueMatchday": 19, + "showTable": true + }, + { + "matchday": 19, + "matchtime": "2025-01-25 13:00", + "match": "FC Schalke 04 - 1. FC Nürnberg", + "showTable": false, + "matchLeague": 79, + "type": "SingleMatch", + "matchId": 1226333 + }, + { + "matchday": 19, + "matchtime": "2025-01-25 20:30", + "match": "Hertha BSC - Hamburger SV", + "showTable": false, + "matchLeague": 79, + "type": "SingleMatch", + "matchId": 1226332 + }, + { + "matchday": 19, + "matchtime": "2025-01-25 13:00", + "match": "Karlsruher SC - Fortuna Düsseldorf", + "showTable": false, + "matchLeague": 79, + "type": "SingleMatch", + "matchId": 1226329 + } + ] + }, + { + "TLWMatchday": 23, + "matchesConfig": [ + { + "type": "AllMatchesOfMatchday", + "matchesLeague": 78, + "leagueMatchday": 20, + "showTable": true + }, + { + "matchday": 20, + "matchtime": "2025-01-31 18:30", + "match": "1. FC Nürnberg - SV Darmstadt 98", + "showTable": false, + "matchLeague": 79, + "type": "SingleMatch", + "matchId": 1226341 + }, + { + "matchday": 20, + "matchtime": "2025-02-01 20:30", + "match": "FC Schalke 04 - 1. FC Magdeburg", + "showTable": false, + "matchLeague": 79, + "type": "SingleMatch", + "matchId": 1226339 + }, + { + "matchday": 22, + "matchtime": "2025-01-31 19:00", + "match": "Alemannia Aachen - Energie Cottbus", + "showTable": false, + "matchLeague": 80, + "type": "SingleMatch", + "matchId": 1236923 + } + ] + }, + { + "TLWMatchday": 24, + "matchesConfig": [ + { + "type": "AllMatchesOfMatchday", + "matchesLeague": 78, + "leagueMatchday": 21, + "showTable": true + }, + { + "matchday": 21, + "matchtime": "2025-02-08 13:00", + "match": "1. FC Magdeburg - 1. FC Nürnberg", + "showTable": false, + "matchLeague": 79, + "type": "SingleMatch", + "matchId": 1226351 + }, + { + "matchday": 21, + "matchtime": "2025-02-08 20:30", + "match": "Hertha BSC - 1. FC Kaiserslautern", + "showTable": false, + "matchLeague": 79, + "type": "SingleMatch", + "matchId": 1226350 + }, + { + "matchday": 23, + "matchtime": "2025-02-09 01:00", + "match": "Real Madrid - Atletico Madrid", + "showTable": false, + "matchLeague": 140, + "type": "SingleMatch", + "matchId": 1208697 + } + ] + }, + { + "TLWMatchday": 25, + "matchesConfig": [ + { + "type": "AllMatchesOfMatchday", + "matchesLeague": 78, + "leagueMatchday": 22, + "showTable": true + }, + { + "matchday": 22, + "matchtime": "2025-02-15 20:30", + "match": "Fortuna Düsseldorf - Hertha BSC", + "showTable": false, + "matchLeague": 79, + "type": "SingleMatch", + "matchId": 1226354 + }, + { + "matchday": 22, + "matchtime": "2025-02-16 13:30", + "match": "1. FC Nürnberg - SSV Ulm 1846", + "showTable": false, + "matchLeague": 79, + "type": "SingleMatch", + "matchId": 1226358 + }, + { + "matchday": 25, + "matchtime": "2025-02-16 01:00", + "match": "Lazio - Napoli", + "showTable": false, + "matchLeague": 135, + "type": "SingleMatch", + "matchId": 1223840 + } + ] + }, + { + "TLWMatchday": 26, + "matchesConfig": [ + { + "type": "AllMatchesOfMatchday", + "matchesLeague": 78, + "leagueMatchday": 23, + "showTable": true + }, + { + "matchday": 23, + "matchtime": "2025-02-21 18:30", + "match": "Hertha BSC - 1. FC Nürnberg", + "showTable": false, + "matchLeague": 79, + "type": "SingleMatch", + "matchId": 1226369 + }, + { + "matchday": 23, + "matchtime": "2025-02-22 20:30", + "match": "Hannover 96 - SC Paderborn 07", + "showTable": false, + "matchLeague": 79, + "type": "SingleMatch", + "matchId": 1226367 + }, + { + "matchday": 26, + "matchtime": "2025-02-23 17:30", + "match": "Manchester City - Liverpool", + "showTable": false, + "matchLeague": 39, + "type": "SingleMatch", + "matchId": 1208280 + } + ] + }, + { + "TLWMatchday": 27, + "matchesConfig": [ + { + "type": "AllMatchesOfMatchday", + "matchesLeague": 78, + "leagueMatchday": 24, + "showTable": true + }, + { + "matchday": 24, + "matchtime": "2025-03-01 13:00", + "match": "1. FC Nürnberg - Hannover 96", + "showTable": false, + "matchLeague": 79, + "type": "SingleMatch", + "matchId": 1226377 + }, + { + "matchday": 24, + "matchtime": "2025-03-01 20:30", + "match": "Karlsruher SC - 1.FC Köln", + "showTable": false, + "matchLeague": 79, + "type": "SingleMatch", + "matchId": 1226373 + } + ] + }, + { + "TLWMatchday": 28, + "matchesConfig": [ + { + "type": "AllMatchesOfMatchday", + "matchesLeague": 78, + "leagueMatchday": 25, + "showTable": true + } + ] + }, + { + "TLWMatchday": 29, + "matchesConfig": [ + { + "type": "AllMatchesOfMatchday", + "matchesLeague": 78, + "leagueMatchday": 26, + "showTable": true + } + ] + }, + { + "TLWMatchday": 30, + "matchesConfig": [ + { + "type": "Placeholder", + "placeholderDatetime": "2025-03-18 18:00:00" + } + ] + }, + { + "TLWMatchday": 31, + "matchesConfig": [ + { + "type": "AllMatchesOfMatchday", + "matchesLeague": 78, + "leagueMatchday": 27, + "showTable": true + } + ] + }, + { + "TLWMatchday": 32, + "matchesConfig": [ + { + "type": "AllMatchesOfMatchday", + "matchesLeague": 78, + "leagueMatchday": 28, + "showTable": true + } + ] + }, + { + "TLWMatchday": 33, + "matchesConfig": [ + { + "type": "AllMatchesOfMatchday", + "matchesLeague": 78, + "leagueMatchday": 29, + "showTable": true + } + ] + }, + { + "TLWMatchday": 34, + "matchesConfig": [ + { + "type": "Placeholder", + "placeholderDatetime": "2025-04-15 18:00:00" + } + ] + }, + { + "TLWMatchday": 35, + "matchesConfig": [ + { + "type": "AllMatchesOfMatchday", + "matchesLeague": 78, + "leagueMatchday": 30, + "showTable": true + } + ] + }, + { + "TLWMatchday": 36, + "matchesConfig": [ + { + "type": "AllMatchesOfMatchday", + "matchesLeague": 78, + "leagueMatchday": 31, + "showTable": true + } + ] + }, + { + "TLWMatchday": 37, + "matchesConfig": [ + { + "type": "AllMatchesOfMatchday", + "matchesLeague": 78, + "leagueMatchday": 32, + "showTable": true + } + ] + }, + { + "TLWMatchday": 38, + "matchesConfig": [ + { + "type": "AllMatchesOfMatchday", + "matchesLeague": 78, + "leagueMatchday": 33, + "showTable": true + } + ] + }, + { + "TLWMatchday": 39, + "matchesConfig": [ + { + "type": "AllMatchesOfMatchday", + "matchesLeague": 78, + "leagueMatchday": 34, + "showTable": true + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/Tippliga_Configs/wtl_2025_v3.json b/src/main/resources/Tippliga_Configs/wtl_2025_v3.json new file mode 100644 index 0000000..3991691 --- /dev/null +++ b/src/main/resources/Tippliga_Configs/wtl_2025_v3.json @@ -0,0 +1,152 @@ +{ + "numberOfMatchdays": 5, + "matchesPerMatchday": 0, + "pointMode": 4, + "pointsTendency": 1, + "pointsDifference": 2, + "pointsDirectHit": 3, + "ko": 1, + "matchdayConfig": [ + { + "TLWMatchday": 1, + "matchdayName": "1. Runde", + "numberOfMatches": 32, + "matchesConfig": [ + { + "type": "AllMatchesOfMatchday", + "matchesLeague": 81, + "leagueMatchday": 1, + "showTable": true + }, + { + "type": "Placeholder", + "placeholderDatetime": "2024-08-16 18:00:00" + } + ] + }, + { + "TLWMatchday": 2, + "numberOfMatches": 16, + "matchdayName": "Achtelfinale", + "matchesConfig": [ + { + "type": "AllMatchesOfMatchday", + "matchesLeague": 81, + "leagueMatchday": 2, + "showTable": true + }, + { + "type": "Placeholder", + "placeholderDatetime": "2024-10-29 18:00:00" + } + ] + }, + { + "TLWMatchday": 3, + "numberOfMatches": 8, + "matchdayName": "Viertelfinale", + "matchesConfig": [ + { + "type": "AllMatchesOfMatchday", + "matchesLeague": 81, + "leagueMatchday": 3, + "showTable": true + }, + { + "type": "Placeholder", + "placeholderDatetime": "2024-12-03 18:30:00" + } + ] + }, + { + "TLWMatchday": 4, + "numberOfMatches": 4, + "matchdayName": "Halbfinale", + "matchesConfig": [ + { + "type": "AllMatchesOfMatchday", + "matchesLeague": 81, + "leagueMatchday": 4, + "showTable": true + }, + { + "type": "Placeholder", + "placeholderDatetime": "2025-02-04 18:30:00" + } + ] + }, + { + "TLWMatchday": 5, + "numberOfMatches": 6, + "matchdayName": "Finale", + "matchesConfig": [ + { + "type": "AllMatchesOfMatchday", + "matchesLeague": 81, + "leagueMatchday": 5, + "showTable": true + }, + { + "type": "AllMatchesOfMatchday", + "matchesLeague": 81, + "leagueMatchday": 5, + "showTable": true + }, + { + "type": "AllMatchesOfMatchday", + "matchesLeague": 81, + "leagueMatchday": 6, + "showTable": true + }, + { + "type": "AllMatchesOfMatchday", + "matchesLeague": 81, + "leagueMatchday": 6, + "showTable": true + }, + { + "type": "PlaceholderSingleMatch", + "koMatch": true, + "placeholderDatetime": "2025-04-01 20:45:00", + "formulaHome": "D", + "formulaGuest": "D" + }, + { + "type": "PlaceholderSingleMatch", + "koMatch": true, + "placeholderDatetime": "2025-04-02 20:45:00", + "formulaHome": "D", + "formulaGuest": "D" + }, + { + "type": "PlaceholderSingleMatch", + "koMatch": true, + "placeholderDatetime": "2025-04-01 20:45:00", + "formulaHome": "D", + "formulaGuest": "D" + }, + { + "type": "PlaceholderSingleMatch", + "koMatch": true, + "placeholderDatetime": "2025-04-02 20:45:00", + "formulaHome": "D", + "formulaGuest": "D" + }, + { + "type": "PlaceholderSingleMatch", + "koMatch": true, + "placeholderDatetime": "2025-05-24 20:00:00", + "formulaHome": "D", + "formulaGuest": "D" + }, + { + "type": "PlaceholderSingleMatch", + "koMatch": true, + "placeholderDatetime": "2025-05-24 20:00:00", + "formulaHome": "D", + "formulaGuest": "D" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/test/java/de/jeyp91/S3ProviderTest.java b/src/test/java/de/jeyp91/S3ProviderTest.java index 1f4cadf..c4b0256 100644 --- a/src/test/java/de/jeyp91/S3ProviderTest.java +++ b/src/test/java/de/jeyp91/S3ProviderTest.java @@ -1,5 +1,6 @@ package de.jeyp91; +import org.json.simple.JSONObject; import org.junit.Test; public class S3ProviderTest { @@ -7,7 +8,7 @@ public class S3ProviderTest { @Test public void getFixturesFromS3Test() { S3Provider prov = new S3Provider(); - String rounds = prov.getFixturesStringFromS3(1240); - System.out.println(rounds); + JSONObject rounds = prov.getFixturesJSONFromS3(2025, 1240); + System.out.println(rounds.toJSONString()); } } diff --git a/src/test/java/de/jeyp91/apifootball/APIFootballUpdaterTest.java b/src/test/java/de/jeyp91/apifootball/APIFootballUpdaterTest.java index 88cdb57..e0353bd 100644 --- a/src/test/java/de/jeyp91/apifootball/APIFootballUpdaterTest.java +++ b/src/test/java/de/jeyp91/apifootball/APIFootballUpdaterTest.java @@ -8,20 +8,20 @@ public class APIFootballUpdaterTest { @Test public void checkErrorsTest() { - String exceededLimitDayError = "{\"api\":{\"results\":0,\"error\":\"You have reached the request limit for the day\"}}"; + String rateLimitError = "{\"results\":0,\"errors\":{\"rateLimit\":\"Too many requests. Your rate limit is 10 requests per minute.\"}}"; APIFootballUpdater updater = new APIFootballUpdater(); try { - updater.checkErrors("https://test.url/api", exceededLimitDayError); + updater.checkErrors("https://test.url/api", rateLimitError); } catch (Exception e) { System.out.println(e.getMessage()); - assert e.getMessage().equals("https://test.url/api returned error: 'You have reached the request limit for the day'"); + assert e.getMessage().equals("https://test.url/api returned error: '{\"rateLimit\":\"Too many requests. Your rate limit is 10 requests per minute.\"}'"); } } @Test public void updateFixturesTest() { APIFootballUpdater updater = new APIFootballUpdater(); -// updater.updateFixtures(1240); + updater.updateFixtures(2025, 79); } @Test diff --git a/src/test/java/de/jeyp91/tippliga/TLWMatchesCreatorTipperTest.java b/src/test/java/de/jeyp91/tippliga/TLWMatchesCreatorTipperTest.java index 454d7cd..0448fa6 100644 --- a/src/test/java/de/jeyp91/tippliga/TLWMatchesCreatorTipperTest.java +++ b/src/test/java/de/jeyp91/tippliga/TLWMatchesCreatorTipperTest.java @@ -2,10 +2,6 @@ package de.jeyp91.tippliga; import org.junit.Test; -import java.text.ParseException; - -import static org.junit.Assert.assertEquals; - public class TLWMatchesCreatorTipperTest { int season = 2025; diff --git a/src/test/java/de/jeyp91/tippliga/TLWTeamsCreatorTest.java b/src/test/java/de/jeyp91/tippliga/TLWTeamsCreatorTest.java index 83b8ae4..cd5472c 100644 --- a/src/test/java/de/jeyp91/tippliga/TLWTeamsCreatorTest.java +++ b/src/test/java/de/jeyp91/tippliga/TLWTeamsCreatorTest.java @@ -1,11 +1,8 @@ package de.jeyp91.tippliga; -import org.junit.Test; - -import java.text.ParseException; import java.util.ArrayList; -import static org.junit.Assert.assertEquals; +import org.junit.Test; public class TLWTeamsCreatorTest { diff --git a/src/test/java/de/jeyp91/tippligaforum/MatchesListCreatorTest.java b/src/test/java/de/jeyp91/tippligaforum/MatchesListCreatorTest.java index f985a8b..5e385a3 100644 --- a/src/test/java/de/jeyp91/tippligaforum/MatchesListCreatorTest.java +++ b/src/test/java/de/jeyp91/tippligaforum/MatchesListCreatorTest.java @@ -1,41 +1,40 @@ package de.jeyp91.tippligaforum; -import de.jeyp91.tippligaforum.MatchesListCreator; import org.junit.Test; public class MatchesListCreatorTest { @Test public void getMatchesTest2664() { - MatchesListCreator creator = new MatchesListCreator(2664); + MatchesListCreator creator = new MatchesListCreator(2025, 2664); String matches = creator.getMatchesBeautiful(); // System.out.println(matches); } @Test public void getMatchesTest2743() { - MatchesListCreator creator = new MatchesListCreator(2743); + MatchesListCreator creator = new MatchesListCreator(2025, 2743); String matches = creator.getMatchesBeautiful(); System.out.println(matches); } @Test public void getMatchesTest2755() { - MatchesListCreator creator = new MatchesListCreator(2755); + MatchesListCreator creator = new MatchesListCreator(2025, 2755); String matches = creator.getMatchesBeautiful(); // System.out.println(matches); } @Test public void getMatchesTest2790() { - MatchesListCreator creator = new MatchesListCreator(2790); + MatchesListCreator creator = new MatchesListCreator(2025, 2790); String matches = creator.getMatchesBeautiful(); // System.out.println(matches); } @Test public void getMatchesTest2795() { - MatchesListCreator creator = new MatchesListCreator(2795); + MatchesListCreator creator = new MatchesListCreator(2025, 2795); String matches = creator.getMatchesBeautiful(); // System.out.println(matches); }