Fix MatchesListForumUpdater
This commit is contained in:
10
.vscode/launch.json
vendored
10
.vscode/launch.json
vendored
@@ -34,7 +34,15 @@
|
||||
"request": "launch",
|
||||
"mainClass": "de.jeyp91.App",
|
||||
"envFile": "${workspaceFolder}/.env",
|
||||
"args": " --mode MatchesResultsUpdater --season 2025 --league 2 --configFile Tippliga"
|
||||
"args": " --mode MatchesResultsUpdater --season 2025 --league 1 --configFile Tippliga"
|
||||
},
|
||||
{
|
||||
"type": "java",
|
||||
"name": "MatchesListGistUpdater",
|
||||
"request": "launch",
|
||||
"mainClass": "de.jeyp91.App",
|
||||
"envFile": "${workspaceFolder}/.env",
|
||||
"args": " --mode MatchesListGistUpdater --season 2025 --league 1 --configFile Tippliga"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,11 +1,16 @@
|
||||
package de.jeyp91.tippligaforum;
|
||||
|
||||
import com.google.gson.*;
|
||||
import de.jeyp91.S3Provider;
|
||||
import de.jeyp91.apifootball.APIFootballMatch;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
import de.jeyp91.S3Provider;
|
||||
import de.jeyp91.apifootball.APIFootballMatch;
|
||||
|
||||
public class MatchesListCreator {
|
||||
|
||||
private final JSONObject mainObject = new JSONObject();
|
||||
@@ -19,8 +24,7 @@ public class MatchesListCreator {
|
||||
this.league = league;
|
||||
S3Provider prov = new S3Provider();
|
||||
JSONObject leagueConfig = prov.getFixturesJSONFromS3(season, league);
|
||||
JSONObject api = (JSONObject) leagueConfig.get("api");
|
||||
JSONArray matchesAPIFootball = (JSONArray) api.get("fixtures");
|
||||
JSONArray matchesAPIFootball = (JSONArray) leagueConfig.get("response");
|
||||
|
||||
JSONObject firstMatchAPIFootball = (JSONObject) matchesAPIFootball.get(0);
|
||||
JSONObject leagueObject = (JSONObject) firstMatchAPIFootball.get("league");
|
||||
@@ -44,16 +48,20 @@ public class MatchesListCreator {
|
||||
JSONObject matchAPIFootball = (JSONObject) matchAPIFootballObject;
|
||||
JSONObject match = new JSONObject();
|
||||
|
||||
Long leagueId = (Long) matchAPIFootball.get("league_id");
|
||||
String matchdayString = matchAPIFootball.get("round").toString();
|
||||
JSONObject leagueObject = (JSONObject) matchAPIFootball.get("league");
|
||||
Long leagueId = (Long) leagueObject.get("id");
|
||||
String matchdayString = leagueObject.get("round").toString();
|
||||
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");
|
||||
|
||||
JSONObject teamHome = (JSONObject) matchAPIFootball.get("homeTeam");
|
||||
String teamNameHome = teamHome.get("team_name").toString();
|
||||
JSONObject teamGuest = (JSONObject) matchAPIFootball.get("awayTeam");
|
||||
String teamNameGuest = teamGuest.get("team_name").toString();
|
||||
JSONObject fixtureObject = (JSONObject) matchAPIFootball.get("fixture");
|
||||
String matchtime = fixtureObject.get("date").toString().replace("T", " ").substring(0, 16);
|
||||
Long fixtureId = (Long) fixtureObject.get("id");
|
||||
|
||||
JSONObject teamsObject = (JSONObject) matchAPIFootball.get("teams");
|
||||
JSONObject teamHome = (JSONObject) teamsObject.get("home");
|
||||
String teamNameHome = teamHome.get("name").toString();
|
||||
JSONObject teamGuest = (JSONObject) teamsObject.get("away");
|
||||
String teamNameGuest = teamGuest.get("name").toString();
|
||||
|
||||
match.put("match", teamNameHome + " - " + teamNameGuest);
|
||||
match.put("matchday", matchday);
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
package de.jeyp91.tippligaforum;
|
||||
|
||||
import de.jeyp91.App;
|
||||
import de.jeyp91.apifootball.APIFootballUpdater;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import de.jeyp91.apifootball.APIFootballUpdater;
|
||||
|
||||
public class MatchesListForumUpdater {
|
||||
private HashSet<Integer> leagues;
|
||||
private static final Logger logger = LoggerFactory.getLogger(MatchesListForumUpdater.class);
|
||||
|
||||
@@ -93,5 +93,15 @@
|
||||
"country": "World",
|
||||
"name": "UEFA Super Cup",
|
||||
"league_id": 531
|
||||
},
|
||||
{
|
||||
"country": "World",
|
||||
"name": "World Cup",
|
||||
"league_id": 1
|
||||
},
|
||||
{
|
||||
"country": "World",
|
||||
"name": "Euro Championship",
|
||||
"league_id": 4
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user