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

@@ -0,0 +1,31 @@
package de.jeyp91.teamidmatcher;
import de.jeyp91.apifootball.APIFootballConnector;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
public class TeamIDMatcherTemplateCreator {
APIFootballConnector con;
JSONArray teams;
public TeamIDMatcherTemplateCreator(int season, int league) {
this.con = APIFootballConnector.getAPIFootballConnectorInstance(season);
JSONObject apiObject = con.getTeamsForLeague(league);
JSONObject teamsObject = (JSONObject) apiObject.get("api");
this.teams = (JSONArray) teamsObject.get("teams");
}
public String getTeamsTemplate() {
String teamsTemplate = "";
for (Object team : this.teams) {
JSONObject teamObject = (JSONObject) team;
teamsTemplate += ",\n";
teamsTemplate += " {\n";
teamsTemplate += " \"teamname\": \"" + teamObject.get("name") + "\",\n";
teamsTemplate += " \"tippligaID\": " + ",\n";
teamsTemplate += " \"apiFootballID\": " + teamObject.get("team_id") + "\n";
teamsTemplate += " }";
}
return teamsTemplate;
}
}