Remove Gist

This commit is contained in:
2020-11-08 23:04:32 +01:00
parent 5862a99d73
commit 8cfb2a325a
48 changed files with 2792 additions and 668 deletions

View File

@@ -1,29 +1,18 @@
package de.jeyp91.apifootball;
import com.google.common.io.Resources;
import de.jeyp91.BaseMatch;
import de.jeyp91.gists.GistProvider;
import org.json.simple.JSONArray;
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 APIFootballMatch extends BaseMatch {
private final int season;
private final int matchId;
private final int leagueId;
private String matchStatus;
private final String teamNameHome;
private final String teamNameGuest;
private Boolean showTable = null;
public APIFootballMatch(JSONObject json, int season) {
this.season = season;
this.matchId = Integer.parseInt(json.get("fixture_id").toString());
// TODO
this.leagueId = Integer.parseInt(json.get("league_id").toString());
@@ -33,8 +22,7 @@ public class APIFootballMatch extends BaseMatch {
this.teamNameGuest = ((JSONObject) json.get("awayTeam")).get("team_name").toString();
this.goalsHome = getNumberOrNull(json.get("goalsHomeTeam"));
this.goalsGuest = getNumberOrNull(json.get("goalsAwayTeam"));
this.matchday = getMatchdayFromRoundString(json.get("round").toString(), this.leagueId);
this.matchStatus = json.get("statusShort").toString();
this.matchday = getMatchdayFromRoundString(season, json.get("round").toString(), this.leagueId);
this.matchDatetime = (String) json.get("event_date");
}
@@ -42,10 +30,10 @@ public class APIFootballMatch extends BaseMatch {
return this.matchId;
}
private int getMatchdayFromRoundString(String round, int leagueId) {
public static int getMatchdayFromRoundString(int season, String round, int leagueId) {
round = round.replace(" ", "_");
Integer matchday = null;
APIFootballConnector con = APIFootballConnector.getAPIFootballConnectorInstance(this.season);
APIFootballConnector con = APIFootballConnector.getAPIFootballConnectorInstance(season);
JSONObject roundsObject = con.getMatchdays(leagueId);
JSONArray roundsArray = (JSONArray)(((JSONObject) roundsObject.get("api")).get("fixtures"));
for (int i = 0; i < roundsArray.size(); i++) {