Remove Gist
This commit is contained in:
@@ -22,6 +22,8 @@ dependencies {
|
|||||||
implementation 'org.apache.httpcomponents:httpclient:4.5.9'
|
implementation 'org.apache.httpcomponents:httpclient:4.5.9'
|
||||||
implementation 'com.googlecode.json-simple:json-simple:1.1.1'
|
implementation 'com.googlecode.json-simple:json-simple:1.1.1'
|
||||||
implementation 'com.google.code.gson:gson:2.8.6'
|
implementation 'com.google.code.gson:gson:2.8.6'
|
||||||
|
implementation platform('com.amazonaws:aws-java-sdk-bom:1.11.896')
|
||||||
|
implementation 'com.amazonaws:aws-java-sdk-s3'
|
||||||
testImplementation 'junit:junit:4.11'
|
testImplementation 'junit:junit:4.11'
|
||||||
compile 'com.google.api-client:google-api-client:1.23.0'
|
compile 'com.google.api-client:google-api-client:1.23.0'
|
||||||
compile 'com.google.oauth-client:google-oauth-client-jetty:1.23.0'
|
compile 'com.google.oauth-client:google-oauth-client-jetty:1.23.0'
|
||||||
@@ -31,6 +33,7 @@ dependencies {
|
|||||||
compile group: 'net.sourceforge.argparse4j', name: 'argparse4j', version: '0.8.1'
|
compile group: 'net.sourceforge.argparse4j', name: 'argparse4j', version: '0.8.1'
|
||||||
compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.13.3'
|
compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.13.3'
|
||||||
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.13.3'
|
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.13.3'
|
||||||
|
compile group: 'javax.xml.bind', name: 'jaxb-api', version: '2.2.4'
|
||||||
}
|
}
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
package de.jeyp91;
|
package de.jeyp91;
|
||||||
import de.jeyp91.apifootball.APIFootballUpdater;
|
import de.jeyp91.apifootball.APIFootballUpdater;
|
||||||
import de.jeyp91.gists.MatchesListGistUpdater;
|
import de.jeyp91.tippligaforum.MatchesListForumUpdater;
|
||||||
import de.jeyp91.tippliga.*;
|
import de.jeyp91.tippliga.*;
|
||||||
|
import de.jeyp91.tippligaforum.TippligaSQLConnector;
|
||||||
import net.sourceforge.argparse4j.ArgumentParsers;
|
import net.sourceforge.argparse4j.ArgumentParsers;
|
||||||
import net.sourceforge.argparse4j.inf.ArgumentParser;
|
import net.sourceforge.argparse4j.inf.ArgumentParser;
|
||||||
import net.sourceforge.argparse4j.inf.ArgumentParserException;
|
import net.sourceforge.argparse4j.inf.ArgumentParserException;
|
||||||
@@ -48,18 +49,18 @@ public class App {
|
|||||||
sql = teamsUpdater.getInsertSQL();
|
sql = teamsUpdater.getInsertSQL();
|
||||||
break;
|
break;
|
||||||
case "APIFootballUpdater":
|
case "APIFootballUpdater":
|
||||||
APIFootballUpdater apiFootballUpdater = new APIFootballUpdater(season);
|
APIFootballUpdater apiFootballUpdater = new APIFootballUpdater();
|
||||||
apiFootballUpdater.updateAllFixtures();
|
apiFootballUpdater.updateAllFixtures();
|
||||||
break;
|
break;
|
||||||
case "MatchesListGistUpdater":
|
case "MatchesListGistUpdater":
|
||||||
MatchesListGistUpdater matchesListGistUpdater = new MatchesListGistUpdater();
|
MatchesListForumUpdater matchesListForumUpdater = new MatchesListForumUpdater();
|
||||||
matchesListGistUpdater.updateAllLeagues();
|
matchesListForumUpdater.updateAllLeagues();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(!StatusHolder.getError() && !sql.equals("")) {
|
if(!StatusHolder.getError() && !sql.equals("")) {
|
||||||
TippligaSQLConnector con = new TippligaSQLConnector();
|
TippligaSQLConnector con = TippligaSQLConnector.getInstance();
|
||||||
con.executeUpdate(sql);
|
con.executeUpdate(sql);
|
||||||
logger.info(beautifulInfo);
|
logger.info(beautifulInfo);
|
||||||
}
|
}
|
||||||
|
|||||||
45
src/main/java/de/jeyp91/ResourceProvider.java
Normal file
45
src/main/java/de/jeyp91/ResourceProvider.java
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
package de.jeyp91;
|
||||||
|
|
||||||
|
import com.google.common.io.Resources;
|
||||||
|
import org.json.simple.JSONArray;
|
||||||
|
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 ResourceProvider {
|
||||||
|
|
||||||
|
private static JSONArray getJSONArrayFromResource(String path) {
|
||||||
|
URL url = Resources.getResource(path);
|
||||||
|
String jsonConfig;
|
||||||
|
JSONArray array = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
JSONParser jsonParser = new JSONParser();
|
||||||
|
jsonConfig = Resources.toString(url, StandardCharsets.UTF_8);
|
||||||
|
array = (JSONArray) jsonParser.parse(jsonConfig);
|
||||||
|
|
||||||
|
} catch (IOException | ParseException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static JSONArray getLigenConfig() {
|
||||||
|
return getJSONArrayFromResource("Tippliga/Ligen.json");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static JSONArray getTeamIDMatcherConfig() {
|
||||||
|
return getJSONArrayFromResource("Tippliga/Team_ID_Matcher_Config.json");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static JSONArray getTipperMatchPairConfig() {
|
||||||
|
return getJSONArrayFromResource("Tippliga/Tipper_Match_Pair_Config.json");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static JSONArray getTipperTeamConfig() {
|
||||||
|
return getJSONArrayFromResource("Tippliga/Tipper_Team_Config.json");
|
||||||
|
}
|
||||||
|
}
|
||||||
95
src/main/java/de/jeyp91/S3Provider.java
Normal file
95
src/main/java/de/jeyp91/S3Provider.java
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
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;
|
||||||
|
|
||||||
|
public class S3Provider {
|
||||||
|
private static final Regions AWS_DEFAULT_REGION = Regions.EU_CENTRAL_1;
|
||||||
|
private static final String BUCKET_NAME = "tlw-database-tool-api-football-data";
|
||||||
|
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writeFixturesToS3(int league, String content) {
|
||||||
|
writeToS3("fixtures/" + league + ".json", content);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writeRoundsToS3(int league, String content) {
|
||||||
|
writeToS3("rounds/" + league + ".json", 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));
|
||||||
|
String line;
|
||||||
|
while ((line = reader.readLine()) != null) {
|
||||||
|
builder.append(line);
|
||||||
|
}
|
||||||
|
} catch (SdkClientException | IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
String getFixturesStringFromS3(int league) {
|
||||||
|
return getFileFromS3("fixtures/" + league + ".json");
|
||||||
|
}
|
||||||
|
|
||||||
|
public JSONObject getFixturesJSONFromS3(int league) {
|
||||||
|
String fixturesString = getFixturesStringFromS3(league);
|
||||||
|
JSONParser parser = new JSONParser();
|
||||||
|
JSONObject jsonObject = null;
|
||||||
|
try {
|
||||||
|
jsonObject = (JSONObject) parser.parse(fixturesString);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
/* TODO */
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return jsonObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,29 +1,22 @@
|
|||||||
package de.jeyp91.apifootball;
|
package de.jeyp91.apifootball;
|
||||||
|
|
||||||
import de.jeyp91.gists.GistProvider;
|
import de.jeyp91.S3Provider;
|
||||||
import org.json.simple.JSONArray;
|
import org.json.simple.JSONArray;
|
||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
import org.json.simple.parser.JSONParser;
|
import org.json.simple.parser.JSONParser;
|
||||||
import org.json.simple.parser.ParseException;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class APIFootballConnector {
|
public class APIFootballConnector {
|
||||||
|
|
||||||
private static APIFootballConnector conn = null;
|
private static APIFootballConnector conn = null;
|
||||||
private final int season;
|
private final int season;
|
||||||
private final String gistId;
|
private final HashMap<Integer, JSONObject> rounds = new HashMap<>();
|
||||||
private final HashMap<String, JSONObject> rounds = new HashMap<>();
|
private final HashMap<Integer, JSONObject> matches = new HashMap<>();
|
||||||
private final HashMap<String, JSONObject> matches = new HashMap<>();
|
|
||||||
|
|
||||||
private APIFootballConnector(int season) {
|
private APIFootballConnector(int season) {
|
||||||
this.season = season;
|
this.season = season;
|
||||||
GistProvider prov = GistProvider.getInstance();
|
|
||||||
this.gistId = prov.getGistID("APIFootball_" + (season + 1));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static APIFootballConnector getAPIFootballConnectorInstance(int season) {
|
public static APIFootballConnector getAPIFootballConnectorInstance(int season) {
|
||||||
@@ -62,14 +55,14 @@ public class APIFootballConnector {
|
|||||||
return matchesOfMatchday;
|
return matchesOfMatchday;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<APIFootballMatch> getMatchesFromLeagueFromFile(int id) {
|
public ArrayList<APIFootballMatch> getMatchesFromLeagueFromFile(int leagueId) {
|
||||||
ArrayList<APIFootballMatch> matchesList = new ArrayList<>();
|
ArrayList<APIFootballMatch> matchesList = new ArrayList<>();
|
||||||
|
S3Provider prov = new S3Provider();
|
||||||
|
|
||||||
String filename = "matches_league_" + id + ".json";
|
if(!this.matches.containsKey(leagueId)) {
|
||||||
if(!this.matches.containsKey(filename)) {
|
this.matches.put(leagueId, prov.getFixturesJSONFromS3(leagueId));
|
||||||
this.matches.put(filename, readObjectFromFile(filename));
|
|
||||||
}
|
}
|
||||||
JSONObject matches = this.matches.get(filename);
|
JSONObject matches = this.matches.get(leagueId);
|
||||||
JSONArray matchArray = (JSONArray) (((JSONObject)matches.get("api")).get("fixtures"));
|
JSONArray matchArray = (JSONArray) (((JSONObject)matches.get("api")).get("fixtures"));
|
||||||
|
|
||||||
for(int i = 0; i < matchArray.size(); i++) {
|
for(int i = 0; i < matchArray.size(); i++) {
|
||||||
@@ -79,52 +72,17 @@ public class APIFootballConnector {
|
|||||||
return matchesList;
|
return matchesList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JSONObject getMatchdays(int id) {
|
public JSONObject getMatchdays(int leagueId) {
|
||||||
|
S3Provider prov = new S3Provider();
|
||||||
String filename = "rounds_" + id + ".json";
|
if(!this.rounds.containsKey(leagueId)) {
|
||||||
if(!this.rounds.containsKey(filename)) {
|
this.rounds.put(leagueId, prov.getRoundsJSONFromS3(leagueId));
|
||||||
this.rounds.put(filename, readObjectFromFile(filename));
|
|
||||||
}
|
}
|
||||||
return this.rounds.get(filename);
|
return this.rounds.get(leagueId);
|
||||||
}
|
|
||||||
|
|
||||||
public JSONObject readObjectFromFile(String filename) {
|
|
||||||
|
|
||||||
JSONObject object = null;
|
|
||||||
JSONParser jsonParser = new JSONParser();
|
|
||||||
|
|
||||||
GistProvider prov = GistProvider.getInstance();
|
|
||||||
String jsonConfig = prov.getFileFromGist(filename);
|
|
||||||
|
|
||||||
try {
|
|
||||||
object = (JSONObject) jsonParser.parse(jsonConfig);
|
|
||||||
} catch (ParseException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
return object;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JSONArray readArrayFromFile(String filename) {
|
|
||||||
|
|
||||||
JSONArray object = null;
|
|
||||||
JSONParser jsonParser = new JSONParser();
|
|
||||||
|
|
||||||
GistProvider prov = GistProvider.getInstance();
|
|
||||||
String jsonConfig = prov.getFileFromGist(filename);
|
|
||||||
|
|
||||||
try {
|
|
||||||
object = (JSONArray) jsonParser.parse(jsonConfig);
|
|
||||||
} catch (ParseException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
return object;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public JSONObject getTeamsForLeague(int league) {
|
public JSONObject getTeamsForLeague(int league) {
|
||||||
String url = "https://v2.api-football.com/teams/league/" + league;
|
String url = "https://v2.api-football.com/teams/league/" + league;
|
||||||
String content = new APIFootballUpdater(0).getRawData(url);
|
String content = new APIFootballUpdater().getRawData(url);
|
||||||
return stringToJSONObject(content);
|
return stringToJSONObject(content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,29 +1,18 @@
|
|||||||
package de.jeyp91.apifootball;
|
package de.jeyp91.apifootball;
|
||||||
|
|
||||||
import com.google.common.io.Resources;
|
|
||||||
import de.jeyp91.BaseMatch;
|
import de.jeyp91.BaseMatch;
|
||||||
import de.jeyp91.gists.GistProvider;
|
|
||||||
import org.json.simple.JSONArray;
|
import org.json.simple.JSONArray;
|
||||||
import org.json.simple.JSONObject;
|
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 {
|
public class APIFootballMatch extends BaseMatch {
|
||||||
|
|
||||||
private final int season;
|
|
||||||
private final int matchId;
|
private final int matchId;
|
||||||
private final int leagueId;
|
private final int leagueId;
|
||||||
private String matchStatus;
|
|
||||||
private final String teamNameHome;
|
private final String teamNameHome;
|
||||||
private final String teamNameGuest;
|
private final String teamNameGuest;
|
||||||
private Boolean showTable = null;
|
private Boolean showTable = null;
|
||||||
|
|
||||||
public APIFootballMatch(JSONObject json, int season) {
|
public APIFootballMatch(JSONObject json, int season) {
|
||||||
this.season = season;
|
|
||||||
this.matchId = Integer.parseInt(json.get("fixture_id").toString());
|
this.matchId = Integer.parseInt(json.get("fixture_id").toString());
|
||||||
// TODO
|
// TODO
|
||||||
this.leagueId = Integer.parseInt(json.get("league_id").toString());
|
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.teamNameGuest = ((JSONObject) json.get("awayTeam")).get("team_name").toString();
|
||||||
this.goalsHome = getNumberOrNull(json.get("goalsHomeTeam"));
|
this.goalsHome = getNumberOrNull(json.get("goalsHomeTeam"));
|
||||||
this.goalsGuest = getNumberOrNull(json.get("goalsAwayTeam"));
|
this.goalsGuest = getNumberOrNull(json.get("goalsAwayTeam"));
|
||||||
this.matchday = getMatchdayFromRoundString(json.get("round").toString(), this.leagueId);
|
this.matchday = getMatchdayFromRoundString(season, json.get("round").toString(), this.leagueId);
|
||||||
this.matchStatus = json.get("statusShort").toString();
|
|
||||||
this.matchDatetime = (String) json.get("event_date");
|
this.matchDatetime = (String) json.get("event_date");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,10 +30,10 @@ public class APIFootballMatch extends BaseMatch {
|
|||||||
return this.matchId;
|
return this.matchId;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getMatchdayFromRoundString(String round, int leagueId) {
|
public static int getMatchdayFromRoundString(int season, String round, int leagueId) {
|
||||||
round = round.replace(" ", "_");
|
round = round.replace(" ", "_");
|
||||||
Integer matchday = null;
|
Integer matchday = null;
|
||||||
APIFootballConnector con = APIFootballConnector.getAPIFootballConnectorInstance(this.season);
|
APIFootballConnector con = APIFootballConnector.getAPIFootballConnectorInstance(season);
|
||||||
JSONObject roundsObject = con.getMatchdays(leagueId);
|
JSONObject roundsObject = con.getMatchdays(leagueId);
|
||||||
JSONArray roundsArray = (JSONArray)(((JSONObject) roundsObject.get("api")).get("fixtures"));
|
JSONArray roundsArray = (JSONArray)(((JSONObject) roundsObject.get("api")).get("fixtures"));
|
||||||
for (int i = 0; i < roundsArray.size(); i++) {
|
for (int i = 0; i < roundsArray.size(); i++) {
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
package de.jeyp91.apifootball;
|
package de.jeyp91.apifootball;
|
||||||
|
|
||||||
import de.jeyp91.gists.GistProvider;
|
import de.jeyp91.ResourceProvider;
|
||||||
|
import de.jeyp91.S3Provider;
|
||||||
import org.apache.http.HttpResponse;
|
import org.apache.http.HttpResponse;
|
||||||
import org.apache.http.client.HttpClient;
|
import org.apache.http.client.HttpClient;
|
||||||
import org.apache.http.client.methods.HttpGet;
|
import org.apache.http.client.methods.HttpGet;
|
||||||
import org.apache.http.impl.client.HttpClientBuilder;
|
import org.apache.http.impl.client.HttpClientBuilder;
|
||||||
|
import org.json.simple.JSONArray;
|
||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
@@ -12,51 +14,42 @@ import java.util.HashSet;
|
|||||||
|
|
||||||
public class APIFootballUpdater {
|
public class APIFootballUpdater {
|
||||||
|
|
||||||
private final int season;
|
|
||||||
private final GistProvider provider;
|
|
||||||
|
|
||||||
private final String exceededLimitError = "{\"api\":{\"results\":0,\"error\":\"You have reached the request limit for the day\"}}";
|
private final String exceededLimitError = "{\"api\":{\"results\":0,\"error\":\"You have reached the request limit for the day\"}}";
|
||||||
|
|
||||||
public APIFootballUpdater(int season) {
|
public APIFootballUpdater() {
|
||||||
this.season = season;
|
|
||||||
this.provider = GistProvider.getInstance();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateFixtures(int league) throws IOException {
|
public void updateFixtures(int league) {
|
||||||
String apiFootballUrl = "https://v2.api-football.com/fixtures/league/" + league + "?timezone=Europe/Berlin";
|
String apiFootballUrl = "https://v2.api-football.com/fixtures/league/" + league + "?timezone=Europe/Berlin";
|
||||||
String filename = "matches_league_" + league + ".json";
|
|
||||||
String content = getRawData(apiFootballUrl);
|
String content = getRawData(apiFootballUrl);
|
||||||
if(!content.equals(this.exceededLimitError)) {
|
if(!content.equals(this.exceededLimitError)) {
|
||||||
writeStringToGist(filename, content);
|
S3Provider prov = new S3Provider();
|
||||||
|
prov.writeFixturesToS3(league, content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateAllFixtures() throws IOException {
|
public void updateAllFixtures() {
|
||||||
HashSet<Integer> leagues = provider.getLeagues();
|
HashSet<Integer> leagues = getLeagues();
|
||||||
for (Integer league : leagues) {
|
for (Integer league : leagues) {
|
||||||
updateFixtures(league);
|
updateFixtures(league);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateRounds(int league) throws IOException {
|
public void updateAllRounds() {
|
||||||
String apiFootballUrl = "https://v2.api-football.com/fixtures/rounds/" + league;
|
HashSet<Integer> leagues = getLeagues();
|
||||||
String filename = "rounds_" + league + ".json";
|
|
||||||
String content = getRawData(apiFootballUrl);
|
|
||||||
if(!content.equals(this.exceededLimitError)) {
|
|
||||||
writeStringToGist(filename, content);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateAllRounds() throws IOException {
|
|
||||||
HashSet<Integer> leagues = provider.getLeagues();
|
|
||||||
for (Integer league : leagues) {
|
for (Integer league : leagues) {
|
||||||
updateRounds(league);
|
updateRounds(league);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void writeStringToGist(String filename, String content) throws UnsupportedEncodingException {
|
public void updateRounds(int league) {
|
||||||
String id = this.provider.getGistID("APIFootball_" + this.season);
|
String apiFootballUrl = "https://v2.api-football.com/fixtures/rounds/" + league;
|
||||||
this.provider.updateGist(id, filename, content);
|
String content = getRawData(apiFootballUrl);
|
||||||
|
if(!content.equals(this.exceededLimitError)) {
|
||||||
|
S3Provider prov = new S3Provider();
|
||||||
|
prov.writeRoundsToS3(league, content);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRawData(String requestUrl) {
|
public String getRawData(String requestUrl) {
|
||||||
@@ -103,4 +96,15 @@ public class APIFootballUpdater {
|
|||||||
}
|
}
|
||||||
return result.toString();
|
return result.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public HashSet<Integer> getLeagues() {
|
||||||
|
JSONArray leaguesArray = ResourceProvider.getLigenConfig();
|
||||||
|
HashSet<Integer> leagues = new HashSet<>();
|
||||||
|
for (Object leagueObject : leaguesArray) {
|
||||||
|
JSONObject leagueJSONObject = (JSONObject) leagueObject;
|
||||||
|
Integer leagueId = ((Long) leagueJSONObject.get("league_id")).intValue();
|
||||||
|
leagues.add(leagueId);
|
||||||
|
}
|
||||||
|
return leagues;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,278 +0,0 @@
|
|||||||
package de.jeyp91.gists;
|
|
||||||
|
|
||||||
import com.google.api.client.util.DateTime;
|
|
||||||
import com.google.common.io.Resources;
|
|
||||||
import org.apache.commons.codec.binary.Base64;
|
|
||||||
import org.apache.http.HttpHeaders;
|
|
||||||
import org.apache.http.HttpResponse;
|
|
||||||
import org.apache.http.client.HttpClient;
|
|
||||||
import org.apache.http.client.methods.HttpGet;
|
|
||||||
import org.apache.http.client.methods.HttpPatch;
|
|
||||||
import org.apache.http.entity.StringEntity;
|
|
||||||
import org.apache.http.impl.client.HttpClientBuilder;
|
|
||||||
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.BufferedReader;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
public class GistProvider {
|
|
||||||
|
|
||||||
private static GistProvider prov = null;
|
|
||||||
private final JSONArray gistList;
|
|
||||||
private String username;
|
|
||||||
private String password;
|
|
||||||
|
|
||||||
private GistProvider() {
|
|
||||||
readConfig();
|
|
||||||
this.gistList = listAllGists();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void readConfig() {
|
|
||||||
JSONParser jsonParser = new JSONParser();
|
|
||||||
URL url = Resources.getResource("Gist_Config.json");
|
|
||||||
JSONObject gistConfig = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
String jsonConfig = Resources.toString(url, StandardCharsets.UTF_8);
|
|
||||||
//Read JSON file
|
|
||||||
gistConfig = (JSONObject) jsonParser.parse(jsonConfig);
|
|
||||||
|
|
||||||
} catch (IOException | ParseException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
this.username = gistConfig.get("username").toString();
|
|
||||||
this.password = gistConfig.get("password").toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static GistProvider getInstance() {
|
|
||||||
if (prov == null) {
|
|
||||||
prov = new GistProvider();
|
|
||||||
}
|
|
||||||
return prov;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JSONArray listAllGists() {
|
|
||||||
String gistsRaw = getRawData("https://api.github.com/gists");
|
|
||||||
return stringToJSONArray(gistsRaw);
|
|
||||||
}
|
|
||||||
|
|
||||||
public DateTime getGistUpdatedTimestamp(String gistDescription) {
|
|
||||||
DateTime updated = null;
|
|
||||||
for (Object o : this.gistList) {
|
|
||||||
JSONObject gist = (JSONObject) o;
|
|
||||||
String desc = gist.get("description").toString();
|
|
||||||
if (gistDescription.equals(desc)) {
|
|
||||||
updated = new DateTime(gist.get("updated_at").toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return updated;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getGistID(String gistDescription) {
|
|
||||||
String id = null;
|
|
||||||
for (Object o : this.gistList) {
|
|
||||||
JSONObject gist = (JSONObject) o;
|
|
||||||
String desc = gist.get("description").toString();
|
|
||||||
if (gistDescription.equals(desc)) {
|
|
||||||
id = gist.get("id").toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String updateGist(String id, String file, String content) throws UnsupportedEncodingException {
|
|
||||||
String requestUrl = "https://api.github.com/gists/" + id;
|
|
||||||
String auth = this.username + ":" + this.password;
|
|
||||||
byte[] encodedAuth = Base64.encodeBase64(
|
|
||||||
auth.getBytes(StandardCharsets.ISO_8859_1));
|
|
||||||
String authHeader = "Basic " + new String(encodedAuth);
|
|
||||||
|
|
||||||
HttpClient client = HttpClientBuilder
|
|
||||||
.create()
|
|
||||||
.build();
|
|
||||||
HttpPatch request = new HttpPatch(requestUrl);
|
|
||||||
request.setHeader(HttpHeaders.AUTHORIZATION, authHeader);
|
|
||||||
request.setHeader(HttpHeaders.ACCEPT, "application/vnd.github.v3+json");
|
|
||||||
|
|
||||||
JSONObject contentObject = new JSONObject();
|
|
||||||
contentObject.put("content", content);
|
|
||||||
JSONObject fileObject = new JSONObject();
|
|
||||||
fileObject.put(file, contentObject);
|
|
||||||
JSONObject filesObject = new JSONObject();
|
|
||||||
filesObject.put("files", fileObject);
|
|
||||||
|
|
||||||
String bodyString = filesObject.toString();
|
|
||||||
|
|
||||||
StringEntity body = new StringEntity(filesObject.toString());
|
|
||||||
body.setContentType("application/json");
|
|
||||||
body.setContentEncoding("UTF-8");
|
|
||||||
request.setEntity(body);
|
|
||||||
|
|
||||||
HttpResponse response = null;
|
|
||||||
try {
|
|
||||||
response = client.execute(request);
|
|
||||||
} catch (IOException e) {
|
|
||||||
/* TODO */
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
BufferedReader rd = null;
|
|
||||||
try {
|
|
||||||
rd = new BufferedReader(
|
|
||||||
new InputStreamReader(response.getEntity().getContent(), StandardCharsets.UTF_8)
|
|
||||||
);
|
|
||||||
} catch (IOException e) {
|
|
||||||
/* TODO */
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
StringBuilder result = new StringBuilder();
|
|
||||||
String line = "";
|
|
||||||
while (true) {
|
|
||||||
try {
|
|
||||||
line = rd.readLine();
|
|
||||||
} catch (IOException e) {
|
|
||||||
/* TODO */
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Stop reading if last line was found.
|
|
||||||
if (line == null) break;
|
|
||||||
|
|
||||||
result.append(line);
|
|
||||||
}
|
|
||||||
return result.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public JSONArray getTeamIdMatcher() {
|
|
||||||
return stringToJSONArray(getFileFromGist("Team_ID_Matcher.json"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public HashSet<Integer> getLeagues() {
|
|
||||||
JSONObject leaguesObject = stringToJSONObject(getFileFromGist("Ligen.json"));
|
|
||||||
JSONArray leaguesArray = (JSONArray) leaguesObject.get("Ligen");
|
|
||||||
HashSet<Integer> leagues = new HashSet<>();
|
|
||||||
for (Object leagueObject : leaguesArray) {
|
|
||||||
JSONObject leagueJSONObject = (JSONObject) leagueObject;
|
|
||||||
Integer leagueId = ((Long) leagueJSONObject.get("league_id")).intValue();
|
|
||||||
leagues.add(leagueId);
|
|
||||||
}
|
|
||||||
return leagues;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFileFromGist(String filename) {
|
|
||||||
String fileurl = null;
|
|
||||||
for (Object o : this.gistList) {
|
|
||||||
JSONObject gist = (JSONObject) o;
|
|
||||||
JSONObject files = (JSONObject)gist.get("files");
|
|
||||||
Set<String> filenames = files.keySet();
|
|
||||||
if(filenames.contains(filename)) {
|
|
||||||
fileurl = ((JSONObject)files.get(filename)).get("raw_url").toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String content = null;
|
|
||||||
if(fileurl != null) {
|
|
||||||
content = getRawData(fileurl);
|
|
||||||
}
|
|
||||||
return content;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getRawData(String requestUrl) {
|
|
||||||
|
|
||||||
String auth = this.username + ":" + this.password;
|
|
||||||
byte[] encodedAuth = Base64.encodeBase64(
|
|
||||||
auth.getBytes(StandardCharsets.ISO_8859_1));
|
|
||||||
String authHeader = "Basic " + new String(encodedAuth);
|
|
||||||
|
|
||||||
HttpClient client = HttpClientBuilder
|
|
||||||
.create()
|
|
||||||
.build();
|
|
||||||
HttpGet request = new HttpGet(requestUrl);
|
|
||||||
request.setHeader(HttpHeaders.AUTHORIZATION, authHeader);
|
|
||||||
|
|
||||||
HttpResponse response = null;
|
|
||||||
try {
|
|
||||||
response = client.execute(request);
|
|
||||||
} catch (IOException e) {
|
|
||||||
/* TODO */
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
BufferedReader rd = null;
|
|
||||||
try {
|
|
||||||
rd = new BufferedReader(
|
|
||||||
new InputStreamReader(response.getEntity().getContent(), "UTF-8")
|
|
||||||
);
|
|
||||||
} catch (IOException e) {
|
|
||||||
/* TODO */
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
StringBuilder result = new StringBuilder();
|
|
||||||
String line = "";
|
|
||||||
while (true) {
|
|
||||||
try {
|
|
||||||
line = rd.readLine();
|
|
||||||
} catch (IOException e) {
|
|
||||||
/* TODO */
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Stop reading if last line was found.
|
|
||||||
if (line == null) break;
|
|
||||||
|
|
||||||
result.append(line);
|
|
||||||
}
|
|
||||||
return result.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private JSONArray stringToJSONArray(String rawData) {
|
|
||||||
|
|
||||||
JSONParser parser = new JSONParser();
|
|
||||||
JSONArray data = null;
|
|
||||||
try {
|
|
||||||
data = (JSONArray) parser.parse(rawData);
|
|
||||||
} catch (Exception e) {
|
|
||||||
/* TODO */
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
private JSONObject stringToJSONObject(String rawData) {
|
|
||||||
|
|
||||||
JSONParser parser = new JSONParser();
|
|
||||||
JSONObject data = null;
|
|
||||||
try {
|
|
||||||
data = (JSONObject) parser.parse(rawData);
|
|
||||||
} catch (Exception e) {
|
|
||||||
/* TODO */
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTippligaConfig(String filename) {
|
|
||||||
return getFileFromGist(filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTippligaBaseConfig(String filename) {
|
|
||||||
return getFileFromGist(filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
public JSONObject getAPIFootballLeagueConfig(int league) {
|
|
||||||
String filename = "matches_league_" + league + ".json";
|
|
||||||
String file = getFileFromGist(filename);
|
|
||||||
return stringToJSONObject(file);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
package de.jeyp91.gists;
|
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.util.HashSet;
|
|
||||||
|
|
||||||
public class MatchesListGistUpdater {
|
|
||||||
private HashSet<Integer> leagues;
|
|
||||||
private final String gistId;
|
|
||||||
private final GistProvider prov;
|
|
||||||
|
|
||||||
public MatchesListGistUpdater() {
|
|
||||||
this.prov = GistProvider.getInstance();
|
|
||||||
this.gistId = prov.getGistID("Spiele");
|
|
||||||
this.leagues = prov.getLeagues();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateAllLeagues() throws UnsupportedEncodingException {
|
|
||||||
for(Integer league : this.leagues) {
|
|
||||||
updateLeague(league);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateLeague(int league) throws UnsupportedEncodingException {
|
|
||||||
MatchesListCreator creator = new MatchesListCreator(league);
|
|
||||||
String filename = creator.getFilename();
|
|
||||||
String content = creator.getMatchesBeautful();
|
|
||||||
GistProvider prov = GistProvider.getInstance();
|
|
||||||
prov.updateGist(this.gistId, filename, content);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
package de.jeyp91;
|
package de.jeyp91.teamidmatcher;
|
||||||
|
|
||||||
import com.google.common.collect.HashBiMap;
|
import com.google.common.collect.HashBiMap;
|
||||||
|
import de.jeyp91.ResourceProvider;
|
||||||
|
import de.jeyp91.StatusHolder;
|
||||||
import de.jeyp91.apifootball.APIFootballMatch;
|
import de.jeyp91.apifootball.APIFootballMatch;
|
||||||
import de.jeyp91.gists.GistProvider;
|
|
||||||
import org.apache.logging.log4j.*;
|
import org.apache.logging.log4j.*;
|
||||||
import org.json.simple.JSONArray;
|
import org.json.simple.JSONArray;
|
||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
@@ -19,14 +20,15 @@ public class TeamIDMatcher {
|
|||||||
private static void initBiMap() {
|
private static void initBiMap() {
|
||||||
if(!init) {
|
if(!init) {
|
||||||
ids = HashBiMap.create();
|
ids = HashBiMap.create();
|
||||||
GistProvider prov = GistProvider.getInstance();
|
|
||||||
teams = prov.getTeamIdMatcher();
|
teams = ResourceProvider.getTeamIDMatcherConfig();
|
||||||
|
|
||||||
for (Object team : teams) {
|
for (Object team : teams) {
|
||||||
int tippligaID = ((Long) ((JSONObject) team).get("tippligaID")).intValue();
|
int tippligaID = ((Long) ((JSONObject) team).get("tippligaID")).intValue();
|
||||||
int apiFootballID = ((Long) ((JSONObject) team).get("apiFootballID")).intValue();
|
int apiFootballID = ((Long) ((JSONObject) team).get("apiFootballID")).intValue();
|
||||||
ids.put(tippligaID, apiFootballID);
|
ids.put(tippligaID, apiFootballID);
|
||||||
}
|
}
|
||||||
|
|
||||||
init = true;
|
init = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -60,7 +62,7 @@ public class TeamIDMatcher {
|
|||||||
public static String getTeamNameFromTippligaId(Integer id) {
|
public static String getTeamNameFromTippligaId(Integer id) {
|
||||||
initBiMap();
|
initBiMap();
|
||||||
String name = "";
|
String name = "";
|
||||||
for(Object team:teams) {
|
for(Object team : teams) {
|
||||||
int tippligaID = ((Long)((JSONObject) team).get("tippligaID")).intValue();
|
int tippligaID = ((Long)((JSONObject) team).get("tippligaID")).intValue();
|
||||||
if(id == tippligaID) {
|
if(id == tippligaID) {
|
||||||
name = (((JSONObject) team).get("teamname")).toString();
|
name = (((JSONObject) team).get("teamname")).toString();
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package de.jeyp91.gists;
|
package de.jeyp91.teamidmatcher;
|
||||||
|
|
||||||
import de.jeyp91.apifootball.APIFootballConnector;
|
import de.jeyp91.apifootball.APIFootballConnector;
|
||||||
import org.json.simple.JSONArray;
|
import org.json.simple.JSONArray;
|
||||||
@@ -4,10 +4,8 @@ import java.sql.ResultSet;
|
|||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
import de.jeyp91.BaseMatch;
|
import de.jeyp91.BaseMatch;
|
||||||
import de.jeyp91.StatusHolder;
|
import de.jeyp91.teamidmatcher.TeamIDMatcher;
|
||||||
import de.jeyp91.TeamIDMatcher;
|
|
||||||
import de.jeyp91.apifootball.APIFootballMatch;
|
import de.jeyp91.apifootball.APIFootballMatch;
|
||||||
import de.jeyp91.openligadb.OpenLigaDBMatch;
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,9 @@
|
|||||||
package de.jeyp91.tippliga;
|
package de.jeyp91.tippliga;
|
||||||
|
|
||||||
import de.jeyp91.gists.GistProvider;
|
import de.jeyp91.tippligaforum.TippligaConfigProvider;
|
||||||
import org.json.simple.JSONArray;
|
import org.json.simple.JSONArray;
|
||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
import org.json.simple.parser.JSONParser;
|
|
||||||
import org.json.simple.parser.ParseException;
|
|
||||||
|
|
||||||
import java.text.DateFormat;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -27,15 +23,9 @@ public class TLWMatchdaysCreator {
|
|||||||
TLWMatchesCreatorFootball matchesCreator = new TLWMatchesCreatorFootball(2021, 1, configPath);
|
TLWMatchesCreatorFootball matchesCreator = new TLWMatchesCreatorFootball(2021, 1, configPath);
|
||||||
this.matches = matchesCreator.getMatches();
|
this.matches = matchesCreator.getMatches();
|
||||||
|
|
||||||
GistProvider prov = GistProvider.getInstance();
|
TippligaConfigProvider prov = new TippligaConfigProvider(season);
|
||||||
String jsonConfig = prov.getTippligaConfig(configPath);
|
this.configObject = prov.getTippligaConfig(configPath);
|
||||||
|
|
||||||
JSONParser jsonParser = new JSONParser();
|
|
||||||
try {
|
|
||||||
this.configObject = (JSONObject) jsonParser.parse(jsonConfig);
|
|
||||||
} catch (ParseException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
//Read JSON file
|
//Read JSON file
|
||||||
this.matchesPerMatchday = ((Long) this.configObject.get("matchesPerMatchday")).intValue();
|
this.matchesPerMatchday = ((Long) this.configObject.get("matchesPerMatchday")).intValue();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package de.jeyp91.tippliga;
|
package de.jeyp91.tippliga;
|
||||||
|
|
||||||
import java.text.ParseException;
|
import de.jeyp91.tippligaforum.TippligaSQLConnector;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
@@ -14,11 +15,11 @@ public class TLWMatchdaysUpdater {
|
|||||||
ArrayList<TLWMatchday> matchdaysUpdated;
|
ArrayList<TLWMatchday> matchdaysUpdated;
|
||||||
String beautifulInfo = "";
|
String beautifulInfo = "";
|
||||||
|
|
||||||
public TLWMatchdaysUpdater(int season, int league, String configPath) throws ParseException {
|
public TLWMatchdaysUpdater(int season, int league, String configPath) {
|
||||||
this.season = season;
|
this.season = season;
|
||||||
this.league = league;
|
this.league = league;
|
||||||
|
|
||||||
TippligaSQLConnector conn = new TippligaSQLConnector();
|
TippligaSQLConnector conn = TippligaSQLConnector.getInstance();
|
||||||
this.matchdaysOriginal = conn.getMatchdays(String.valueOf(season), String.valueOf(league));
|
this.matchdaysOriginal = conn.getMatchdays(String.valueOf(season), String.valueOf(league));
|
||||||
this.matchdaysOriginal.sort(Comparator.comparing(TLWMatchday::getMatchday));
|
this.matchdaysOriginal.sort(Comparator.comparing(TLWMatchday::getMatchday));
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +1,13 @@
|
|||||||
package de.jeyp91.tippliga;
|
package de.jeyp91.tippliga;
|
||||||
|
|
||||||
import com.google.common.io.Resources;
|
|
||||||
import de.jeyp91.apifootball.APIFootballConnector;
|
import de.jeyp91.apifootball.APIFootballConnector;
|
||||||
import de.jeyp91.apifootball.APIFootballMatch;
|
import de.jeyp91.apifootball.APIFootballMatch;
|
||||||
import de.jeyp91.gists.GistProvider;
|
import de.jeyp91.tippligaforum.TippligaConfigProvider;
|
||||||
import org.json.simple.JSONArray;
|
import org.json.simple.JSONArray;
|
||||||
import org.json.simple.JSONObject;
|
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;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
public class TLWMatchesCreatorFootball extends TLWMatchesCreatorBase {
|
public class TLWMatchesCreatorFootball extends TLWMatchesCreatorBase {
|
||||||
|
|
||||||
@@ -35,20 +27,12 @@ public class TLWMatchesCreatorFootball extends TLWMatchesCreatorBase {
|
|||||||
this.league = league;
|
this.league = league;
|
||||||
this.conn = APIFootballConnector.getAPIFootballConnectorInstance(season - 1);
|
this.conn = APIFootballConnector.getAPIFootballConnectorInstance(season - 1);
|
||||||
|
|
||||||
GistProvider prov = GistProvider.getInstance();
|
TippligaConfigProvider prov = new TippligaConfigProvider(season);
|
||||||
String jsonConfig = prov.getTippligaConfig(configFileName);
|
JSONObject config = prov.getTippligaConfig(configFileName);
|
||||||
|
|
||||||
try {
|
this.numberOfMatchdays = ((Long) config.get("numberOfMatchdays")).intValue();
|
||||||
JSONParser jsonParser = new JSONParser();
|
this.matchdayConfig = (JSONArray) config.get("matchdayConfig");
|
||||||
//Read JSON file
|
this.ko = ((Long) config.get("ko")).intValue();
|
||||||
JSONObject config = (JSONObject) jsonParser.parse(jsonConfig);
|
|
||||||
this.numberOfMatchdays = ((Long) config.get("numberOfMatchdays")).intValue();
|
|
||||||
this.matchdayConfig = (JSONArray) config.get("matchdayConfig");
|
|
||||||
this.ko = ((Long) config.get("ko")).intValue();
|
|
||||||
|
|
||||||
} catch (ParseException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.publicateMatchObjects();
|
this.publicateMatchObjects();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
package de.jeyp91.tippliga;
|
package de.jeyp91.tippliga;
|
||||||
|
|
||||||
|
import de.jeyp91.ResourceProvider;
|
||||||
import de.jeyp91.StatusHolder;
|
import de.jeyp91.StatusHolder;
|
||||||
import de.jeyp91.gists.GistProvider;
|
import de.jeyp91.tippligaforum.TippligaConfigProvider;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.json.simple.JSONArray;
|
import org.json.simple.JSONArray;
|
||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
import org.json.simple.parser.JSONParser;
|
|
||||||
import org.json.simple.parser.ParseException;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
@@ -28,22 +27,12 @@ public class TLWMatchesCreatorTipperLeague extends TLWMatchesCreatorBase {
|
|||||||
this.league = league;
|
this.league = league;
|
||||||
this.matchdays = matchdays;
|
this.matchdays = matchdays;
|
||||||
|
|
||||||
try {
|
|
||||||
JSONParser jsonParser = new JSONParser();
|
|
||||||
GistProvider prov = GistProvider.getInstance();
|
|
||||||
|
|
||||||
String matchPairingConfigString = prov.getTippligaBaseConfig("Tipper_Match_Pair_Config.json");
|
this.matchPairingConfig = ResourceProvider.getTipperMatchPairConfig();
|
||||||
this.matchPairingConfig = (JSONArray) jsonParser.parse(matchPairingConfigString);
|
this.tipperTeamConfig = ResourceProvider.getTipperTeamConfig();
|
||||||
|
|
||||||
String tipperListString = prov.getTippligaConfig(configFileName);
|
TippligaConfigProvider prov = new TippligaConfigProvider(season);
|
||||||
this.tipperList = (JSONObject) jsonParser.parse(tipperListString);
|
this.tipperList = prov.getTippligaConfig(configFileName);
|
||||||
|
|
||||||
String tipperTeamConfigString = prov.getTippligaBaseConfig("Tipper_Team_Config.json");
|
|
||||||
this.tipperTeamConfig = (JSONArray) jsonParser.parse(tipperTeamConfigString);
|
|
||||||
|
|
||||||
} catch (ParseException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.publicateMatchObjects();
|
this.publicateMatchObjects();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
package de.jeyp91.tippliga;
|
package de.jeyp91.tippliga;
|
||||||
|
|
||||||
import de.jeyp91.gists.GistProvider;
|
import de.jeyp91.ResourceProvider;
|
||||||
|
import de.jeyp91.tippligaforum.TippligaConfigProvider;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.json.simple.JSONArray;
|
import org.json.simple.JSONArray;
|
||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
import org.json.simple.parser.JSONParser;
|
|
||||||
import org.json.simple.parser.ParseException;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
@@ -27,24 +26,13 @@ public class TLWMatchesCreatorTipperPokal extends TLWMatchesCreatorBase{
|
|||||||
this.league = league;
|
this.league = league;
|
||||||
this.matchdays = matchdays;
|
this.matchdays = matchdays;
|
||||||
|
|
||||||
|
TippligaConfigProvider prov = new TippligaConfigProvider(season);
|
||||||
|
this.tipperList = prov.getTippligaConfig(configFileName);
|
||||||
|
|
||||||
GistProvider prov = GistProvider.getInstance();
|
this.tipperTeamConfig = ResourceProvider.getTipperTeamConfig();
|
||||||
|
|
||||||
this.TLWMatches = new ArrayList<>();
|
this.TLWMatches = new ArrayList<>();
|
||||||
|
|
||||||
try {
|
|
||||||
JSONParser jsonParser = new JSONParser();
|
|
||||||
|
|
||||||
String tipperListString = prov.getTippligaConfig(configFileName);
|
|
||||||
this.tipperList = (JSONObject) jsonParser.parse(tipperListString);
|
|
||||||
|
|
||||||
String tipperTeamConfigString = prov.getTippligaBaseConfig("Tipper_Team_Config.json");
|
|
||||||
this.tipperTeamConfig = (JSONArray) jsonParser.parse(tipperTeamConfigString);
|
|
||||||
|
|
||||||
} catch (ParseException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.publicateMatchObjects();
|
this.publicateMatchObjects();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,19 +1,14 @@
|
|||||||
package de.jeyp91.tippliga;
|
package de.jeyp91.tippliga;
|
||||||
|
|
||||||
import com.google.api.client.util.DateTime;
|
|
||||||
import de.jeyp91.apifootball.APIFootballMatch;
|
import de.jeyp91.apifootball.APIFootballMatch;
|
||||||
import de.jeyp91.gists.GistProvider;
|
import de.jeyp91.tippligaforum.TippligaConfigProvider;
|
||||||
import org.json.simple.JSONArray;
|
import org.json.simple.JSONArray;
|
||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
import org.json.simple.parser.JSONParser;
|
|
||||||
import org.json.simple.parser.ParseException;
|
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.time.temporal.ChronoUnit;
|
import java.time.temporal.ChronoUnit;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
public class TLWMatchesManagerBase {
|
public class TLWMatchesManagerBase {
|
||||||
|
|
||||||
@@ -27,19 +22,11 @@ public class TLWMatchesManagerBase {
|
|||||||
|
|
||||||
protected void initConfigParamsFromFile(String configFileName) {
|
protected void initConfigParamsFromFile(String configFileName) {
|
||||||
|
|
||||||
GistProvider prov = GistProvider.getInstance();
|
TippligaConfigProvider prov = new TippligaConfigProvider(this.season);
|
||||||
String jsonConfig = prov.getTippligaConfig(configFileName);
|
JSONObject config = prov.getTippligaConfig(configFileName);
|
||||||
try {
|
this.numberOfMatchdays = ((Long) config.get("numberOfMatchdays")).intValue();
|
||||||
JSONParser jsonParser = new JSONParser();
|
this.matchdayConfig = (JSONArray) config.get("matchdayConfig");
|
||||||
//Read JSON file
|
this.ko = ((Long) config.get("ko")).intValue();
|
||||||
JSONObject config = (JSONObject) jsonParser.parse(jsonConfig);
|
|
||||||
this.numberOfMatchdays = ((Long) config.get("numberOfMatchdays")).intValue();
|
|
||||||
this.matchdayConfig = (JSONArray) config.get("matchdayConfig");
|
|
||||||
this.ko = ((Long) config.get("ko")).intValue();
|
|
||||||
|
|
||||||
} catch (ParseException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayList<TLWMatch> getMatchesStartingFromSecondDay(ArrayList<TLWMatch> matches) {
|
public static ArrayList<TLWMatch> getMatchesStartingFromSecondDay(ArrayList<TLWMatch> matches) {
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package de.jeyp91.tippliga;
|
|||||||
|
|
||||||
import de.jeyp91.App;
|
import de.jeyp91.App;
|
||||||
import de.jeyp91.StatusHolder;
|
import de.jeyp91.StatusHolder;
|
||||||
import de.jeyp91.TeamIDMatcher;
|
import de.jeyp91.teamidmatcher.TeamIDMatcher;
|
||||||
import de.jeyp91.apifootball.APIFootballMatch;
|
import de.jeyp91.apifootball.APIFootballMatch;
|
||||||
import de.jeyp91.apifootball.APIFootballMatchesProvider;
|
import de.jeyp91.apifootball.APIFootballMatchesProvider;
|
||||||
|
import de.jeyp91.tippligaforum.TippligaSQLConnector;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.json.simple.JSONArray;
|
import org.json.simple.JSONArray;
|
||||||
@@ -35,7 +36,7 @@ public class TLWMatchesUpdaterFootball extends TLWMatchesManagerBase {
|
|||||||
private void initUpdates() {
|
private void initUpdates() {
|
||||||
|
|
||||||
APIFootballMatchesProvider apiFootballMatchesProvider = new APIFootballMatchesProvider(this.season);
|
APIFootballMatchesProvider apiFootballMatchesProvider = new APIFootballMatchesProvider(this.season);
|
||||||
TippligaSQLConnector tippligaSQLConnector = new TippligaSQLConnector();
|
TippligaSQLConnector tippligaSQLConnector = TippligaSQLConnector.getInstance();
|
||||||
for (Object singleMatchdayConfig : this.matchdayConfig) {
|
for (Object singleMatchdayConfig : this.matchdayConfig) {
|
||||||
int tlwMatchday = ((Long) ((JSONObject) singleMatchdayConfig).get("TLWMatchday")).intValue();
|
int tlwMatchday = ((Long) ((JSONObject) singleMatchdayConfig).get("TLWMatchday")).intValue();
|
||||||
JSONArray matchesConfig = (JSONArray) ((JSONObject) singleMatchdayConfig).get("matchesConfig");
|
JSONArray matchesConfig = (JSONArray) ((JSONObject) singleMatchdayConfig).get("matchesConfig");
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package de.jeyp91.tippliga;
|
package de.jeyp91.tippliga;
|
||||||
|
|
||||||
|
import de.jeyp91.tippligaforum.TippligaSQLConnector;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -8,7 +10,7 @@ public class TLWTeamsCreator {
|
|||||||
int season;
|
int season;
|
||||||
int league;
|
int league;
|
||||||
ArrayList<TLWMatch> matches;
|
ArrayList<TLWMatch> matches;
|
||||||
TippligaSQLConnector connector = new TippligaSQLConnector();
|
TippligaSQLConnector connector = TippligaSQLConnector.getInstance();
|
||||||
|
|
||||||
public TLWTeamsCreator(int season, int league, ArrayList<TLWMatch> matches) {
|
public TLWTeamsCreator(int season, int league, ArrayList<TLWMatch> matches) {
|
||||||
this.season = season;
|
this.season = season;
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package de.jeyp91.tippliga;
|
package de.jeyp91.tippliga;
|
||||||
|
|
||||||
|
import de.jeyp91.tippligaforum.TippligaSQLConnector;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
@@ -13,7 +15,7 @@ public class TLWTeamsUpdater {
|
|||||||
|
|
||||||
public TLWTeamsUpdater(int season, int league, String configFileName) throws Exception {
|
public TLWTeamsUpdater(int season, int league, String configFileName) throws Exception {
|
||||||
|
|
||||||
TippligaSQLConnector conn = new TippligaSQLConnector();
|
TippligaSQLConnector conn = TippligaSQLConnector.getInstance();
|
||||||
|
|
||||||
this.season = season;
|
this.season = season;
|
||||||
this.league = league;
|
this.league = league;
|
||||||
@@ -47,7 +49,7 @@ public class TLWTeamsUpdater {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initMissingTeams(HashSet<Integer> missingIds) {
|
private void initMissingTeams(HashSet<Integer> missingIds) {
|
||||||
TippligaSQLConnector conn = new TippligaSQLConnector();
|
TippligaSQLConnector conn = TippligaSQLConnector.getInstance();
|
||||||
for (Integer id : missingIds) {
|
for (Integer id : missingIds) {
|
||||||
ArrayList<TLWTeam> teams = conn.getTeams(String.valueOf(id));
|
ArrayList<TLWTeam> teams = conn.getTeams(String.valueOf(id));
|
||||||
missingTeams.add(new TLWTeam(
|
missingTeams.add(new TLWTeam(
|
||||||
|
|||||||
@@ -1,27 +1,26 @@
|
|||||||
package de.jeyp91.gists;
|
package de.jeyp91.tippligaforum;
|
||||||
|
|
||||||
import com.google.gson.*;
|
import com.google.gson.*;
|
||||||
|
import de.jeyp91.S3Provider;
|
||||||
|
import de.jeyp91.apifootball.APIFootballMatch;
|
||||||
import org.json.simple.JSONArray;
|
import org.json.simple.JSONArray;
|
||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
|
|
||||||
public class MatchesListCreator {
|
public class MatchesListCreator {
|
||||||
|
|
||||||
private final JSONObject matches = new JSONObject();
|
private JSONArray matches;
|
||||||
private final String country;
|
private final String country;
|
||||||
private final String leagueName;
|
private final String leagueName;
|
||||||
|
|
||||||
public MatchesListCreator(int league) {
|
public MatchesListCreator(int league) {
|
||||||
GistProvider provider = GistProvider.getInstance();
|
S3Provider prov = new S3Provider();
|
||||||
JSONObject leagueConfig = provider.getAPIFootballLeagueConfig(league);
|
JSONObject leagueConfig = prov.getFixturesJSONFromS3(league);
|
||||||
JSONObject api = (JSONObject) leagueConfig.get("api");
|
JSONObject api = (JSONObject) leagueConfig.get("api");
|
||||||
JSONArray matchesAPIFootball = (JSONArray) api.get("fixtures");
|
JSONArray matchesAPIFootball = (JSONArray) api.get("fixtures");
|
||||||
JSONObject firstMatchAPIFootball = (JSONObject) matchesAPIFootball.get(0);
|
JSONObject firstMatchAPIFootball = (JSONObject) matchesAPIFootball.get(0);
|
||||||
JSONObject leagueObject = (JSONObject) firstMatchAPIFootball.get("league");
|
JSONObject leagueObject = (JSONObject) firstMatchAPIFootball.get("league");
|
||||||
this.country = leagueObject.get("country").toString();
|
this.country = leagueObject.get("country").toString();
|
||||||
this.leagueName = leagueObject.get("name").toString();
|
this.leagueName = leagueObject.get("name").toString();
|
||||||
matches.put("country", this.country);
|
|
||||||
matches.put("leagueName", this.leagueName);
|
|
||||||
matches.put("leagueId", league);
|
|
||||||
populateMatches(matchesAPIFootball);
|
populateMatches(matchesAPIFootball);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,37 +30,44 @@ public class MatchesListCreator {
|
|||||||
JSONObject matchAPIFootball = (JSONObject) matchAPIFootballObject;
|
JSONObject matchAPIFootball = (JSONObject) matchAPIFootballObject;
|
||||||
JSONObject match = new JSONObject();
|
JSONObject match = new JSONObject();
|
||||||
|
|
||||||
String matchday = matchAPIFootball.get("round").toString();
|
Long leagueId = (Long) matchAPIFootball.get("league_id");
|
||||||
match.put("matchday", matchday);
|
String matchdayString = matchAPIFootball.get("round").toString();
|
||||||
|
int matchday = APIFootballMatch.getMatchdayFromRoundString(2021, 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");
|
JSONObject teamHome = (JSONObject) matchAPIFootball.get("homeTeam");
|
||||||
String teamNameHome = teamHome.get("team_name").toString();
|
String teamNameHome = teamHome.get("team_name").toString();
|
||||||
JSONObject teamGuest = (JSONObject) matchAPIFootball.get("awayTeam");
|
JSONObject teamGuest = (JSONObject) matchAPIFootball.get("awayTeam");
|
||||||
String teamNameGuest = teamGuest.get("team_name").toString();
|
String teamNameGuest = teamGuest.get("team_name").toString();
|
||||||
|
|
||||||
match.put("match", teamNameHome + " - " + teamNameGuest);
|
match.put("match", teamNameHome + " - " + teamNameGuest);
|
||||||
|
match.put("matchday", matchday);
|
||||||
String matchtime = matchAPIFootball.get("event_date").toString().replace("T", " ").substring(0, 16);
|
|
||||||
match.put("matchtime", matchtime);
|
match.put("matchtime", matchtime);
|
||||||
|
match.put("type", "SingleMatch");
|
||||||
Long fixtureId = (Long) matchAPIFootball.get("fixture_id");
|
match.put("matchLeague", leagueId);
|
||||||
match.put("matchId", fixtureId);
|
match.put("matchId", fixtureId);
|
||||||
|
match.put("showTable", false);
|
||||||
matches.add(match);
|
matches.add(match);
|
||||||
}
|
}
|
||||||
this.matches.put("matches", matches);
|
this.matches = matches;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JSONObject getMatches() {
|
public JSONArray getMatches() {
|
||||||
return this.matches;
|
return this.matches;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMatchesBeautful() {
|
public String getMatchesBeautiful() {
|
||||||
JsonElement jelement = JsonParser.parseString(this.matches.toString());
|
JsonElement jelement = JsonParser.parseString(this.matches.toString());
|
||||||
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||||
return gson.toJson(jelement);
|
return gson.toJson(jelement);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFilename() {
|
public String getCountry() {
|
||||||
return "Spiele " + this.country + " " + this.leagueName + ".json";
|
return country;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLeagueName() {
|
||||||
|
return leagueName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package de.jeyp91.tippligaforum;
|
||||||
|
|
||||||
|
import de.jeyp91.apifootball.APIFootballUpdater;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
public class MatchesListForumUpdater {
|
||||||
|
private HashSet<Integer> leagues;
|
||||||
|
|
||||||
|
public MatchesListForumUpdater() {
|
||||||
|
this.leagues = new APIFootballUpdater().getLeagues();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateAllLeagues() {
|
||||||
|
for(Integer league : this.leagues) {
|
||||||
|
updateLeague(league);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateLeague(int league) {
|
||||||
|
MatchesListCreator creator = new MatchesListCreator(league);
|
||||||
|
String content = creator.getMatchesBeautiful();
|
||||||
|
String contentWithCodeBBCode = "<r><CODE><s>[code]</s>" + content + "<e>[/code]</e></CODE></r>";
|
||||||
|
int postId = getPostId(creator.getCountry(), creator.getLeagueName());
|
||||||
|
TippligaSQLConnector con = TippligaSQLConnector.getInstance();
|
||||||
|
con.updatePost(postId, contentWithCodeBBCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Integer getPostId(String country, String league) {
|
||||||
|
String query = "SELECT post_id FROM phpbb_posts WHERE post_subject = '" + country + " " + league + "';";
|
||||||
|
TippligaSQLConnector con = TippligaSQLConnector.getInstance();
|
||||||
|
ResultSet rset = con.executeQuery(query);
|
||||||
|
Integer postId = null;
|
||||||
|
try {
|
||||||
|
rset.next();
|
||||||
|
postId = Integer.parseInt(rset.getString(1));
|
||||||
|
} catch (SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return postId;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package de.jeyp91.tippligaforum;
|
||||||
|
|
||||||
|
import org.json.simple.JSONObject;
|
||||||
|
import org.json.simple.parser.JSONParser;
|
||||||
|
import org.json.simple.parser.ParseException;
|
||||||
|
|
||||||
|
public class TippligaConfigProvider {
|
||||||
|
TippligaSQLConnector con;
|
||||||
|
Integer seasonForumId;
|
||||||
|
|
||||||
|
public TippligaConfigProvider(int season) {
|
||||||
|
this.con = TippligaSQLConnector.getInstance();
|
||||||
|
Integer adminForumId = con.getForumId("Admin");
|
||||||
|
Integer tippligaConfigForumId = con.getForumId("Tippliga-Config", adminForumId);
|
||||||
|
this.seasonForumId = con.getForumId(String.valueOf(season), tippligaConfigForumId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public JSONObject getTippligaConfig(String config) {
|
||||||
|
String post = this.con.getPost(config, this.seasonForumId);
|
||||||
|
int postLength = post.length();
|
||||||
|
post = post.substring(22, postLength - 25);
|
||||||
|
|
||||||
|
JSONObject tippligaConfig = null;
|
||||||
|
JSONParser jsonParser = new JSONParser();
|
||||||
|
try {
|
||||||
|
tippligaConfig = (JSONObject) jsonParser.parse(post);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return tippligaConfig;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,12 +1,16 @@
|
|||||||
package de.jeyp91.tippliga;
|
package de.jeyp91.tippligaforum;
|
||||||
|
|
||||||
import de.jeyp91.StatusHolder;
|
import de.jeyp91.StatusHolder;
|
||||||
import de.jeyp91.tippliga.TLWMatch;
|
import de.jeyp91.tippliga.TLWMatch;
|
||||||
|
import de.jeyp91.tippliga.TLWMatchday;
|
||||||
import de.jeyp91.tippliga.TLWTeam;
|
import de.jeyp91.tippliga.TLWTeam;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import javax.xml.transform.Result;
|
import javax.xml.bind.DatatypeConverter;
|
||||||
|
import java.security.MessageDigest;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.time.Instant;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.DriverManager;
|
import java.sql.DriverManager;
|
||||||
@@ -19,6 +23,7 @@ public class TippligaSQLConnector {
|
|||||||
Connection con;
|
Connection con;
|
||||||
|
|
||||||
private static final Logger logger = LogManager.getLogger(TippligaSQLConnector.class);
|
private static final Logger logger = LogManager.getLogger(TippligaSQLConnector.class);
|
||||||
|
private static TippligaSQLConnector tlwSqlCon = null;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
try {
|
try {
|
||||||
@@ -29,7 +34,7 @@ public class TippligaSQLConnector {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public TippligaSQLConnector() {
|
private TippligaSQLConnector() {
|
||||||
String jdbcUrlLocalhost = "jdbc:mysql://localhost/d0144ddb" +
|
String jdbcUrlLocalhost = "jdbc:mysql://localhost/d0144ddb" +
|
||||||
"?user=root" +
|
"?user=root" +
|
||||||
"&password=" +
|
"&password=" +
|
||||||
@@ -54,6 +59,13 @@ public class TippligaSQLConnector {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static TippligaSQLConnector getInstance() {
|
||||||
|
if(tlwSqlCon == null) {
|
||||||
|
tlwSqlCon = new TippligaSQLConnector();
|
||||||
|
}
|
||||||
|
return tlwSqlCon;
|
||||||
|
}
|
||||||
|
|
||||||
public ArrayList<TLWTeam> getTeams(String season, String league) {
|
public ArrayList<TLWTeam> getTeams(String season, String league) {
|
||||||
String queryString = "SELECT * FROM `phpbb_footb_teams` WHERE `season` = " + season + " AND `league` = " + league + ";";
|
String queryString = "SELECT * FROM `phpbb_footb_teams` WHERE `season` = " + season + " AND `league` = " + league + ";";
|
||||||
|
|
||||||
@@ -125,13 +137,46 @@ public class TippligaSQLConnector {
|
|||||||
return matchdays;
|
return matchdays;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateMatchDateTime(String season, String league, String matchNo, String datetime) {
|
public Integer getForumId(String forumName, int parentId) {
|
||||||
String queryString = "UPDATE `phpbb_footb_matches` "
|
String queryString = "SELECT forum_id FROM phpbb_forums WHERE forum_name = \"" + forumName + "\" AND parent_id = " + parentId + ";";
|
||||||
+ "SET match_datetime = " + datetime
|
ResultSet rset = executeQuery(queryString);
|
||||||
+ " WHERE `season` = " + season
|
Integer id = null;
|
||||||
+ " AND `league` = " + league
|
try {
|
||||||
+ " AND match_no = " + matchNo + ";";
|
while (rset.next()) {
|
||||||
executeQuery(queryString);
|
id = Integer.parseInt(rset.getString(1));
|
||||||
|
}
|
||||||
|
} catch (SQLException throwables) {
|
||||||
|
throwables.printStackTrace();
|
||||||
|
}
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getForumId(String forumName) {
|
||||||
|
String queryString = "SELECT forum_id FROM phpbb_forums WHERE forum_name = \"" + forumName + "\";";
|
||||||
|
ResultSet rset = executeQuery(queryString);
|
||||||
|
Integer id = null;
|
||||||
|
try {
|
||||||
|
while (rset.next()) {
|
||||||
|
id = Integer.parseInt(rset.getString(1));
|
||||||
|
}
|
||||||
|
} catch (SQLException throwables) {
|
||||||
|
throwables.printStackTrace();
|
||||||
|
}
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPost(String subject, int forum_id) {
|
||||||
|
String queryString = "SELECT post_text FROM phpbb_posts WHERE post_subject = \"" + subject + "\" AND forum_id = \"" + forum_id + "\";";
|
||||||
|
ResultSet rset = executeQuery(queryString);
|
||||||
|
String post = null;
|
||||||
|
try {
|
||||||
|
while (rset.next()) {
|
||||||
|
post = rset.getString(1);
|
||||||
|
}
|
||||||
|
} catch (SQLException throwables) {
|
||||||
|
throwables.printStackTrace();
|
||||||
|
}
|
||||||
|
return post;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResultSet executeQuery (String queryString){
|
public ResultSet executeQuery (String queryString){
|
||||||
@@ -155,4 +200,47 @@ public class TippligaSQLConnector {
|
|||||||
logger.error(e.getMessage());
|
logger.error(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updatePost(int postId, String postText) {
|
||||||
|
String postChecksum = getChecksum(postText);
|
||||||
|
final long postEditTime = Instant.now().getEpochSecond();;
|
||||||
|
final String postEditReason = "Update by tool.";
|
||||||
|
int postEditUser = 2;
|
||||||
|
String query = getPostUpdateQuery(postId, postText, postChecksum, postEditTime, postEditReason, postEditUser);
|
||||||
|
executeUpdate(query);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPostUpdateQuery(int postId, String postText, String postChecksum, long postEditTime, String postEditReason, int postEditUser) {
|
||||||
|
return "UPDATE phpbb_posts SET " +
|
||||||
|
"post_text = '" + postText + "', " +
|
||||||
|
"post_checksum = '" + postChecksum + "', " +
|
||||||
|
"post_edit_time = " + postEditTime + ", " +
|
||||||
|
"post_edit_reason = '" + postEditReason + "', " +
|
||||||
|
"post_edit_user = " + postEditUser + ", " +
|
||||||
|
"post_edit_count = post_edit_count + 1 " +
|
||||||
|
"WHERE post_id = " + postId + ";";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getChecksum(String postText) {
|
||||||
|
String postTextForMd5 = replaceXmlMetacharacters(postText);
|
||||||
|
MessageDigest md = null;
|
||||||
|
try {
|
||||||
|
md = MessageDigest.getInstance("MD5");
|
||||||
|
} catch (NoSuchAlgorithmException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
assert md != null;
|
||||||
|
md.update(postTextForMd5.getBytes());
|
||||||
|
byte[] digest = md.digest();
|
||||||
|
return DatatypeConverter.printHexBinary(digest).toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String replaceXmlMetacharacters(String post) {
|
||||||
|
post = post.replace("&", "&");
|
||||||
|
post = post.replace("<", "<");
|
||||||
|
post = post.replace(">", ">");
|
||||||
|
post = post.replace("\"", """);
|
||||||
|
post = post.replace("'", "'");
|
||||||
|
return post;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
72
src/main/resources/Tippliga/Ligen.json
Normal file
72
src/main/resources/Tippliga/Ligen.json
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"country": "Germany",
|
||||||
|
"name": "Bundesliga 1",
|
||||||
|
"league_id": 2755
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"country": "Germany",
|
||||||
|
"name": "Bundesliga 2",
|
||||||
|
"league_id": 2743
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"country": "Germany",
|
||||||
|
"name": "Liga 3",
|
||||||
|
"league_id": 2795
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"country": "Germany",
|
||||||
|
"name": "Regionalliga - SudWest",
|
||||||
|
"league_id": 2823
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"country": "Germany",
|
||||||
|
"name": "Regionalliga - Bayern",
|
||||||
|
"league_id": 1240
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"country": "Germany",
|
||||||
|
"name": "DFB Pokal",
|
||||||
|
"league_id": 2677
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"country": "Germany",
|
||||||
|
"name": "U19 Bundesliga",
|
||||||
|
"league_id": 2692
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"country": "Germany",
|
||||||
|
"name": "Women Bundesliga",
|
||||||
|
"league_id": 2681
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"country": "England",
|
||||||
|
"name": "Premier League",
|
||||||
|
"league_id": 2790
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"country": "Spain",
|
||||||
|
"name": "Primera Division",
|
||||||
|
"league_id": 2833
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"country": "Italy",
|
||||||
|
"name": "Serie A",
|
||||||
|
"league_id": 2857
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"country": "France",
|
||||||
|
"name": "Ligue 1",
|
||||||
|
"league_id": 2664
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"country": "World",
|
||||||
|
"name": "UEFA Champions League",
|
||||||
|
"league_id": 2771
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"country": "World",
|
||||||
|
"name": "UEFA Europa League",
|
||||||
|
"league_id": 2777
|
||||||
|
}
|
||||||
|
]
|
||||||
582
src/main/resources/Tippliga/Team_ID_Matcher_Config.json
Normal file
582
src/main/resources/Tippliga/Team_ID_Matcher_Config.json
Normal file
@@ -0,0 +1,582 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"teamname": "FC Bayern München",
|
||||||
|
"tippligaID": 1,
|
||||||
|
"apiFootballID": 157
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Hertha BSC Berlin",
|
||||||
|
"tippligaID": 16,
|
||||||
|
"apiFootballID": 159
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Borussia Dortmund",
|
||||||
|
"tippligaID": 12,
|
||||||
|
"apiFootballID": 165
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "FC Augsburg",
|
||||||
|
"tippligaID": 23,
|
||||||
|
"apiFootballID": 170
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Bayer Leverkusen",
|
||||||
|
"tippligaID": 14,
|
||||||
|
"apiFootballID": 168
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "FC Paderborn 07",
|
||||||
|
"tippligaID": 33,
|
||||||
|
"apiFootballID": 185
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "1. FC Köln",
|
||||||
|
"tippligaID": 24,
|
||||||
|
"apiFootballID": 192
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "1. FC Union Berlin",
|
||||||
|
"tippligaID": 66,
|
||||||
|
"apiFootballID": 182
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "1. FSV Mainz",
|
||||||
|
"tippligaID": 6,
|
||||||
|
"apiFootballID": 164
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Borussia Mönchengladbach",
|
||||||
|
"tippligaID": 2,
|
||||||
|
"apiFootballID": 163
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Eintracht Frankfurt",
|
||||||
|
"tippligaID": 13,
|
||||||
|
"apiFootballID": 169
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "FC Schalke 04",
|
||||||
|
"tippligaID": 9,
|
||||||
|
"apiFootballID": 174
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Fortuna Düsseldorf",
|
||||||
|
"tippligaID": 89,
|
||||||
|
"apiFootballID": 158
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "RB Leipzig",
|
||||||
|
"tippligaID": 110,
|
||||||
|
"apiFootballID": 173
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "SC Freiburg",
|
||||||
|
"tippligaID": 28,
|
||||||
|
"apiFootballID": 160
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "TSG 1899 Hoffenheim",
|
||||||
|
"tippligaID": 47,
|
||||||
|
"apiFootballID": 167
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Vfl Wolfsburg",
|
||||||
|
"tippligaID": 11,
|
||||||
|
"apiFootballID": 161
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Werder Bremen",
|
||||||
|
"tippligaID": 17,
|
||||||
|
"apiFootballID": 162
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "1. FC Nürnberg",
|
||||||
|
"tippligaID": 4,
|
||||||
|
"apiFootballID": 171
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Hannover 96",
|
||||||
|
"tippligaID": 15,
|
||||||
|
"apiFootballID": 166
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "VfB Stuttgart",
|
||||||
|
"tippligaID": 8,
|
||||||
|
"apiFootballID": 172
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "VfL Osnabrück",
|
||||||
|
"tippligaID": 42,
|
||||||
|
"apiFootballID": 1324
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Erzgebirge Aue",
|
||||||
|
"tippligaID": 30,
|
||||||
|
"apiFootballID": 190
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Carl Zeiss Jena",
|
||||||
|
"tippligaID": 36,
|
||||||
|
"apiFootballID": 1325
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Eintracht Braunschweig",
|
||||||
|
"tippligaID": 25,
|
||||||
|
"apiFootballID": 744
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "1. FC Kaiserslautern",
|
||||||
|
"tippligaID": 19,
|
||||||
|
"apiFootballID": 745
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "1. FC Magdeburg",
|
||||||
|
"tippligaID": 59,
|
||||||
|
"apiFootballID": 179
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Arminia Bielefeld",
|
||||||
|
"tippligaID": 18,
|
||||||
|
"apiFootballID": 188
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "FC St. Pauli",
|
||||||
|
"tippligaID": 49,
|
||||||
|
"apiFootballID": 186
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Hamburger SV",
|
||||||
|
"tippligaID": 3,
|
||||||
|
"apiFootballID": 175
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Hansa Rostock",
|
||||||
|
"tippligaID": 21,
|
||||||
|
"apiFootballID": 1321
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Holstein Kiel",
|
||||||
|
"tippligaID": 63,
|
||||||
|
"apiFootballID": 191
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Karlsruher SC",
|
||||||
|
"tippligaID": 26,
|
||||||
|
"apiFootballID": 785
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "MSV Duisburg",
|
||||||
|
"tippligaID": 31,
|
||||||
|
"apiFootballID": 187
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "SpVgg Greuther Fürth",
|
||||||
|
"tippligaID": 27,
|
||||||
|
"apiFootballID": 178
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "SpVgg Unterhaching",
|
||||||
|
"tippligaID": 29,
|
||||||
|
"apiFootballID": 1314
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Darmstadt 98",
|
||||||
|
"tippligaID": 70,
|
||||||
|
"apiFootballID": 181
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "SV Sandhausen",
|
||||||
|
"tippligaID": 53,
|
||||||
|
"apiFootballID": 189
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "TSV 1860 München",
|
||||||
|
"tippligaID": 20,
|
||||||
|
"apiFootballID": 786
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "VfL Bochum",
|
||||||
|
"tippligaID": 5,
|
||||||
|
"apiFootballID": 176
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "FC Ingolstadt 04",
|
||||||
|
"tippligaID": 72,
|
||||||
|
"apiFootballID": 184
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "SV Wehen Wiesbaden",
|
||||||
|
"tippligaID": 48,
|
||||||
|
"apiFootballID": 1319
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Dynamo Dresden",
|
||||||
|
"tippligaID": 38,
|
||||||
|
"apiFootballID": 183
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Bayern München II",
|
||||||
|
"tippligaID": 168,
|
||||||
|
"apiFootballID": 4674
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Jahn Regensburg",
|
||||||
|
"tippligaID": 43,
|
||||||
|
"apiFootballID": 177
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Preußen Münster",
|
||||||
|
"tippligaID": 81,
|
||||||
|
"apiFootballID": 1313
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "1. FC Heidenheim 1846",
|
||||||
|
"tippligaID": 85,
|
||||||
|
"apiFootballID": 180
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Chemnitzer FC",
|
||||||
|
"tippligaID": 79,
|
||||||
|
"apiFootballID": 1328
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Hallescher FC",
|
||||||
|
"tippligaID": 78,
|
||||||
|
"apiFootballID": 1316
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Würzburger Kickers",
|
||||||
|
"tippligaID": 107,
|
||||||
|
"apiFootballID": 784
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "SG Sonnenhof Großaspach",
|
||||||
|
"tippligaID": 97,
|
||||||
|
"apiFootballID": 1317
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Waldhof Mannheim",
|
||||||
|
"tippligaID": 167,
|
||||||
|
"apiFootballID": 4268
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "KFC Uerdingen 05",
|
||||||
|
"tippligaID": 119,
|
||||||
|
"apiFootballID": 1322
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "SV Meppen",
|
||||||
|
"tippligaID": 139,
|
||||||
|
"apiFootballID": 1318
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "FSV Zwickau",
|
||||||
|
"tippligaID": 146,
|
||||||
|
"apiFootballID": 1315
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Viktoria Köln",
|
||||||
|
"tippligaID": 609,
|
||||||
|
"apiFootballID": 1620
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Kickers Offenbach",
|
||||||
|
"tippligaID": 22,
|
||||||
|
"apiFootballID": 1628
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Rot-Weiss Essen",
|
||||||
|
"tippligaID": 34,
|
||||||
|
"apiFootballID": 1621
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "SV Babelsberg 03",
|
||||||
|
"tippligaID": 67,
|
||||||
|
"apiFootballID": 1622
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "FSV Frankfurt",
|
||||||
|
"tippligaID": 71,
|
||||||
|
"apiFootballID": 1332
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Sportfreunde Lotte",
|
||||||
|
"tippligaID": 95,
|
||||||
|
"apiFootballID": 1323
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "FC 08 Homburg",
|
||||||
|
"tippligaID": 84,
|
||||||
|
"apiFootballID": 1634
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "VfB Lübeck",
|
||||||
|
"tippligaID": 40,
|
||||||
|
"apiFootballID": 1625
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "FC Villingen",
|
||||||
|
"tippligaID": 69,
|
||||||
|
"apiFootballID": 1619
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "FC Astoria Walldorf",
|
||||||
|
"tippligaID": 603,
|
||||||
|
"apiFootballID": 1626
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "SV Drochtersen/Assel",
|
||||||
|
"tippligaID": 152,
|
||||||
|
"apiFootballID": 1623
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Eintracht Norderstedt",
|
||||||
|
"tippligaID": 148,
|
||||||
|
"apiFootballID": 1631
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "TSV Havelse",
|
||||||
|
"tippligaID": 65,
|
||||||
|
"apiFootballID": 9342
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "FSV Union Fürstenwalde",
|
||||||
|
"tippligaID": 176,
|
||||||
|
"apiFootballID": 9357
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "SV Todesfelde",
|
||||||
|
"tippligaID": 177,
|
||||||
|
"apiFootballID": 12880
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "FV Engers 07",
|
||||||
|
"tippligaID": 178,
|
||||||
|
"apiFootballID": 12767
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "FC Oberneuland",
|
||||||
|
"tippligaID": 74,
|
||||||
|
"apiFootballID": 4263
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "VSG Altglienicke",
|
||||||
|
"tippligaID": 179,
|
||||||
|
"apiFootballID": 9349
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "MTV Eintracht Celle",
|
||||||
|
"tippligaID": 180,
|
||||||
|
"apiFootballID": 12758
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "RSV Meinerzhagen",
|
||||||
|
"tippligaID": 181,
|
||||||
|
"apiFootballID": 12814
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "SSV Ulm 1846",
|
||||||
|
"tippligaID": 166,
|
||||||
|
"apiFootballID": 1652
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "FC Rielasingen-Arlen",
|
||||||
|
"tippligaID": 162,
|
||||||
|
"apiFootballID": 1642
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Eintracht Norderstedt",
|
||||||
|
"tippligaID": 148,
|
||||||
|
"apiFootballID": 1631
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "TSV Steinbach",
|
||||||
|
"tippligaID": 164,
|
||||||
|
"apiFootballID": 1656
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "SC Wiedenbrück",
|
||||||
|
"tippligaID": 118,
|
||||||
|
"apiFootballID": 12897
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "SV 07 Elversberg",
|
||||||
|
"tippligaID": 96,
|
||||||
|
"apiFootballID": 1660
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "1. FC Düren",
|
||||||
|
"tippligaID": 182,
|
||||||
|
"apiFootballID": 12754
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Olymp. Lyon",
|
||||||
|
"tippligaID": 505,
|
||||||
|
"apiFootballID": 80
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "AS Monaco",
|
||||||
|
"tippligaID": 160,
|
||||||
|
"apiFootballID": 91
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Manchester United",
|
||||||
|
"tippligaID": 501,
|
||||||
|
"apiFootballID": 33
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "FC Arsenal London",
|
||||||
|
"tippligaID": 522,
|
||||||
|
"apiFootballID": 42
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "1. FC Schweinfurt 05",
|
||||||
|
"tippligaID": 595,
|
||||||
|
"apiFootballID": 1635
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Real Betis Sevilla",
|
||||||
|
"tippligaID": 599,
|
||||||
|
"apiFootballID": 543
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "FC Barcelona",
|
||||||
|
"tippligaID": 504,
|
||||||
|
"apiFootballID": 529
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Celta Vigo",
|
||||||
|
"tippligaID": 611,
|
||||||
|
"apiFootballID": 538
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "CA Osasuna",
|
||||||
|
"tippligaID": 574,
|
||||||
|
"apiFootballID": 727
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Athletic Bilbao",
|
||||||
|
"tippligaID": 558,
|
||||||
|
"apiFootballID": 531
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Real Madrid",
|
||||||
|
"tippligaID": 503,
|
||||||
|
"apiFootballID": 541
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "FC Getafe",
|
||||||
|
"tippligaID": 435,
|
||||||
|
"apiFootballID": 546
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "FC Valencia",
|
||||||
|
"tippligaID": 517,
|
||||||
|
"apiFootballID": 532
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Levante UD",
|
||||||
|
"tippligaID": 570,
|
||||||
|
"apiFootballID": 539
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Real Sociedad",
|
||||||
|
"tippligaID": 573,
|
||||||
|
"apiFootballID": 548
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "FC Villarreal",
|
||||||
|
"tippligaID": 407,
|
||||||
|
"apiFootballID": 533
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Atlético Madrid",
|
||||||
|
"tippligaID": 409,
|
||||||
|
"apiFootballID": 530
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "FC Sevilla",
|
||||||
|
"tippligaID": 529,
|
||||||
|
"apiFootballID": 536
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Manchester United",
|
||||||
|
"tippligaID": 501,
|
||||||
|
"apiFootballID": 33
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "FC Southampton",
|
||||||
|
"tippligaID": 596,
|
||||||
|
"apiFootballID": 41
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "FC Fulham",
|
||||||
|
"tippligaID": 5555,
|
||||||
|
"apiFootballID": 36
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "FC Arsenal London",
|
||||||
|
"tippligaID": 522,
|
||||||
|
"apiFootballID": 42
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "FC Liverpool",
|
||||||
|
"tippligaID": 519,
|
||||||
|
"apiFootballID": 40
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Manchester City",
|
||||||
|
"tippligaID": 540,
|
||||||
|
"apiFootballID": 50
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Aston Villa",
|
||||||
|
"tippligaID": 494,
|
||||||
|
"apiFootballID": 66
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Tottenham",
|
||||||
|
"tippligaID": 432,
|
||||||
|
"apiFootballID": 47
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Everton",
|
||||||
|
"tippligaID": 405,
|
||||||
|
"apiFootballID": 45
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "West Bromwich Albion",
|
||||||
|
"tippligaID": 568,
|
||||||
|
"apiFootballID": 60
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Leicester City",
|
||||||
|
"tippligaID": 612,
|
||||||
|
"apiFootballID": 46
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "West Ham United",
|
||||||
|
"tippligaID": 567,
|
||||||
|
"apiFootballID": 48
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Newcastle United",
|
||||||
|
"tippligaID": 566,
|
||||||
|
"apiFootballID": 34
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Brighton & Hove Albion",
|
||||||
|
"tippligaID": 626,
|
||||||
|
"apiFootballID": 51
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "FC Chelsea London",
|
||||||
|
"tippligaID": 502,
|
||||||
|
"apiFootballID": 49
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"teamname": "Wolverhampton Wanderers",
|
||||||
|
"tippligaID": 562,
|
||||||
|
"apiFootballID": 39
|
||||||
|
}
|
||||||
|
]
|
||||||
1289
src/main/resources/Tippliga/Tipper_Match_Pair_Config.json
Normal file
1289
src/main/resources/Tippliga/Tipper_Match_Pair_Config.json
Normal file
File diff suppressed because it is too large
Load Diff
267
src/main/resources/Tippliga/Tipper_Team_Config.json
Normal file
267
src/main/resources/Tippliga/Tipper_Team_Config.json
Normal file
@@ -0,0 +1,267 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"team_id": 2002,
|
||||||
|
"team_name": "Julian",
|
||||||
|
"team_name_short": "Julian"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2053,
|
||||||
|
"team_name": "Demian",
|
||||||
|
"team_name_short": "Demian"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2054,
|
||||||
|
"team_name": "Hilde",
|
||||||
|
"team_name_short": "Hilde"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2055,
|
||||||
|
"team_name": "Oliver",
|
||||||
|
"team_name_short": "Oliver"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2056,
|
||||||
|
"team_name": "Martin",
|
||||||
|
"team_name_short": "Martin"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2057,
|
||||||
|
"team_name": "Matthias",
|
||||||
|
"team_name_short": "Matthias"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2058,
|
||||||
|
"team_name": "Nicole (TG Rhön)",
|
||||||
|
"team_name_short": "Nicole"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2059,
|
||||||
|
"team_name": "Sascha",
|
||||||
|
"team_name_short": "Sascha"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2060,
|
||||||
|
"team_name": "TG Nürnberg",
|
||||||
|
"team_name_short": "TG Nürnb."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2061,
|
||||||
|
"team_name": "Friedrich",
|
||||||
|
"team_name_short": "Friedrich"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2062,
|
||||||
|
"team_name": "Jimmy",
|
||||||
|
"team_name_short": "Jimmy"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2063,
|
||||||
|
"team_name": "Flo",
|
||||||
|
"team_name_short": "Flo"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2064,
|
||||||
|
"team_name": "Max",
|
||||||
|
"team_name_short": "Max"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2065,
|
||||||
|
"team_name": "Fabian",
|
||||||
|
"team_name_short": "Fabian"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2066,
|
||||||
|
"team_name": "Bastian",
|
||||||
|
"team_name_short": "Bastian"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2067,
|
||||||
|
"team_name": "Kevin",
|
||||||
|
"team_name_short": "Kevin"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2068,
|
||||||
|
"team_name": "Tristan",
|
||||||
|
"team_name_short": "Tristan"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2069,
|
||||||
|
"team_name": "Werner",
|
||||||
|
"team_name_short": "Werner"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2070,
|
||||||
|
"team_name": "Johnny",
|
||||||
|
"team_name_short": "Werner"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2071,
|
||||||
|
"team_name": "Marcel",
|
||||||
|
"team_name_short": "Marcel"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2072,
|
||||||
|
"team_name": "TG Sportbild/Fifa",
|
||||||
|
"team_name_short": "TG Sportb."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2073,
|
||||||
|
"team_name": "Marcel U.",
|
||||||
|
"team_name_short": "Marcel U."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2074,
|
||||||
|
"team_name": "Kay",
|
||||||
|
"team_name_short": "Kay"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2075,
|
||||||
|
"team_name": "Maxi H.",
|
||||||
|
"team_name_short": "Maxi H."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2076,
|
||||||
|
"team_name": "Frank",
|
||||||
|
"team_name_short": "Frank"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2077,
|
||||||
|
"team_name": "Stefanie",
|
||||||
|
"team_name_short": "Stefanie"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2078,
|
||||||
|
"team_name": "Jaron",
|
||||||
|
"team_name_short": "Jaron"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2079,
|
||||||
|
"team_name": "Jonas",
|
||||||
|
"team_name_short": "Jonas"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2082,
|
||||||
|
"team_name": "Klaus",
|
||||||
|
"team_name_short": "Klaus"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2083,
|
||||||
|
"team_name": "Eduard",
|
||||||
|
"team_name_short": "Eduard"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2084,
|
||||||
|
"team_name": "Kristina",
|
||||||
|
"team_name_short": "Kristina"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2085,
|
||||||
|
"team_name": "Andreas",
|
||||||
|
"team_name_short": "Andreas"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2086,
|
||||||
|
"team_name": "Maxi U.",
|
||||||
|
"team_name_short": "Maxi U."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2087,
|
||||||
|
"team_name": "Franz",
|
||||||
|
"team_name_short": "Franz"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2088,
|
||||||
|
"team_name": "Vincent",
|
||||||
|
"team_name_short": "Vincent"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2089,
|
||||||
|
"team_name": "Martin H.",
|
||||||
|
"team_name_short": "Martin H."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2090,
|
||||||
|
"team_name": "Dome",
|
||||||
|
"team_name_short": "Dome"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2091,
|
||||||
|
"team_name": "Dom",
|
||||||
|
"team_name_short": "Dom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2096,
|
||||||
|
"team_name": "Jan",
|
||||||
|
"team_name_short": "Jan"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2102,
|
||||||
|
"team_name": "Maxi Z.",
|
||||||
|
"team_name_short": "Maxi Z."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2103,
|
||||||
|
"team_name": "Patrick",
|
||||||
|
"team_name_short": "Patrick"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2104,
|
||||||
|
"team_name": "Jan K.",
|
||||||
|
"team_name_short": "Jan K."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2105,
|
||||||
|
"team_name": "Muck",
|
||||||
|
"team_name_short": "Muck"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2106,
|
||||||
|
"team_name": "Philipp",
|
||||||
|
"team_name_short": "Philipp"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2108,
|
||||||
|
"team_name": "Lukas",
|
||||||
|
"team_name_short": "Lukas"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2109,
|
||||||
|
"team_name": "Sandro",
|
||||||
|
"team_name_short": "Sandro"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2110,
|
||||||
|
"team_name": "Bernd",
|
||||||
|
"team_name_short": "Bernd"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2112,
|
||||||
|
"team_name": "Arno",
|
||||||
|
"team_name_short": "Arno"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2113,
|
||||||
|
"team_name": "Stefan",
|
||||||
|
"team_name_short": "Stefan"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2114,
|
||||||
|
"team_name": "Armin",
|
||||||
|
"team_name_short": "Armin"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2119,
|
||||||
|
"team_name": "Dominik",
|
||||||
|
"team_name_short": "Dominik"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2123,
|
||||||
|
"team_name": "Michael",
|
||||||
|
"team_name_short": "Michael"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"team_id": 2124,
|
||||||
|
"team_name": "Olli L.",
|
||||||
|
"team_name_short": "Olli L."
|
||||||
|
}
|
||||||
|
]
|
||||||
13
src/test/java/de/jeyp91/S3ProviderTest.java
Normal file
13
src/test/java/de/jeyp91/S3ProviderTest.java
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
package de.jeyp91;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class S3ProviderTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getFixturesFromS3Test() {
|
||||||
|
S3Provider prov = new S3Provider();
|
||||||
|
String rounds = prov.getFixturesStringFromS3(1240);
|
||||||
|
System.out.println(rounds);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package de.jeyp91;
|
package de.jeyp91;
|
||||||
import de.jeyp91.apifootball.APIFootballMatch;
|
import de.jeyp91.apifootball.APIFootballMatch;
|
||||||
|
import de.jeyp91.teamidmatcher.TeamIDMatcher;
|
||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
import org.json.simple.parser.JSONParser;
|
import org.json.simple.parser.JSONParser;
|
||||||
import org.json.simple.parser.ParseException;
|
import org.json.simple.parser.ParseException;
|
||||||
@@ -46,7 +47,7 @@ public class TeamIDMatcherTest {
|
|||||||
JSONParser jsonParser = new JSONParser();
|
JSONParser jsonParser = new JSONParser();
|
||||||
matchObject = (JSONObject) jsonParser.parse(jsonMatch);
|
matchObject = (JSONObject) jsonParser.parse(jsonMatch);
|
||||||
APIFootballMatch match = new APIFootballMatch(matchObject, 2021);
|
APIFootballMatch match = new APIFootballMatch(matchObject, 2021);
|
||||||
;
|
|
||||||
match.teamIdHome = 80;
|
match.teamIdHome = 80;
|
||||||
tlwId = TeamIDMatcher.getTippligaIdFromApiFootballId(match, TeamIDMatcher.HOME);
|
tlwId = TeamIDMatcher.getTippligaIdFromApiFootballId(match, TeamIDMatcher.HOME);
|
||||||
assertEquals(505, tlwId);
|
assertEquals(505, tlwId);
|
||||||
|
|||||||
@@ -2,25 +2,23 @@ package de.jeyp91.apifootball;
|
|||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class APIFootballUpdaterTest {
|
public class APIFootballUpdaterTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void updateFixturesTest() throws IOException {
|
public void updateFixturesTest() {
|
||||||
APIFootballUpdater updater = new APIFootballUpdater(2021);
|
APIFootballUpdater updater = new APIFootballUpdater();
|
||||||
// updater.updateFixtures(2692);
|
updater.updateFixtures(1240);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void updateAllFixturesTest() throws IOException {
|
public void updateAllFixturesTest() {
|
||||||
APIFootballUpdater updater = new APIFootballUpdater(2021);
|
APIFootballUpdater updater = new APIFootballUpdater();
|
||||||
// updater.updateAllFixtures();
|
updater.updateAllFixtures();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void updateAllRoundsTest() throws IOException {
|
public void updateAllRoundsTest() {
|
||||||
APIFootballUpdater updater = new APIFootballUpdater(2021);
|
APIFootballUpdater updater = new APIFootballUpdater();
|
||||||
// updater.updateAllRounds();
|
updater.updateAllRounds();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,55 +0,0 @@
|
|||||||
package de.jeyp91.gists;
|
|
||||||
|
|
||||||
import com.google.api.client.util.DateTime;
|
|
||||||
import de.jeyp91.apifootball.APIFootballUpdater;
|
|
||||||
import org.json.simple.JSONArray;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
|
|
||||||
public class GistProviderTest {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void listAllGistsTest() {
|
|
||||||
GistProvider prov = GistProvider.getInstance();
|
|
||||||
JSONArray gists = prov.listAllGists();
|
|
||||||
// System.out.println(gists);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void getFileTest() {
|
|
||||||
GistProvider prov = GistProvider.getInstance();
|
|
||||||
String file = prov.getFileFromGist("Team_ID_Matcher.json");
|
|
||||||
// System.out.println(file);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void getTeamIdMatcherTest() {
|
|
||||||
GistProvider prov = GistProvider.getInstance();
|
|
||||||
JSONArray matcher = prov.getTeamIdMatcher();
|
|
||||||
// System.out.println(matcher);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void getGistUpdatedTimestampTest() {
|
|
||||||
GistProvider prov = GistProvider.getInstance();
|
|
||||||
DateTime date = prov.getGistUpdatedTimestamp("Matches");
|
|
||||||
// System.out.println(date);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void getGistIDTest() {
|
|
||||||
GistProvider prov = GistProvider.getInstance();
|
|
||||||
String id = prov.getGistID("Matches");
|
|
||||||
// System.out.println(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void updateGistTest() throws UnsupportedEncodingException {
|
|
||||||
GistProvider prov = GistProvider.getInstance();
|
|
||||||
APIFootballUpdater updater = new APIFootballUpdater(2021);
|
|
||||||
// String body = updater.getRawData("https://v2.api-football.com/fixtures/league/2738?timezone=Europe/Berlin");
|
|
||||||
// String content = prov.updateGist("6ec51d59cac70c9f4c040eeea1c0cdd9", "matches_league_2738.json", body);
|
|
||||||
// System.out.println(content);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
package de.jeyp91.gists;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
|
|
||||||
public class MatchesListGistUpdaterTest {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void updateAllLeaguesTest() throws UnsupportedEncodingException {
|
|
||||||
MatchesListGistUpdater updater = new MatchesListGistUpdater();
|
|
||||||
updater.updateAllLeagues();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package de.jeyp91.gists;
|
package de.jeyp91.teamidmatcher;
|
||||||
|
|
||||||
|
import de.jeyp91.teamidmatcher.TeamIDMatcherTemplateCreator;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class TeamIDMatcherTemplateCreatorTest {
|
public class TeamIDMatcherTemplateCreatorTest {
|
||||||
@@ -6,7 +6,7 @@ public class TLWMatchdayUpdaterTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getUpdateSqlTest1() throws Exception {
|
public void getUpdateSqlTest1() throws Exception {
|
||||||
TLWMatchdaysUpdater matchdaysUpdater = new TLWMatchdaysUpdater(2021, 1, "Tippliga.json");
|
TLWMatchdaysUpdater matchdaysUpdater = new TLWMatchdaysUpdater(2021, 1, "Tippliga");
|
||||||
|
|
||||||
String sql = matchdaysUpdater.getUpdateSql();
|
String sql = matchdaysUpdater.getUpdateSql();
|
||||||
|
|
||||||
@@ -16,7 +16,7 @@ public class TLWMatchdayUpdaterTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getUpdateSqlTest2() throws Exception {
|
public void getUpdateSqlTest2() throws Exception {
|
||||||
TLWMatchdaysUpdater matchdaysUpdater = new TLWMatchdaysUpdater(2021, 2, "Tippliga.json");
|
TLWMatchdaysUpdater matchdaysUpdater = new TLWMatchdaysUpdater(2021, 2, "Tippliga");
|
||||||
|
|
||||||
String sql = matchdaysUpdater.getUpdateSql();
|
String sql = matchdaysUpdater.getUpdateSql();
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ public class TLWMatchdaysCreatorTest {
|
|||||||
@Test
|
@Test
|
||||||
public void getMatchdaysTippligaTest() throws ParseException {
|
public void getMatchdaysTippligaTest() throws ParseException {
|
||||||
|
|
||||||
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 1, "Tippliga.json");
|
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 1, "Tippliga");
|
||||||
ArrayList<TLWMatchday> matchdays = matchdaysCreator.getMatchdays();
|
ArrayList<TLWMatchday> matchdays = matchdaysCreator.getMatchdays();
|
||||||
|
|
||||||
assertEquals((Integer) 1, matchdays.get(0).getMatchday());
|
assertEquals((Integer) 1, matchdays.get(0).getMatchday());
|
||||||
@@ -20,7 +20,7 @@ public class TLWMatchdaysCreatorTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getMatchdaysWTLPokalTest() throws ParseException {
|
public void getMatchdaysWTLPokalTest() throws ParseException {
|
||||||
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 1, "WTL_Pokal.json");
|
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 1, "WTL-Pokal");
|
||||||
ArrayList<TLWMatchday> matchdays = matchdaysCreator.getMatchdays();
|
ArrayList<TLWMatchday> matchdays = matchdaysCreator.getMatchdays();
|
||||||
|
|
||||||
assertEquals((Integer) 1, matchdays.get(0).getMatchday());
|
assertEquals((Integer) 1, matchdays.get(0).getMatchday());
|
||||||
@@ -29,7 +29,7 @@ public class TLWMatchdaysCreatorTest {
|
|||||||
@Test
|
@Test
|
||||||
public void getMatchdaysTippliga1SqlTest() throws ParseException {
|
public void getMatchdaysTippliga1SqlTest() throws ParseException {
|
||||||
|
|
||||||
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 1, "Tippliga.json");
|
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 1, "Tippliga");
|
||||||
String sql = matchdaysCreator.getMatchdaysSQL();
|
String sql = matchdaysCreator.getMatchdaysSQL();
|
||||||
// System.out.println(sql);
|
// System.out.println(sql);
|
||||||
}
|
}
|
||||||
@@ -37,7 +37,7 @@ public class TLWMatchdaysCreatorTest {
|
|||||||
@Test
|
@Test
|
||||||
public void getMatchdaysTippliga2SqlTest() throws ParseException {
|
public void getMatchdaysTippliga2SqlTest() throws ParseException {
|
||||||
|
|
||||||
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 2, "Tippliga.json");
|
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 2, "Tippliga");
|
||||||
String sql = matchdaysCreator.getMatchdaysSQL();
|
String sql = matchdaysCreator.getMatchdaysSQL();
|
||||||
// System.out.println(sql);
|
// System.out.println(sql);
|
||||||
}
|
}
|
||||||
@@ -45,7 +45,7 @@ public class TLWMatchdaysCreatorTest {
|
|||||||
@Test
|
@Test
|
||||||
public void getMatchdaysTippliga51SqlTest() throws ParseException {
|
public void getMatchdaysTippliga51SqlTest() throws ParseException {
|
||||||
|
|
||||||
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 51, "Tippliga.json");
|
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 51, "Tippliga");
|
||||||
String sql = matchdaysCreator.getMatchdaysSQL();
|
String sql = matchdaysCreator.getMatchdaysSQL();
|
||||||
// System.out.println(sql);
|
// System.out.println(sql);
|
||||||
}
|
}
|
||||||
@@ -53,7 +53,7 @@ public class TLWMatchdaysCreatorTest {
|
|||||||
@Test
|
@Test
|
||||||
public void getMatchdaysTippliga52SqlTest() throws ParseException {
|
public void getMatchdaysTippliga52SqlTest() throws ParseException {
|
||||||
|
|
||||||
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 52, "Tippliga.json");
|
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 52, "Tippliga");
|
||||||
String sql = matchdaysCreator.getMatchdaysSQL();
|
String sql = matchdaysCreator.getMatchdaysSQL();
|
||||||
// System.out.println(sql);
|
// System.out.println(sql);
|
||||||
}
|
}
|
||||||
@@ -61,7 +61,7 @@ public class TLWMatchdaysCreatorTest {
|
|||||||
@Test
|
@Test
|
||||||
public void getMatchdaysWTLPokal48SqlTest() throws ParseException {
|
public void getMatchdaysWTLPokal48SqlTest() throws ParseException {
|
||||||
|
|
||||||
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 48, "WTL_Pokal.json");
|
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 48, "WTL-Pokal");
|
||||||
String sql = matchdaysCreator.getMatchdaysSQL();
|
String sql = matchdaysCreator.getMatchdaysSQL();
|
||||||
// System.out.println(sql);
|
// System.out.println(sql);
|
||||||
}
|
}
|
||||||
@@ -69,7 +69,7 @@ public class TLWMatchdaysCreatorTest {
|
|||||||
@Test
|
@Test
|
||||||
public void getMatchdaysWTLPokal98SqlTest() throws ParseException {
|
public void getMatchdaysWTLPokal98SqlTest() throws ParseException {
|
||||||
|
|
||||||
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 98, "WTL_Pokal.json");
|
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 98, "WTL-Pokal");
|
||||||
String sql = matchdaysCreator.getMatchdaysSQL();
|
String sql = matchdaysCreator.getMatchdaysSQL();
|
||||||
// System.out.println(sql);
|
// System.out.println(sql);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ public class TLWMatchesCreatorFootballTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getMatchesTest() {
|
public void getMatchesTest() {
|
||||||
TLWMatchesCreatorFootball creator = new TLWMatchesCreatorFootball(2021, 1, "WTL_Pokal.json");
|
TLWMatchesCreatorFootball creator = new TLWMatchesCreatorFootball(2021, 1, "WTL-Pokal");
|
||||||
ArrayList<TLWMatch> matches = creator.getMatches();
|
ArrayList<TLWMatch> matches = creator.getMatches();
|
||||||
|
|
||||||
assertEquals((Integer) 1, matches.get(0).getMatchNo());
|
assertEquals((Integer) 1, matches.get(0).getMatchNo());
|
||||||
@@ -20,14 +20,14 @@ public class TLWMatchesCreatorFootballTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getMatchesTippligaSqlTest() {
|
public void getMatchesTippligaSqlTest() {
|
||||||
TLWMatchesCreatorFootball creator = new TLWMatchesCreatorFootball(2021, 2, "Tippliga.json");
|
TLWMatchesCreatorFootball creator = new TLWMatchesCreatorFootball(2021, 2, "Tippliga");
|
||||||
String sql = creator.getSQLInsertString();
|
String sql = creator.getSQLInsertString();
|
||||||
// System.out.println(sql);
|
// System.out.println(sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getMatchesWTLPokalSqlTest() {
|
public void getMatchesWTLPokalSqlTest() {
|
||||||
TLWMatchesCreatorFootball creator = new TLWMatchesCreatorFootball(2021, 48, "WTL_Pokal.json");
|
TLWMatchesCreatorFootball creator = new TLWMatchesCreatorFootball(2021, 48, "WTL-Pokal");
|
||||||
String sql = creator.getSQLInsertString();
|
String sql = creator.getSQLInsertString();
|
||||||
// System.out.println(sql);
|
// System.out.println(sql);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ public class TLWMatchesCreatorTipperPokalTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getMatchesWTLPokalTest() throws ParseException {
|
public void getMatchesWTLPokalTest() throws ParseException {
|
||||||
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 48, "WTL_Pokal.json");
|
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 48, "WTL-Pokal");
|
||||||
|
|
||||||
TLWMatchesCreatorTipperPokal creator = new TLWMatchesCreatorTipperPokal(2021, 98, "WTL_Tipper.json", matchdaysCreator.getMatchdays());
|
TLWMatchesCreatorTipperPokal creator = new TLWMatchesCreatorTipperPokal(2021, 98, "WTL-Pokal Tipper", matchdaysCreator.getMatchdays());
|
||||||
|
|
||||||
String sql = creator.getSQLInsertString();
|
String sql = creator.getSQLInsertString();
|
||||||
// System.out.println(sql);
|
// System.out.println(sql);
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ public class TLWMatchesCreatorTipperTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getMatchesTippligaTest() throws ParseException {
|
public void getMatchesTippligaTest() throws ParseException {
|
||||||
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 2, "Tippliga.json");
|
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 2, "Tippliga");
|
||||||
|
|
||||||
TLWMatchesCreatorTipperLeague creator = new TLWMatchesCreatorTipperLeague(2021, 52, "2TL_Tipper.json", matchdaysCreator.getMatchdays());
|
TLWMatchesCreatorTipperLeague creator = new TLWMatchesCreatorTipperLeague(2021, 52, "2. Tippliga Tipper", matchdaysCreator.getMatchdays());
|
||||||
|
|
||||||
String sql = creator.getSQLInsertString();
|
String sql = creator.getSQLInsertString();
|
||||||
// System.out.println(sql);
|
// System.out.println(sql);
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ public class TLWMatchesUpdaterFootballTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getUpdateSqlTest1() {
|
public void getUpdateSqlTest1() {
|
||||||
TLWMatchesUpdaterFootball updater = new TLWMatchesUpdaterFootball(2021, 1, "Tippliga.json");
|
TLWMatchesUpdaterFootball updater = new TLWMatchesUpdaterFootball(2021, 1, "Tippliga");
|
||||||
String sql = updater.getUpdateSQL();
|
String sql = updater.getUpdateSQL();
|
||||||
|
|
||||||
// System.out.println(sql);
|
// System.out.println(sql);
|
||||||
@@ -15,7 +15,7 @@ public class TLWMatchesUpdaterFootballTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getUpdateSqlTest2() {
|
public void getUpdateSqlTest2() {
|
||||||
TLWMatchesUpdaterFootball updater = new TLWMatchesUpdaterFootball(2021, 2, "Tippliga.json");
|
TLWMatchesUpdaterFootball updater = new TLWMatchesUpdaterFootball(2021, 2, "Tippliga");
|
||||||
String sql = updater.getUpdateSQL();
|
String sql = updater.getUpdateSQL();
|
||||||
|
|
||||||
// System.out.println(sql);
|
// System.out.println(sql);
|
||||||
@@ -24,7 +24,7 @@ public class TLWMatchesUpdaterFootballTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getUpdateSqlTest48() {
|
public void getUpdateSqlTest48() {
|
||||||
TLWMatchesUpdaterFootball updater = new TLWMatchesUpdaterFootball(2021, 48, "WTL_Pokal.json");
|
TLWMatchesUpdaterFootball updater = new TLWMatchesUpdaterFootball(2021, 48, "WTL-Pokal");
|
||||||
String sql = updater.getUpdateSQL();
|
String sql = updater.getUpdateSQL();
|
||||||
|
|
||||||
// System.out.println(sql);
|
// System.out.println(sql);
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import static org.junit.Assert.assertEquals;
|
|||||||
public class TLWTeamsCreatorTest {
|
public class TLWTeamsCreatorTest {
|
||||||
@Test
|
@Test
|
||||||
public void getTeamsTippligaFootball1Test() {
|
public void getTeamsTippligaFootball1Test() {
|
||||||
TLWMatchesCreatorFootball matchesCreator = new TLWMatchesCreatorFootball(2021, 1, "Tippliga.json");
|
TLWMatchesCreatorFootball matchesCreator = new TLWMatchesCreatorFootball(2021, 1, "Tippliga");
|
||||||
ArrayList<TLWMatch> matches = matchesCreator.getMatches();
|
ArrayList<TLWMatch> matches = matchesCreator.getMatches();
|
||||||
|
|
||||||
TLWTeamsCreator teamCreator = new TLWTeamsCreator(2021, 1, matches);
|
TLWTeamsCreator teamCreator = new TLWTeamsCreator(2021, 1, matches);
|
||||||
@@ -20,9 +20,9 @@ public class TLWTeamsCreatorTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getTeamsTipper1TLTest() throws ParseException {
|
public void getTeamsTipper1TLTest() throws ParseException {
|
||||||
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 1, "Tippliga.json");
|
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 1, "Tippliga");
|
||||||
|
|
||||||
TLWMatchesCreatorTipperLeague creator = new TLWMatchesCreatorTipperLeague(2021, 51, "1TL_Tipper.json", matchdaysCreator.getMatchdays());
|
TLWMatchesCreatorTipperLeague creator = new TLWMatchesCreatorTipperLeague(2021, 51, "1. Tippliga Tipper", matchdaysCreator.getMatchdays());
|
||||||
|
|
||||||
ArrayList<TLWMatch> matches = creator.getMatches();
|
ArrayList<TLWMatch> matches = creator.getMatches();
|
||||||
|
|
||||||
@@ -33,9 +33,9 @@ public class TLWTeamsCreatorTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getTeamsTipper2TLTest() throws ParseException {
|
public void getTeamsTipper2TLTest() throws ParseException {
|
||||||
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 2, "Tippliga.json");
|
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 2, "Tippliga");
|
||||||
|
|
||||||
TLWMatchesCreatorTipperLeague creator = new TLWMatchesCreatorTipperLeague(2021, 52, "2TL_Tipper.json", matchdaysCreator.getMatchdays());
|
TLWMatchesCreatorTipperLeague creator = new TLWMatchesCreatorTipperLeague(2021, 52, "2. Tippliga Tipper", matchdaysCreator.getMatchdays());
|
||||||
|
|
||||||
ArrayList<TLWMatch> matches = creator.getMatches();
|
ArrayList<TLWMatch> matches = creator.getMatches();
|
||||||
|
|
||||||
@@ -46,9 +46,9 @@ public class TLWTeamsCreatorTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getTeamsTipperWTLTest() throws ParseException {
|
public void getTeamsTipperWTLTest() throws ParseException {
|
||||||
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 48, "WTL_Pokal.json");
|
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 48, "WTL-Pokal");
|
||||||
|
|
||||||
TLWMatchesCreatorTipperPokal creator = new TLWMatchesCreatorTipperPokal(2021, 98, "WTL_Tipper.json", matchdaysCreator.getMatchdays());
|
TLWMatchesCreatorTipperPokal creator = new TLWMatchesCreatorTipperPokal(2021, 98, "WTL-Pokal Tipper", matchdaysCreator.getMatchdays());
|
||||||
|
|
||||||
ArrayList<TLWMatch> matches = creator.getMatches();
|
ArrayList<TLWMatch> matches = creator.getMatches();
|
||||||
|
|
||||||
|
|||||||
@@ -6,21 +6,21 @@ public class TLWTeamsUpdaterTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getInsertSQLTest1() throws Exception {
|
public void getInsertSQLTest1() throws Exception {
|
||||||
TLWTeamsUpdater teamsUpdater = new TLWTeamsUpdater(2021, 1, "Tippliga.json");
|
TLWTeamsUpdater teamsUpdater = new TLWTeamsUpdater(2021, 1, "Tippliga");
|
||||||
String sql = teamsUpdater.getInsertSQL();
|
String sql = teamsUpdater.getInsertSQL();
|
||||||
// System.out.println(sql);
|
// System.out.println(sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getInsertSQLTest2() throws Exception {
|
public void getInsertSQLTest2() throws Exception {
|
||||||
TLWTeamsUpdater teamsUpdater = new TLWTeamsUpdater(2021, 2, "Tippliga.json");
|
TLWTeamsUpdater teamsUpdater = new TLWTeamsUpdater(2021, 2, "Tippliga");
|
||||||
String sql = teamsUpdater.getInsertSQL();
|
String sql = teamsUpdater.getInsertSQL();
|
||||||
// System.out.println(sql);
|
// System.out.println(sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getInsertSQLTest48() throws Exception {
|
public void getInsertSQLTest48() throws Exception {
|
||||||
TLWTeamsUpdater teamsUpdater = new TLWTeamsUpdater(2021, 48, "WTL_Pokal.json");
|
TLWTeamsUpdater teamsUpdater = new TLWTeamsUpdater(2021, 48, "WTL-Pokal");
|
||||||
String sql = teamsUpdater.getInsertSQL();
|
String sql = teamsUpdater.getInsertSQL();
|
||||||
// System.out.println(sql);
|
// System.out.println(sql);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package de.jeyp91.tippliga;
|
||||||
|
|
||||||
|
import de.jeyp91.tippligaforum.TippligaConfigProvider;
|
||||||
|
import org.json.simple.JSONObject;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class TippligaConfigProviderTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getTippligaConfigTest() {
|
||||||
|
TippligaConfigProvider prov = new TippligaConfigProvider(2021);
|
||||||
|
JSONObject config = prov.getTippligaConfig("Tippliga");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package de.jeyp91.tippliga;
|
package de.jeyp91.tippliga;
|
||||||
|
|
||||||
|
import de.jeyp91.tippligaforum.TippligaSQLConnector;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
@@ -9,16 +10,16 @@ import static org.junit.Assert.assertEquals;
|
|||||||
|
|
||||||
public class TippligaSQLConnectorTest {
|
public class TippligaSQLConnectorTest {
|
||||||
|
|
||||||
TippligaSQLConnector tl;
|
TippligaSQLConnector con;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setup() {
|
public void setup() {
|
||||||
tl = new TippligaSQLConnector();
|
con = TippligaSQLConnector.getInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getTeamsBySeasonAndLeagueTest() {
|
public void getTeamsBySeasonAndLeagueTest() {
|
||||||
ArrayList<TLWTeam> teams = tl.getTeams("2020", "1");
|
ArrayList<TLWTeam> teams = con.getTeams("2020", "1");
|
||||||
|
|
||||||
assertEquals(84, teams.size());
|
assertEquals(84, teams.size());
|
||||||
|
|
||||||
@@ -34,7 +35,7 @@ public class TippligaSQLConnectorTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getTeamsByIdTest() {
|
public void getTeamsByIdTest() {
|
||||||
ArrayList<TLWTeam> teams = tl.getTeams("1");
|
ArrayList<TLWTeam> teams = con.getTeams("1");
|
||||||
|
|
||||||
assertEquals(2021, teams.get(0).getSeason());
|
assertEquals(2021, teams.get(0).getSeason());
|
||||||
assertEquals(1, teams.get(0).getLeague());
|
assertEquals(1, teams.get(0).getLeague());
|
||||||
@@ -48,7 +49,7 @@ public class TippligaSQLConnectorTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getMatchesBySeasonAndLeague() {
|
public void getMatchesBySeasonAndLeague() {
|
||||||
ArrayList<TLWMatch> matches = tl.getMatches("2020", "1");
|
ArrayList<TLWMatch> matches = con.getMatches("2020", "1");
|
||||||
|
|
||||||
assertEquals(468, matches.size());
|
assertEquals(468, matches.size());
|
||||||
|
|
||||||
@@ -63,4 +64,38 @@ public class TippligaSQLConnectorTest {
|
|||||||
assertEquals((Integer) 2, matches.get(0).getGoalsHome());
|
assertEquals((Integer) 2, matches.get(0).getGoalsHome());
|
||||||
assertEquals((Integer) 1, matches.get(0).getGoalsGuest());
|
assertEquals((Integer) 1, matches.get(0).getGoalsGuest());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void replaceXmlMetacharactersTest() {
|
||||||
|
String post = "[code]\n" +
|
||||||
|
"{\"a\"}\n" +
|
||||||
|
"[/code]";
|
||||||
|
String replacement = con.replaceXmlMetacharacters(post);
|
||||||
|
System.out.println(replacement);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getChecksumTest() {
|
||||||
|
String post = "[code]\n" +
|
||||||
|
"{\"a\"}\n" +
|
||||||
|
"[/code]";
|
||||||
|
String md5 = con.getChecksum(post);
|
||||||
|
System.out.println(md5);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getPostUpdateQueryTest() {
|
||||||
|
int postId = 582;
|
||||||
|
String postText = "[code]\n" +
|
||||||
|
"{\"a\"}\n" +
|
||||||
|
"[/code]";
|
||||||
|
String postTextClean = con.replaceXmlMetacharacters(postText);
|
||||||
|
String postChecksum = con.getChecksum(postText);
|
||||||
|
long postEditTime = 1604691314;
|
||||||
|
String postEditReason = "Update by tool.";
|
||||||
|
int postEditUser = 2;
|
||||||
|
|
||||||
|
String query = con.getPostUpdateQuery(postId, postTextClean, postChecksum, postEditTime, postEditReason, postEditUser);
|
||||||
|
System.out.println(query);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package de.jeyp91.gists;
|
package de.jeyp91.tippligaforum;
|
||||||
|
|
||||||
|
import de.jeyp91.tippligaforum.MatchesListCreator;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class MatchesListCreatorTest {
|
public class MatchesListCreatorTest {
|
||||||
@@ -7,35 +8,35 @@ public class MatchesListCreatorTest {
|
|||||||
@Test
|
@Test
|
||||||
public void getMatchesTest2664() {
|
public void getMatchesTest2664() {
|
||||||
MatchesListCreator creator = new MatchesListCreator(2664);
|
MatchesListCreator creator = new MatchesListCreator(2664);
|
||||||
String matches = creator.getMatchesBeautful();
|
String matches = creator.getMatchesBeautiful();
|
||||||
// System.out.println(matches);
|
System.out.println(matches);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getMatchesTest2743() {
|
public void getMatchesTest2743() {
|
||||||
MatchesListCreator creator = new MatchesListCreator(2743);
|
MatchesListCreator creator = new MatchesListCreator(2743);
|
||||||
String matches = creator.getMatchesBeautful();
|
String matches = creator.getMatchesBeautiful();
|
||||||
// System.out.println(matches);
|
// System.out.println(matches);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getMatchesTest2755() {
|
public void getMatchesTest2755() {
|
||||||
MatchesListCreator creator = new MatchesListCreator(2755);
|
MatchesListCreator creator = new MatchesListCreator(2755);
|
||||||
String matches = creator.getMatchesBeautful();
|
String matches = creator.getMatchesBeautiful();
|
||||||
// System.out.println(matches);
|
// System.out.println(matches);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getMatchesTest2790() {
|
public void getMatchesTest2790() {
|
||||||
MatchesListCreator creator = new MatchesListCreator(2790);
|
MatchesListCreator creator = new MatchesListCreator(2790);
|
||||||
String matches = creator.getMatchesBeautful();
|
String matches = creator.getMatchesBeautiful();
|
||||||
// System.out.println(matches);
|
// System.out.println(matches);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getMatchesTest2795() {
|
public void getMatchesTest2795() {
|
||||||
MatchesListCreator creator = new MatchesListCreator(2795);
|
MatchesListCreator creator = new MatchesListCreator(2795);
|
||||||
String matches = creator.getMatchesBeautful();
|
String matches = creator.getMatchesBeautiful();
|
||||||
// System.out.println(matches);
|
// System.out.println(matches);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package de.jeyp91.tippligaforum;
|
||||||
|
|
||||||
|
import de.jeyp91.tippligaforum.MatchesListForumUpdater;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
|
||||||
|
public class MatchesListForumUpdaterTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void updateAllLeaguesTest() {
|
||||||
|
MatchesListForumUpdater updater = new MatchesListForumUpdater();
|
||||||
|
updater.updateAllLeagues();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void updateLeagueTest() {
|
||||||
|
MatchesListForumUpdater updater = new MatchesListForumUpdater();
|
||||||
|
updater.updateLeague(2755);
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
Reference in New Issue
Block a user