First version with ability to create database for new season

This commit is contained in:
2020-09-27 19:05:20 +02:00
parent b97e15be7d
commit 283efc775b
75 changed files with 106536 additions and 0 deletions

44
.classpath Normal file
View File

@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="target/generated-sources/annotations">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

23
.project Normal file
View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>tlw-database-tool</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

29
build.gradle Normal file
View File

@@ -0,0 +1,29 @@
/*
* This file was generated by the Gradle 'init' task.
*/
apply plugin: 'java'
apply plugin: 'application'
mainClassName = 'App'
sourceCompatibility = 1.8
targetCompatibility = 1.8
version = '1.0'
compileJava.options.encoding = 'UTF-8'
compileTestJava.options.encoding = "UTF-8"
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
implementation 'mysql:mysql-connector-java:8.0.17'
implementation 'org.apache.httpcomponents:httpclient:4.5.9'
implementation 'com.googlecode.json-simple:json-simple:1.1.1'
testImplementation 'junit:junit:4.11'
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.apis:google-api-services-calendar:v3-rev305-1.23.0'
compile 'com.google.guava:guava:29.0-jre'
}

185
gradlew vendored Normal file
View File

@@ -0,0 +1,185 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
exec "$JAVACMD" "$@"

104
gradlew.bat vendored Normal file
View File

@@ -0,0 +1,104 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

5
settings.gradle Normal file
View File

@@ -0,0 +1,5 @@
/*
* This file was generated by the Gradle 'init' task.
*/
rootProject.name = 'tlw-database-tool'

View File

@@ -0,0 +1,57 @@
package de.jeyp91;
import de.jeyp91.tippliga.*;
/**
* Hello world!
*
*/
public class App {
public static void main(String[] args) throws Exception {
//getMatchesFromDatabase();
//updateMatchesFromOpenLigaDB();
//con.close();
System.out.println("done");
}
/*
public static void getMatchesFromDatabase() throws SQLException {
String queryString = "SELECT * FROM `phpbb_footb_matches` WHERE season = 2019 AND league = 1";
Statement stmt = con.createStatement();
ResultSet rset = stmt.executeQuery(queryString);
ArrayList<Match> matches = new ArrayList<Match>();
while (rset.next()) {
matches.add(new Match(rset));
}
}
*/
/*
public static void updateMatchesFromOpenLigaDB() throws Exception {
String queryString = "SELECT * FROM `phpbb_footb_matches` WHERE season = 2018 AND league = 48";
Statement stmt = con.createStatement();
ResultSet rset = stmt.executeQuery(queryString);
ArrayList<Match> matchesTLW = new ArrayList<Match>();
while (rset.next()) {
matchesTLW.add(new Match(rset));
}
// Download data from OpenLigaDB
JSONArray matchDBJson = new JSONArray();
OpenLigaDB openLigaDB = new OpenLigaDB();
for (int i = 1; i <= 6; i++) {
// matchDBJson.put(OpenLigaDB.downloadMatchday(2020, "bl1", i));
// matchDBJson.put(OpenLigaDB.downloadMatchday(2020, "bl2", i));
// matchDBJson.put(OpenLigaDB.downloadMatchday(2020, "bl3", i));
matchDBJson.add(openLigaDB.getMatchesOfMatchdayAsJSONArray(2018, "dfb", i));
}
for (Match match : matchesTLW) {
match.updateDataFromOpenLigaDb(matchDBJson);
}
}*/
}

View File

@@ -0,0 +1,40 @@
package de.jeyp91;
public abstract class BaseMatch {
public final Integer COMPARISON_IDENTICAL = 0;
public final Integer COMPARISON_DIFFERENT = 1;
public final Integer COMPARISON_DIFFERENT_DATETIME = 2;
public final Integer COMPARISON_DIFFERENT_RESULT = 3;
protected Integer teamIdHome;
protected Integer teamIdGuest;
protected Integer goalsHome = null;
protected Integer goalsGuest = null;
protected Integer matchday = null;
protected String matchDatetime = null;
public Integer getMatchday() {
return this.matchday;
}
public Integer getTeamIdHome() {
return this.teamIdHome;
}
public Integer getTeamIdGuest() {
return this.teamIdGuest;
}
public String getMatchDateTime() {
return this.matchDatetime;
}
public Integer getGoalsHome() {
return this.goalsHome;
}
public Integer getGoalsGuest() {
return this.goalsGuest;
}
}

View File

@@ -0,0 +1,96 @@
package de.jeyp91;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
public class MatchUtils {
/*
public void updateDataFromOpenLigaDb(JSONArray openLigaDbData) throws Exception {
loopOverAllMatchdays:
for(int i = 0; i < openLigaDbData.size(); i++) {
for(int j = 0; j < ((JSONArray)(openLigaDbData.get(i))).size(); j++) {
Match tempMatch = new Match(this.season, this.league, this.matchday, this.matchNo, (JSONObject)(((JSONArray)openLigaDbData.get(i)).get(j)));
if(isSameMatch(tempMatch)) {
break loopOverAllMatchdays;
}
updateDateTime(tempMatch);
updateResult(tempMatch);
}
}
}
public boolean updateDateTime(Match compareMatch) {
if(!this.getSeason().equals(compareMatch.getSeason())) {
return false;
}
if(!this.getLeague().equals(compareMatch.getLeague())) {
return false;
}
if(!this.getMatchday().equals(compareMatch.getMatchday())) {
return false;
}
if(this.getTeamIdHome() == null || compareMatch.getTeamIdHome() == null
|| (this.getTeamIdHome() != compareMatch.getTeamIdHome())) {
return false;
}
if(this.getTeamIdGuest() == null || compareMatch.getTeamIdGuest() == null
|| (this.getTeamIdGuest() != compareMatch.getTeamIdGuest())) {
return false;
}
String thisDateTime = this.getMatchDateTime().replace("T", " ");
String tempDateTime = compareMatch.getMatchDateTime().replace("T", " ");
if(!tempDateTime.equals(thisDateTime)) {
// System.out.println(String.valueOf(this.matchNo) + ":");
// System.out.println("Old date: " + thisDateTime + "; New date: " + tempDateTime);
// System.out.println();
// String updateQuery = "UPDATE phpbb_footb_matches SET match_datetime = '" + tempDateTime + "' WHERE season = " + this.season + " AND league = " + this.league + " AND match_no = " + this.matchNo + " AND team_id_home = " + this.teamIdHome + " AND team_id_guest = " + this.teamIdGuest + " AND match_datetime = '" + this.matchDatetime + "';";
// System.out.println(updateQuery);
}
return true;
}
public boolean updateResult(Match compareMatch) {
if(!this.getSeason().equals(compareMatch.getSeason())) {
return false;
}
if(!this.getLeague().equals(compareMatch.getLeague())) {
return false;
}
if(!this.getMatchday().equals(compareMatch.getMatchday())) {
return false;
}
if(this.getTeamIdHome() == null || compareMatch.getTeamIdHome() == null
|| (this.getTeamIdHome() != compareMatch.getTeamIdHome())) {
return false;
}
if(this.getTeamIdGuest() == null || compareMatch.getTeamIdGuest() == null
|| (this.getTeamIdGuest() != compareMatch.getTeamIdGuest())) {
return false;
}
String thisDateTime = this.getMatchDateTime().replace("T", " ");
String tempDateTime = compareMatch.getMatchDateTime().replace("T", " ");
if(!tempDateTime.equals(thisDateTime)) {
return false;
}
if(this.goalsHome != compareMatch.goalsHome ||
this.goalsGuest != compareMatch.goalsGuest &&
this.goalsHome != null && this.goalsGuest != null && compareMatch.goalsHome != null && compareMatch.goalsGuest != null) {
String oldResult = String.valueOf(this.goalsHome) + " : " + String.valueOf(this.goalsGuest);
String newResult = String.valueOf(compareMatch.goalsHome) + " : " + String.valueOf(compareMatch.goalsGuest);
System.out.println(String.valueOf(this.matchNo) + ":");
System.out.println(this.matchDatetime + " Old result: " + oldResult + "; New result: " + newResult);
System.out.println();
}
return true;
}
*/
}

View File

@@ -0,0 +1,65 @@
package de.jeyp91;
import java.io.IOException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import com.google.common.collect.HashBiMap;
import com.google.common.io.Resources;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
public class TeamIDMatcher {
private static HashBiMap<Integer, Integer> ids = null;
private static void initBiMap() {
ids = HashBiMap.create();
JSONArray teams = null;
URL url = Resources.getResource("Team_ID_TLW_APIF_config.json");
String jsonConfig = null;
try {
JSONParser jsonParser = new JSONParser();
jsonConfig = Resources.toString(url, StandardCharsets.UTF_8);
teams = (JSONArray) jsonParser.parse(jsonConfig);
} catch (IOException | ParseException e) {
e.printStackTrace();
}
for(Object team:teams) {
int tippligaID = ((Long)((JSONObject) team).get("tippligaID")).intValue();
int openligaDBID = ((Long) ((JSONObject) team).get("apiFootballID")).intValue();
ids.put(tippligaID, openligaDBID);
}
}
public static Integer getOpenLigaDbIdFromTippligaId(int id) {
if(ids == null) {
initBiMap();
}
if(ids.containsKey(id)) {
return ids.get(id);
} else {
// System.out.println("ID: " + String.valueOf(id) + " not in ID Matcher.");
System.out.println(String.valueOf(id));
return null;
}
}
public static Integer getTippligaIdFromOpenLigaDbId(Integer id) {
if(id == null) return null;
if(ids == null) {
initBiMap();
}
if(ids.inverse().containsKey(id)) {
return ids.inverse().get(id);
} else {
System.out.println("ID: " + String.valueOf(id) + " not in ID Matcher.");
return null;
}
}
}

View File

@@ -0,0 +1,70 @@
package de.jeyp91;
import java.util.ArrayList;
import de.jeyp91.tippliga.*;
/**
*
*/
public class TeamValidator {
private final int INCONSISTENT_TEAM_ID = 0;
private final int INCONSISTENT_TEAM_NAME = 1;
private final int INCONSISTENT_TEAM_NAME_SHORT = 2;
private final int INCONSISTENT_TEAM_SYMBOL = 3;
private ArrayList<TLWTeam> teams;
public TeamValidator(ArrayList<TLWTeam> teams) {
this.teams = teams;
}
public void validate() {
ArrayList<TLWTeam> tempTeams = teams;
while(tempTeams.size() > 0) {
TLWTeam referenceTeam = tempTeams.get(0);
tempTeams.remove(0);
ArrayList<TLWTeam> finishedTeams = new ArrayList<TLWTeam>();
for (TLWTeam team : tempTeams) {
if(referenceTeam.getTeamSymbol().equals(team.getTeamSymbol()) && !referenceTeam.getTeamSymbol().equals("blank.gif")) {
finishedTeams.add(team);
compareTeams(referenceTeam, team);
}
}
for (TLWTeam team : finishedTeams) {
tempTeams.remove(team);
}
}
System.out.println("done");
}
private int compareTeams(TLWTeam team1, TLWTeam team2) {
if(team1.getTeamId() != team2.getTeamId()) {
// System.out.println("Team ID wrong" + team1.getTeamId() + " " + team2.getTeamId());
String update = "UPDATE phpbb_footb_teams SET team_id = " + String.valueOf(team1.getTeamId()) + " WHERE team_name = '" + team1.getTeamName() + "' AND team_name_short = '" + team1.getTeamNameShort() + "' AND team_symbol = '" + team1.getTeamSymbol() + "';";
System.out.println(update);
return INCONSISTENT_TEAM_ID;
}
if(!team1.getTeamName().equals(team2.getTeamName())) {
// System.out.println("Team Name wrong: " + team1.getTeamName() + " " + team2.getTeamName());
String update = "UPDATE phpbb_footb_teams SET team_name = '" + team1.getTeamName() + "' WHERE team_id = " + String.valueOf(team1.getTeamId()) + " AND team_name_short = '" + team1.getTeamNameShort() + "' AND team_symbol = '" + team1.getTeamSymbol() + "';";
System.out.println(update);
return INCONSISTENT_TEAM_NAME;
}
if(!team1.getTeamNameShort().equals(team2.getTeamNameShort())) {
// System.out.println("Team Name Short wrong: " + team1.getTeamNameShort() + " " + team2.getTeamNameShort());
String update = "UPDATE phpbb_footb_teams SET team_name_short = '" + team1.getTeamNameShort() + "' WHERE team_id = " + String.valueOf(team1.getTeamId()) + " AND team_name = '" + team1.getTeamName() + "' AND team_symbol = '" + team1.getTeamSymbol() + "';";
System.out.println(update);
return INCONSISTENT_TEAM_NAME_SHORT;
}
if(!team1.getTeamSymbol().equals(team2.getTeamSymbol())) {
// System.out.println("Team Symbol wrong: " + team1.getTeamSymbol() + " " + team2.getTeamSymbol());
String update = "UPDATE phpbb_footb_teams SET team_symbol = '" + team1.getTeamSymbol() + "' WHERE team_id = " + String.valueOf(team1.getTeamId()) + " AND team_name = '" + team1.getTeamName() + "' AND team_name_short = '" + team1.getTeamNameShort() + "';";
System.out.println(update);
return INCONSISTENT_TEAM_SYMBOL;
}
return 0;
}
}

View File

@@ -0,0 +1,170 @@
package de.jeyp91.apifootball;
import com.google.common.io.Resources;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
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.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
/**
*
*/
public class APIFootballConnector {
private final String API_FOOTBALL_URL = "https://v2.api-football.com/";
private int season;
public APIFootballConnector(int season) {
this.season = season;
}
public APIFootballMatch getMatchDataByLeagueAndMatchID(int league, int id) {
APIFootballMatch matchWithID = null;
ArrayList<APIFootballMatch> allMatches = getMatchesFromLeagueFromFile(league);
for (APIFootballMatch singleMatch : allMatches) {
if (singleMatch.getAPIFootBallMatchID() == id) {
matchWithID = singleMatch;
break;
}
}
return matchWithID;
}
public ArrayList<APIFootballMatch> getMatchDataByLeagueAndMatchday(int league, int matchday) {
ArrayList<APIFootballMatch> matchesOfMatchday = new ArrayList<>();
ArrayList<APIFootballMatch> allMatches = getMatchesFromLeagueFromFile(league);
for (APIFootballMatch singleMatch : allMatches) {
if (singleMatch.getMatchday() == matchday) {
matchesOfMatchday.add(singleMatch);
}
}
return matchesOfMatchday;
}
private ArrayList<APIFootballMatch> getMatchesFromLeagueFromFile(int id) {
ArrayList<APIFootballMatch> matchesList = new ArrayList<>();
JSONObject matches = readFromFile("matches_league_" + id);
JSONArray matchArray = (JSONArray) (((JSONObject)matches.get("api")).get("fixtures"));
for(int i = 0; i < matchArray.size(); i++) {
matchesList.add(new APIFootballMatch((JSONObject) matchArray.get(i), this.season));
}
return matchesList;
}
private JSONObject readFromFile(String filename) {
JSONObject object = null;
//JSON parser object to parse read file
JSONParser jsonParser = new JSONParser();
URL url = Resources.getResource((this.season + 1) + "\\API-Football\\" + filename + ".json");
String jsonConfig = null;
try {
jsonConfig = Resources.toString(url, StandardCharsets.UTF_8);
//Read JSON file
object = (JSONObject) jsonParser.parse(jsonConfig);
} catch (IOException | ParseException e) {
e.printStackTrace();
}
return object;
}
private JSONArray getDataAsJSONArray(String requestUrl) {
String rawData = getRawData(requestUrl);
JSONParser parser = new JSONParser();
JSONArray data = null;
try {
data = (JSONArray) parser.parse(rawData);
} catch (ParseException e) {
/* TODO */
e.printStackTrace();
}
return data;
}
private JSONObject getDataAsJSONObject(String requestUrl) {
String rawData = getRawData(requestUrl);
JSONParser parser = new JSONParser();
JSONObject data = null;
try {
data = (JSONObject) parser.parse(rawData);
} catch (ParseException e) {
/* TODO */
e.printStackTrace();
}
return data;
}
String getRawData(String requestUrl) {
HttpClient client = HttpClientBuilder.create().build();
HttpGet request = new HttpGet(requestUrl);
// add request header
request.addHeader("Content-Type", "application/json");
HttpResponse response = null;
try {
response = client.execute(request);
} catch (ClientProtocolException e) {
/* TODO */
e.printStackTrace();
} catch (IOException e) {
/* TODO */
e.printStackTrace();
}
BufferedReader rd = null;
try {
rd = new BufferedReader(
new InputStreamReader(response.getEntity().getContent())
);
} 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();
}
}

View File

@@ -0,0 +1,76 @@
package de.jeyp91.apifootball;
import com.google.common.io.Resources;
import de.jeyp91.BaseMatch;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import java.io.IOException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
public class APIFootballMatch extends BaseMatch {
private int season;
private int matchId;
private int leagueId;
private String matchStatus;
public APIFootballMatch(JSONObject json, int season) {
this.season = season;
this.matchId = Integer.parseInt(json.get("fixture_id").toString());
// TODO
this.leagueId = Integer.parseInt(json.get("league_id").toString());
this.teamIdHome = Integer.parseInt(((JSONObject) json.get("homeTeam")).get("team_id").toString());
this.teamIdGuest = Integer.parseInt(((JSONObject) json.get("awayTeam")).get("team_id").toString());
this.goalsHome = getNumberOrNull(json.get("goalsHomeTeam"));
this.goalsGuest = getNumberOrNull(json.get("goalsAwayTeam"));
this.matchday = getMatchdayFromRoundString(json.get("round").toString(), this.leagueId);
this.matchStatus = json.get("statusShort").toString();
this.matchDatetime = (String) json.get("event_date");
}
public int getAPIFootBallMatchID() {
return this.matchId;
}
private int getMatchdayFromRoundString(String round, int leagueId) {
round = round.replace(" ", "_");
Integer matchday = null;
JSONObject roundsObject = readFromFile("rounds_" + leagueId + ".json");
JSONArray roundsArray = (JSONArray)(((JSONObject) roundsObject.get("api")).get("fixtures"));
for (int i = 0; i < roundsArray.size(); i++) {
if(roundsArray.get(i).toString().equals(round)) {
matchday = i + 1;
break;
}
}
return matchday;
}
private JSONObject readFromFile(String filename) {
JSONObject object = null;
//JSON parser object to parse read file
JSONParser jsonParser = new JSONParser();
URL url = Resources.getResource((this.season + 1) + "\\API-Football\\" + filename);
String jsonConfig = null;
try {
jsonConfig = Resources.toString(url, StandardCharsets.UTF_8);
//Read JSON file
object = (JSONObject) jsonParser.parse(jsonConfig);
} catch (IOException | ParseException e) {
e.printStackTrace();
}
return object;
}
private Integer getNumberOrNull(Object object) {
return object != null ? Integer.parseInt(object.toString()) : null;
}
}

View File

@@ -0,0 +1,53 @@
package de.jeyp91.googlecalendar;
import com.google.common.io.Resources;
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 CalendarConfigProvider {
private static JSONObject googleCalendarConfig = null;
private static JSONObject getGoogleCalendarConfig() {
if(googleCalendarConfig == null) {
//JSON parser object to parse read file
JSONParser jsonParser = new JSONParser();
URL url = Resources.getResource("Google_Calendar_Config.json");
String jsonConfig = null;
try {
jsonConfig = Resources.toString(url, StandardCharsets.UTF_8);
//Read JSON file
googleCalendarConfig = (JSONObject) jsonParser.parse(jsonConfig);
} catch (IOException | ParseException e) {
e.printStackTrace();
}
}
return googleCalendarConfig;
}
public static String getCalendarUrl(int league) {
// Overwrite league from 2 to 1 because they share one calendar
league = league == 2 ? 1 : league;
JSONObject leagueConfig = (JSONObject) getGoogleCalendarConfig().get(String.valueOf(league));
return (String) leagueConfig.get("url");
}
public static String getCalendarId(int league) {
// Overwrite league from 2 to 1 because they share one calendar
league = league == 2 ? 1 : league;
JSONObject leagueConfig = (JSONObject) getGoogleCalendarConfig().get(String.valueOf(league));
return (String) leagueConfig.get("id");
}
}

View File

@@ -0,0 +1,104 @@
/*
* Copyright (c) 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package de.jeyp91.googlecalendar;
import com.google.api.client.googleapis.json.GoogleJsonResponseException;
import com.google.api.client.http.HttpHeaders;
import com.google.api.services.calendar.Calendar;
import com.google.api.services.calendar.CalendarScopes;
import com.google.api.services.calendar.model.Event;
import com.google.common.collect.Lists;
import java.io.IOException;
import java.util.List;
/**
* A sample that demonstrates how to update a
* <a href="https://developers.google.com/google-apps/calendar/v3/reference/">Calendar resource</a>
* safely, ensuring that other changes aren't overwritten. It does this by passing along the etag of
* the resource being updated in the "If-Match" HTTP header of the request, which will cause the
* request to fail if the version on the server is different.
*
* @author ekoleda+devrel@google.com (Eric Koleda)
*/
public class ConditionalModificationSample {
/** The maximum number of times to attempt to update the event, before aborting. */
private static final int MAX_UPDATE_ATTEMPTS = 5;
/** Global instance of the Calendar client. */
private static Calendar client;
public static void main(String[] args) {
try {
List<String> scopes = Lists.newArrayList(CalendarScopes.CALENDAR);
client = Utils.createCalendarClient(scopes);
run();
} catch (Throwable t) {
t.printStackTrace();
System.exit(1);
}
}
/**
* Creates a test event, pauses while the user modifies the event in the Calendar UI, and then
* updates the event with a new location, ensure that the user's changes aren't overwritten.
*/
private static void run() throws IOException {
// Create a test event.
Event event = Utils.createTestEvent(client, "Test Event");
System.out.println(String.format("Event created: %s", event.getHtmlLink()));
// Pause while the user modifies the event in the Calendar UI.
System.out.println("Modify the event's description and hit enter to continue.");
System.in.read();
// Modify the local copy of the event.
event.setSummary("Updated Test Event");
// Update the event, making sure that we don't overwrite other changes.
int numAttempts = 0;
boolean isUpdated = false;
do {
Calendar.Events.Update request = client.events().update("primary", event.getId(), event);
request.setRequestHeaders(new HttpHeaders().setIfMatch(event.getEtag()));
try {
event = request.execute();
isUpdated = true;
} catch (GoogleJsonResponseException e) {
if (e.getStatusCode() == 412) {
// A 412 status code, "Precondition failed", indicates that the etag values didn't
// match, and the event was updated on the server since we last retrieved it. Use
// {@link Calendar.Events.Get} to retrieve the latest version.
Event latestEvent = client.events().get("primary", event.getId()).execute();
// You may want to have more complex logic here to resolve conflicts. In this sample we're
// simply overwriting the summary.
latestEvent.setSummary(event.getSummary());
event = latestEvent;
} else {
throw e;
}
}
numAttempts++;
} while (!isUpdated && numAttempts <= MAX_UPDATE_ATTEMPTS);
if (isUpdated) {
System.out.println("Event updated.");
} else {
System.out.println(String.format("Failed to update event after %d attempts.", numAttempts));
}
}
}

View File

@@ -0,0 +1,81 @@
/*
* Copyright (c) 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package de.jeyp91.googlecalendar;
import com.google.api.client.googleapis.json.GoogleJsonResponseException;
import com.google.api.client.http.HttpHeaders;
import com.google.api.services.calendar.Calendar;
import com.google.api.services.calendar.CalendarScopes;
import com.google.api.services.calendar.model.Event;
import com.google.common.collect.Lists;
import java.io.IOException;
import java.util.List;
/**
* A sample that demonstrates how to determine if a
* <a href="https://developers.google.com/google-apps/calendar/v3/reference/">Calendar resource</a>
* has been modified since you last retrieved it. It does this by passing along the etag of the
* resource being retrieved in the "If-None-Match" HTTP header of the request, which will cause the
* request to fail if the version on the server is the same as the local version.
*
* @author ekoleda+devrel@google.com (Eric Koleda)
*/
public class ConditionalRetrievalSample {
/** Global instance of the Calendar client. */
private static Calendar client;
public static void main(String[] args) {
try {
List<String> scopes = Lists.newArrayList(CalendarScopes.CALENDAR);
client = Utils.createCalendarClient(scopes);
run();
} catch (Throwable t) {
t.printStackTrace();
System.exit(1);
}
}
/**
* Creates a test event, pauses while the user modifies the event in the Calendar UI, and then
* checks if the event has been modified.
*/
private static void run() throws IOException {
// Create a test event.
Event event = Utils.createTestEvent(client, "Test Event");
System.out.println(String.format("Event created: %s", event.getHtmlLink()));
// Pause while the user modifies the event in the Calendar UI.
System.out.println("Modify the event's description and hit enter to continue.");
System.in.read();
// Fetch the event again if it's been modified.
Calendar.Events.Get getRequest = client.events().get("primary", event.getId());
getRequest.setRequestHeaders(new HttpHeaders().setIfNoneMatch(event.getEtag()));
try {
event = getRequest.execute();
System.out.println("The event was modified, retrieved latest version.");
} catch (GoogleJsonResponseException e) {
if (e.getStatusCode() == 304) {
// A 304 status code, "Not modified", indicates that the etags match, and the event has
// not been modified since we last retrieved it.
System.out.println("The event was not modified, using local version.");
} else {
throw e;
}
}
}
}

View File

@@ -0,0 +1,156 @@
package de.jeyp91.googlecalendar;
import com.google.api.client.auth.oauth2.Credential;
import com.google.api.client.extensions.java6.auth.oauth2.AuthorizationCodeInstalledApp;
import com.google.api.client.extensions.jetty.auth.oauth2.LocalServerReceiver;
import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow;
import com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets;
import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
import com.google.api.client.http.javanet.NetHttpTransport;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.client.util.DateTime;
import com.google.api.client.util.store.FileDataStoreFactory;
import com.google.api.services.calendar.CalendarScopes;
import com.google.api.services.calendar.Calendar;
import com.google.api.services.calendar.model.Event;
import com.google.api.services.calendar.model.EventDateTime;
import com.google.api.services.calendar.model.EventReminder;
import com.google.api.services.calendar.model.Events;
import de.jeyp91.tippliga.TLWLeague;
import de.jeyp91.tippliga.TLWMatchday;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.security.GeneralSecurityException;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class GoogleCalendarConnector {
private static final String APPLICATION_NAME = "Google Calendar API Java Quickstart";
private static final JsonFactory JSON_FACTORY = JacksonFactory.getDefaultInstance();
private static final String TOKENS_DIRECTORY_PATH = "tokens";
/**
* Global instance of the scopes required by this quickstart.
* If modifying these scopes, delete your previously saved tokens/ folder.
*/
private static final List<String> SCOPES = Collections.singletonList(CalendarScopes.CALENDAR_READONLY);
private static final String CREDENTIALS_FILE_PATH = "/Google_Credentials.json";
/**
* Creates an authorized Credential object.
* @param HTTP_TRANSPORT The network HTTP Transport.
* @return An authorized Credential object.
* @throws IOException If the Google_Credentials.json file cannot be found.
*/
private static Credential getCredentials(final NetHttpTransport HTTP_TRANSPORT) throws IOException {
// Load client secrets.
InputStream in = GoogleCalendarConnector.class.getResourceAsStream(CREDENTIALS_FILE_PATH);
if (in == null) {
throw new FileNotFoundException("Resource not found: " + CREDENTIALS_FILE_PATH);
}
GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(JSON_FACTORY, new InputStreamReader(in));
// Build flow and trigger user authorization request.
GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(
HTTP_TRANSPORT, JSON_FACTORY, clientSecrets, SCOPES)
.setDataStoreFactory(new FileDataStoreFactory(new java.io.File(TOKENS_DIRECTORY_PATH)))
.setAccessType("offline")
.build();
LocalServerReceiver receiver = new LocalServerReceiver.Builder().setPort(8888).build();
return new AuthorizationCodeInstalledApp(flow, receiver).authorize("user");
}
private static com.google.api.services.calendar.Calendar getSerivce() {
com.google.api.services.calendar.Calendar service = null;
final NetHttpTransport HTTP_TRANSPORT;
try {
HTTP_TRANSPORT = GoogleNetHttpTransport.newTrustedTransport();
service = new com.google.api.services.calendar.Calendar.Builder(HTTP_TRANSPORT, JSON_FACTORY, getCredentials(HTTP_TRANSPORT))
.setApplicationName(APPLICATION_NAME)
.build();
} catch (GeneralSecurityException | IOException e) {
e.printStackTrace();
}
return service;
}
public static List<Event> getAllEventsStartingFromDateTime(int league, DateTime dateTime) {
com.google.api.services.calendar.Calendar service = getSerivce();
Events events = null;
String calendarUrl = CalendarConfigProvider.getCalendarUrl(league);
// Build a new authorized API client service.
try {
events = service.events().list(calendarUrl)
.setMaxResults(100)
.setTimeMin(dateTime)
.setOrderBy("startTime")
.setSingleEvents(true)
.execute();
} catch (IOException e) {
e.printStackTrace();
}
// List the next 10 events from the primary calendar.
assert events != null;
List<Event> items = events.getItems();
return items;
}
public static void createNewEvent(TLWMatchday matchday) {
Calendar service = getSerivce();
String calendarId = CalendarConfigProvider.getCalendarId(matchday.getLeague());
String matchdayName = matchday.getMatchdayName() == "" ? matchday.getMatchday().toString() + ". Spieltag" : matchday.getMatchdayName();
String summary = "Tippabgabeschluss " + TLWLeague.getLeagueNameCalendar(matchday.getLeague()) + " " + matchdayName;
String description = "Tippabgabeschluss " + TLWLeague.getLeagueNameCalendar(matchday.getLeague()) + " " + matchdayName;
Event event = new Event()
.setSummary(summary)
.setLocation("https://www.tippliga-wuerzburg.de/app.php/football/bet")
.setDescription(description);
DateTime deliveryDate = new DateTime(matchday.getDeliveryDate().replace(" ", "T"));
EventDateTime date = new EventDateTime()
.setDateTime(deliveryDate)
.setTimeZone("Europe/Berlin");
event.setStart(date);
event.setEnd(date);
// Set reminder to 12 hours before
Event.Reminders reminders = new Event.Reminders();
EventReminder[] reminderOverrides = new EventReminder[] {
new EventReminder().setMethod("popup").setMinutes(12 * 60),
};
reminders.setOverrides(Arrays.asList(reminderOverrides));
event.setReminders(reminders);
try {
service.events().insert(calendarId, event).execute();
} catch (IOException e) {
e.printStackTrace();
}
}
public static void updateMatchdayDate(TLWMatchday matchday) {
}
public static Event getEventForMatchday(TLWMatchday matchday) {
return null;
}
}

View File

@@ -0,0 +1,140 @@
/*
* Copyright (c) 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package de.jeyp91.googlecalendar;
import com.google.api.client.googleapis.json.GoogleJsonResponseException;
import com.google.api.client.util.DateTime;
import com.google.api.client.util.store.DataStore;
import com.google.api.services.calendar.Calendar;
import com.google.api.services.calendar.CalendarScopes;
import com.google.api.services.calendar.model.Event;
import com.google.api.services.calendar.model.Events;
import com.google.common.collect.Lists;
import java.io.IOException;
import java.util.Date;
import java.util.List;
import java.util.TimeZone;
/**
* A sample that demonstrates how to efficiently sync
* <a href="https://developers.google.com/google-apps/calendar/v3/reference/">Calendar resource</a>
* using sync tokens.
*
* @author ekoleda+devrel@google.com (Eric Koleda)
*/
public class SyncTokenSample {
/** Global instance of the Calendar client. */
private static Calendar client;
/** Global instance of the event datastore. */
private static DataStore<String> eventDataStore;
/** Global instance of the sync settings datastore. */
private static DataStore<String> syncSettingsDataStore;
/** The key in the sync settings datastore that holds the current sync token. */
private static final String SYNC_TOKEN_KEY = "syncToken";
public static void main(String[] args) {
try {
List<String> scopes = Lists.newArrayList(CalendarScopes.CALENDAR_READONLY);
client = Utils.createCalendarClient(scopes);
eventDataStore = Utils.getDataStoreFactory().getDataStore("EventStore");
syncSettingsDataStore = Utils.getDataStoreFactory().getDataStore("SyncSettings");
run();
} catch (Throwable t) {
t.printStackTrace();
System.exit(1);
}
}
/**
* Syncs events from the user's primary calendar to a local datastore. A full sync is performed on
* the first run, with incremental syncs on subsequent runs.
*/
private static void run() throws IOException {
// Construct the {@link Calendar.Events.List} request, but don't execute it yet.
Calendar.Events.List request = client.events().list("primary");
// Load the sync token stored from the last execution, if any.
String syncToken = syncSettingsDataStore.get(SYNC_TOKEN_KEY);
if (syncToken == null) {
System.out.println("Performing full sync.");
// Set the filters you want to use during the full sync. Sync tokens aren't compatible with
// most filters, but you may want to limit your full sync to only a certain date range.
// In this example we are only syncing events up to a year old.
Date oneYearAgo = Utils.getRelativeDate(java.util.Calendar.YEAR, -1);
request.setTimeMin(new DateTime(oneYearAgo, TimeZone.getTimeZone("UTC")));
} else {
System.out.println("Performing incremental sync.");
request.setSyncToken(syncToken);
}
// Retrieve the events, one page at a time.
String pageToken = null;
Events events = null;
do {
request.setPageToken(pageToken);
try {
events = request.execute();
} catch (GoogleJsonResponseException e) {
if (e.getStatusCode() == 410) {
// A 410 status code, "Gone", indicates that the sync token is invalid.
System.out.println("Invalid sync token, clearing event store and re-syncing.");
syncSettingsDataStore.delete(SYNC_TOKEN_KEY);
eventDataStore.clear();
run();
} else {
throw e;
}
}
List<Event> items = events.getItems();
if (items.size() == 0) {
System.out.println("No new events to sync.");
} else {
for (Event event : items) {
syncEvent(event);
}
}
pageToken = events.getNextPageToken();
} while (pageToken != null);
// Store the sync token from the last request to be used during the next execution.
syncSettingsDataStore.set(SYNC_TOKEN_KEY, events.getNextSyncToken());
System.out.println("Sync complete.");
}
/**
* Sync an individual event. In this example we simply store it's string represenation to a file
* system data store.
*/
private static void syncEvent(Event event) throws IOException {
if ("cancelled".equals(event.getStatus()) && eventDataStore.containsKey(event.getId())) {
eventDataStore.delete(event.getId());
System.out.println(String.format("Deleting event: ID=%s", event.getId()));
} else {
eventDataStore.set(event.getId(), event.toString());
System.out.println(
String.format("Syncing event: ID=%s, Name=%s", event.getId(), event.getSummary()));
}
}
}

View File

@@ -0,0 +1,130 @@
/*
* Copyright (c) 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package de.jeyp91.googlecalendar;
import com.google.api.client.auth.oauth2.Credential;
import com.google.api.client.extensions.java6.auth.oauth2.AuthorizationCodeInstalledApp;
import com.google.api.client.extensions.jetty.auth.oauth2.LocalServerReceiver;
import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow;
import com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets;
import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.client.util.DateTime;
import com.google.api.client.util.store.DataStoreFactory;
import com.google.api.client.util.store.FileDataStoreFactory;
import com.google.api.services.calendar.Calendar;
import com.google.api.services.calendar.model.Event;
import com.google.api.services.calendar.model.Event.Reminders;
import com.google.api.services.calendar.model.EventDateTime;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Date;
import java.util.List;
import java.util.TimeZone;
/**
* A collection of utility methods used by these samples.
*/
public class Utils {
/** Application name */
private static final String APPLICATION_NAME = "Calendar Sync Samples";
/** Directory to store user credentials. */
private static final java.io.File DATA_STORE_DIR =
new java.io.File(System.getProperty("user.home"), ".store/calendar-sync");
/** Global instance of the {@link DataStoreFactory}. */
private static FileDataStoreFactory dataStoreFactory;
/** Global instance of the JSON factory. */
private static final JsonFactory JSON_FACTORY = JacksonFactory.getDefaultInstance();
/** Global instance of the HTTP transport. */
private static HttpTransport httpTransport;
static {
try {
httpTransport = GoogleNetHttpTransport.newTrustedTransport();
dataStoreFactory = new FileDataStoreFactory(DATA_STORE_DIR);
} catch (Throwable t) {
t.printStackTrace();
System.exit(1);
}
}
/** Creates a new Calendar client to use when making requests to the API. */
public static Calendar createCalendarClient(List<String> scopes) throws Exception {
Credential credential = authorize(scopes);
return new Calendar.Builder(
httpTransport, JSON_FACTORY, credential).setApplicationName(APPLICATION_NAME).build();
}
/** Authorizes the installed application to access user's protected data. */
public static Credential authorize(List<String> scopes) throws Exception {
// Load client secrets.
GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(JSON_FACTORY,
new InputStreamReader(SyncTokenSample.class.getResourceAsStream("/client_secrets.json")));
if (clientSecrets.getDetails().getClientId().startsWith("Enter")
|| clientSecrets.getDetails().getClientSecret().startsWith("Enter")) {
System.out.println(
"Overwrite the src/main/resources/client_secrets.json file with the client secrets file "
+ "you downloaded from your Google Developers Console project.");
System.exit(1);
}
GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(httpTransport,
JSON_FACTORY, clientSecrets, scopes).setDataStoreFactory(dataStoreFactory).build();
// Authorize.
LocalServerReceiver receiver = new LocalServerReceiver.Builder().setPort(8888).build();
return new AuthorizationCodeInstalledApp(flow, receiver).authorize("user");
}
/** Gets the datastore factory used in these samples. */
public static DataStoreFactory getDataStoreFactory() {
return dataStoreFactory;
}
/** Creates a test event. */
public static Event createTestEvent(Calendar client, String summary) throws IOException {
Date oneHourFromNow = Utils.getRelativeDate(java.util.Calendar.HOUR, 1);
Date twoHoursFromNow = Utils.getRelativeDate(java.util.Calendar.HOUR, 2);
DateTime start = new DateTime(oneHourFromNow, TimeZone.getTimeZone("UTC"));
DateTime end = new DateTime(twoHoursFromNow, TimeZone.getTimeZone("UTC"));
Event event = new Event().setSummary(summary)
.setReminders(new Reminders().setUseDefault(false))
.setStart(new EventDateTime().setDateTime(start))
.setEnd(new EventDateTime().setDateTime(end));
return client.events().insert("primary", event).execute();
}
/**
* Gets a new {@link java.util.Date} relative to the current date and time.
*
* @param field the field identifier from {@link java.util.Calendar} to increment
* @param amount the amount of the field to increment
* @return the new date
*/
public static Date getRelativeDate(int field, int amount) {
Date now = new Date();
java.util.Calendar cal = java.util.Calendar.getInstance();
cal.setTime(now);
cal.add(field, amount);
return cal.getTime();
}
}

View File

@@ -0,0 +1,142 @@
package de.jeyp91.openligadb;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
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;
/**
*
*/
public class OpenLigaDBConnector {
private final String OPENLIGADB_API_URL = "http://www.openligadb.de/api/";
public OpenLigaDBConnector() {}
public OpenLigaDBMatch getMatchDataOfSingleMatch(int id) {
String url = OPENLIGADB_API_URL + "getmatchdata/" + id;
JSONObject matchAsJson = getDataAsJSONObject(url);
return new OpenLigaDBMatch(matchAsJson);
}
public ArrayList<OpenLigaDBMatch> getMatchDataOfMatchday(int season, String league, int matchday) {
String url = OPENLIGADB_API_URL + "getmatchdata/" + league + "/" + (season - 1) + "/" + matchday;
JSONArray matches = getDataAsJSONArray(url);
ArrayList<OpenLigaDBMatch> matchesList = new ArrayList<>();
for(Object match: matches) {
matchesList.add(new OpenLigaDBMatch((JSONObject) match));
}
return matchesList;
}
public ArrayList<OpenLigaDBMatch> getMatchDataOfCurrentMatchday(String league) {
String url = OPENLIGADB_API_URL + "getmatchdata/" + league;
JSONArray matches = getDataAsJSONArray(url);
ArrayList<OpenLigaDBMatch> matchesList = new ArrayList<>();
for(Object match: matches) {
matchesList.add(new OpenLigaDBMatch((JSONObject) match));
}
return matchesList;
}
public OpenLigaDBMatch getMatchDataByMatchId(int id) {
String url = OPENLIGADB_API_URL + "getmatchdata/" + id;
JSONObject match = getDataAsJSONObject(url);
return new OpenLigaDBMatch(match);
}
private JSONArray getDataAsJSONArray(String requestUrl) {
String rawData = getRawData(requestUrl);
JSONParser parser = new JSONParser();
JSONArray data = null;
try {
data = (JSONArray) parser.parse(rawData);
} catch (ParseException e) {
/* TODO */
e.printStackTrace();
}
return data;
}
private JSONObject getDataAsJSONObject(String requestUrl) {
String rawData = getRawData(requestUrl);
JSONParser parser = new JSONParser();
JSONObject data = null;
try {
data = (JSONObject) parser.parse(rawData);
} catch (ParseException e) {
/* TODO */
e.printStackTrace();
}
return data;
}
private String getRawData(String requestUrl) {
HttpClient client = HttpClientBuilder.create().build();
HttpGet request = new HttpGet(requestUrl);
// add request header
request.addHeader("Content-Type", "application/json");
HttpResponse response = null;
try {
response = client.execute(request);
} catch (ClientProtocolException e) {
/* TODO */
e.printStackTrace();
} catch (IOException e) {
/* TODO */
e.printStackTrace();
}
BufferedReader rd = null;
try {
rd = new BufferedReader(
new InputStreamReader(response.getEntity().getContent())
);
} 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();
}
}

View File

@@ -0,0 +1,88 @@
package de.jeyp91.openligadb;
import de.jeyp91.BaseMatch;
import de.jeyp91.tippliga.TLWMatch;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import java.util.regex.*;
/**
*
*/
public class OpenLigaDBMatch extends BaseMatch {
private final int RESULT_TYPE_ENDRESULT = 2;
private Integer season = null;
private int matchId;
private int leagueId;
private boolean matchIsFinished;
public OpenLigaDBMatch(JSONObject json) {
this.matchId = Integer.parseInt(json.get("MatchID").toString());
this.season = getSeasonFromLeageName(json.get("LeagueName").toString());
this.leagueId = Integer.parseInt(json.get("LeagueId").toString());
this.teamIdHome = Integer.parseInt(((JSONObject) json.get("Team1")).get("TeamId").toString());
this.teamIdGuest = Integer.parseInt(((JSONObject) json.get("Team2")).get("TeamId").toString());
for(int i = 0; i < ((JSONArray) json.get("MatchResults")).size(); i++) {
if(Integer.parseInt((((JSONObject) ((JSONArray) json.get("MatchResults")).get(i)).get("ResultTypeID")).toString()) == RESULT_TYPE_ENDRESULT) {
this.goalsHome = Integer.parseInt(((JSONObject) ((JSONArray) json.get("MatchResults")).get(i)).get("PointsTeam1").toString());
this.goalsGuest = Integer.parseInt(((JSONObject) ((JSONArray) json.get("MatchResults")).get(i)).get("PointsTeam2").toString());
}
}
this.matchday = Integer.parseInt(((JSONObject) json.get("Group")).get("GroupOrderID").toString());
this.matchIsFinished = (Boolean) json.get("MatchIsFinished");
this.matchDatetime = (String) json.get("MatchDateTime");
}
private int getSeasonFromLeageName(String leagueName) {
Pattern p = Pattern.compile("\\d*/\\d*");
Matcher m = p.matcher(leagueName);
m.find();
String seasonString = m.group();
p = Pattern.compile("\\d+");
m = p.matcher(seasonString);
Integer season = null;
while(m.find()) {
season = Integer.parseInt(m.group());
}
return season < 100 ? season + 2000 : season;
}
public boolean isSameMatch(TLWMatch compareMatch) {
if(this.getSeason()!= compareMatch.getSeason()) {
return false;
}
if(this.getMatchday() != compareMatch.getMatchday()) {
return false;
}
if(this.getTeamIdHome() != compareMatch.getTeamIdHome()) {
return false;
}
if(this.getTeamIdGuest() != compareMatch.getTeamIdGuest()) {
return false;
}
String thisDateTime = this.getMatchDateTime().replace("T", " ");
String tempDateTime = compareMatch.getMatchDateTime().replace("T", " ");
if(!tempDateTime.equals(thisDateTime)) {
return false;
}
if(this.goalsHome != compareMatch.getGoalsHome() ||
this.goalsGuest != compareMatch.getGoalsGuest()) {
return false;
}
return true;
}
public Integer getSeason() {
return this.season;
}
public Integer getMatchId() {
return this.matchId;
}
public boolean getMatchIsFinished() {
return this.matchIsFinished;
}
}

View File

@@ -0,0 +1,137 @@
package de.jeyp91.tippliga;
import com.google.common.io.Resources;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import java.io.IOException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
public class TLWFootballMatchdaysCreator {
int season;
int league;
ArrayList<TLWMatch> matches;
int matchesPerMatchday;
JSONObject configObject;
public TLWFootballMatchdaysCreator (int season, int league, String configPath){
this.season = season;
this.league = league;
TLWFootballMatchesCreator matchesCreator = new TLWFootballMatchesCreator(2021, 1, configPath);
this.matches = matchesCreator.getMatches();
JSONParser jsonParser = new JSONParser();
URL url = Resources.getResource(season + "\\" + configPath);
String jsonConfig = null;
try {
jsonConfig = Resources.toString(url, StandardCharsets.UTF_8);
this.configObject = (JSONObject) jsonParser.parse(jsonConfig);
} catch (IOException | ParseException e) {
e.printStackTrace();
}
//Read JSON file
this.matchesPerMatchday = ((Long) this.configObject.get("matchesPerMatchday")).intValue();
}
public ArrayList<TLWMatchday> getMatchdays() {
ArrayList<TLWMatchday> matchdays = new ArrayList<>();
int matchdayCounter = 1;
while(getMatchesForMatchday(matches, matchdayCounter).size() > 0) {
ArrayList<TLWMatch> matchesOfMatchday = getMatchesForMatchday(matches, matchdayCounter);
String deliveryDate1 = null;
String deliveryDate2 = null;
Date firstMatchDate = null;
for(TLWMatch match : matchesOfMatchday) {
if(deliveryDate1 == null) {
deliveryDate1 = match.getMatchDateTime();
}
Date matchdate = null;
try {
matchdate = new SimpleDateFormat("yyyy-MM-dd").parse(match.getMatchDateTime().substring(0, 10));
} catch (java.text.ParseException e) {
e.printStackTrace();
}
if(firstMatchDate == null) {
firstMatchDate = matchdate;
}
if(deliveryDate2 == null && getDaysDifference(firstMatchDate, matchdate) >= 1) {
deliveryDate2 = match.getMatchDateTime();
}
}
int numberOfMatches = 0;
if(this.matchesPerMatchday == 0){
numberOfMatches = matchesOfMatchday.size();
}
String matchdayName = getMatchdayNameFromConfig(matchdayCounter);
TLWMatchday matchday = new TLWMatchday(this.season, this.league, matchdayCounter, 0, deliveryDate1, deliveryDate2, "", matchdayName, numberOfMatches);
matchdays.add(matchday);
matchdayCounter++;
}
return matchdays;
}
public String getMatchdaysSQL() {
String matchdaySql = "";
for (TLWMatchday matchday : getMatchdays()) {
matchdaySql += "REPLACE INTO phpbb_footb_matchdays VALUES('";
matchdaySql += matchday.getSeason().toString();
matchdaySql += "', '";
matchdaySql += matchday.getLeague().toString();
matchdaySql += "', '";
matchdaySql += matchday.getMatchday().toString();
matchdaySql += "', '";
matchdaySql += matchday.getStatus().toString();
matchdaySql += "', '";
matchdaySql += matchday.getDeliveryDate();
matchdaySql += "', '";
matchdaySql += matchday.getDeliveryDate2();
matchdaySql += "', '";
matchdaySql += matchday.getDeliveryDate3();
matchdaySql += "', '";
matchdaySql += matchday.getMatchdayName();
matchdaySql += "', '";
matchdaySql += matchday.getMatches().toString();
matchdaySql += "');\n";
}
return matchdaySql;
}
private int getDaysDifference(Date date1, Date date2) {
long startTime = date1.getTime();
long endTime = date2.getTime();
long diffTime = endTime - startTime;
long diffDays = diffTime / (1000 * 60 * 60 * 24);
return (int) diffDays;
}
private ArrayList<TLWMatch> getMatchesForMatchday(ArrayList<TLWMatch> matches, int matchday) {
ArrayList<TLWMatch> matchesOfMatchday = new ArrayList<>();
for(TLWMatch match : matches) {
if(match.getMatchday() == matchday) {
matchesOfMatchday.add(match);
}
}
return matchesOfMatchday;
}
private String getMatchdayNameFromConfig(int matchday) {
String matchdayName = "";
JSONArray matchdaysConfig = (JSONArray) this.configObject.get("matchdayConfig");
for (Object matchdayConfig : matchdaysConfig) {
if(((JSONObject) matchdayConfig).get("TLWMatchday").toString().equals(String.valueOf(matchday))
&& ((JSONObject) matchdayConfig).containsKey("matchdayName")) {
matchdayName = ((JSONObject) matchdayConfig).get("matchdayName").toString();
}
}
return matchdayName;
}
}

View File

@@ -0,0 +1,191 @@
package de.jeyp91.tippliga;
import com.google.common.io.Resources;
import de.jeyp91.apifootball.APIFootballConnector;
import de.jeyp91.apifootball.APIFootballMatch;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import java.io.IOException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
public class TLWFootballMatchesCreator {
int season;
int league;
int numberOfMatchdays;
int matchesPerMatchday;
int ko;
int nextMatchNo = 1;
JSONArray matchdayConfig;
APIFootballConnector conn;
ArrayList<TLWMatch> TLWMatches;
public TLWFootballMatchesCreator(int season, int league, String configFileName) {
this.season = season;
this.league = league;
conn = new APIFootballConnector(season - 1);
URL url = Resources.getResource(season + "\\" + configFileName);
String jsonConfig = null;
this.TLWMatches = new ArrayList<>();
try {
JSONParser jsonParser = new JSONParser();
jsonConfig = Resources.toString(url, StandardCharsets.UTF_8);
//Read JSON file
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 (IOException | ParseException e) {
e.printStackTrace();
}
this.publicateMatchObjects();
}
private void publicateMatchObjects() {
for(int i = 0; i < this.matchdayConfig.size(); i++) {
int TLWMatchday = ((Long) ((JSONObject) this.matchdayConfig.get(i)).get("TLWMatchday")).intValue();
JSONArray matchesConfig = (JSONArray)((JSONObject) this.matchdayConfig.get(i)).get("matchesConfig");
ArrayList<APIFootballMatch> APIFootballMatches = getMatchesForMatchday(matchesConfig);
int tempNumberOfMatchesBackup = this.matchesPerMatchday;
if(((JSONObject) this.matchdayConfig.get(i)).containsKey("numberOfMatches")) {
this.matchesPerMatchday = ((Long) ((JSONObject) this.matchdayConfig.get(i)).get("numberOfMatches")).intValue();
}
int matchdayMatchCounter = 0;
// Use first matchtime because API Football always returns matches sorted by date
Date firstDate = null;
for(APIFootballMatch match : APIFootballMatches) {
int matchNo = this.nextMatchNo;
this.nextMatchNo++;
int status = 0;
Date matchDateTime = null;
try {
matchDateTime = new SimpleDateFormat("yyyy-MM-dd").parse(match.getMatchDateTime().substring(0, 10));
} catch (java.text.ParseException e) {
e.printStackTrace();
}
if(firstDate != null && getDaysDifference(firstDate, matchDateTime) >= 1) {
status = -1;
}
this.TLWMatches.add(new TLWMatch(match, this.season, this.league, TLWMatchday, matchNo, status, this.ko));
matchdayMatchCounter++;
if(firstDate == null) {
firstDate = matchDateTime;
}
}
// Add empty missing matches
for(int j = matchdayMatchCounter; j < this.matchesPerMatchday; j++) {
String matchDatetime = "";
if(((JSONObject) matchesConfig.get(0)).get("type").toString().equals("ToBeDefined")) {
matchDatetime = ((JSONObject) matchesConfig.get(0)).get("placeholderDatetime").toString();
}
else if(APIFootballMatches.size() > 0) {
matchDatetime = this.TLWMatches.get(this.TLWMatches.size() - 1).getMatchDateTime();
}
int matchNo = this.nextMatchNo;
this.nextMatchNo++;
this.TLWMatches.add(new TLWMatch(this.season, this.league, TLWMatchday, matchNo, matchDatetime, 0, this.ko));
}
if(((JSONObject) this.matchdayConfig.get(i)).containsKey("numberOfMatches")) {
this.matchesPerMatchday = tempNumberOfMatchesBackup;
}
}
}
private ArrayList<APIFootballMatch> getMatchesForMatchday(JSONArray config) {
ArrayList<APIFootballMatch> apiFootballMatches = new ArrayList<>();
for (Object singleConfigObject : config) {
JSONObject singleConfig = (JSONObject) singleConfigObject;
String type = (String) singleConfig.get("type");
switch (type) {
case "AllMatchesOfMatchday":
int matchesLeague = ((Long) singleConfig.get("matchesLeague")).intValue();
int leagueMatchday = ((Long) singleConfig.get("leagueMatchday")).intValue();
apiFootballMatches.addAll(conn.getMatchDataByLeagueAndMatchday(matchesLeague, leagueMatchday));
break;
case "SingleMatch":
int matchLeague = ((Long) singleConfig.get("matchLeague")).intValue();
int matchId = ((Long) singleConfig.get("matchId")).intValue();
apiFootballMatches.add(conn.getMatchDataByLeagueAndMatchID(matchLeague, matchId));
break;
}
}
return apiFootballMatches;
}
private int getDaysDifference(Date date1, Date date2) {
long startTime = date1.getTime();
long endTime = date2.getTime();
long diffTime = endTime - startTime;
long diffDays = diffTime / (1000 * 60 * 60 * 24);
return (int) diffDays;
}
public ArrayList<TLWMatch> getMatches() {
return this.TLWMatches;
}
public String getSQLInsertString() {
String sql = "";
ArrayList<TLWMatch> tlwMatches = getMatches();
// Add matches from config
for(TLWMatch match : tlwMatches) {
String teamIdHome = match.getTeamIdHome() != null ? match.getTeamIdHome().toString() : "''";
String teamIdGuest = match.getTeamIdGuest() != null ? match.getTeamIdGuest().toString() : "''";
String matchSql = "REPLACE INTO phpbb_footb_matches VALUES(";
matchSql += match.getSeason().toString();
matchSql += ", ";
matchSql += match.getLeague().toString();
matchSql += ", ";
matchSql += match.getMatchNo().toString();
matchSql += ", ";
matchSql += teamIdHome;
matchSql += ", ";
matchSql += teamIdGuest;
// No goals while creating league
matchSql += ", '', '', ";
matchSql += match.getMatchday().toString();
// status 0 while creating
matchSql += ", ";
matchSql += match.getStatus().toString();
matchSql += ", '";
matchSql += match.getMatchDateTime();
// group_id, formula_home, formula_guest
matchSql += "', '', '', '', '";
// ko_match,
matchSql += match.getKoMatch();
// goals_overtime_home, goals_overtime_guest
matchSql += "', '', '', ";
// show_table
matchSql += "0";
// trend, odd_1, odd_x, odd_2, rating
matchSql += ", '', '0.00', '0.00', '0.00', '0.00');\n";
sql += matchSql;
}
return sql;
}
}

View File

@@ -0,0 +1,79 @@
package de.jeyp91.tippliga;
public class TLWLeague {
public static String getLeagueName(int id) {
String leagueName = "";
switch (id) {
case 1:
leagueName = "1. Tippliga Würzburg";
break;
case 2:
leagueName = "2. Tippliga Würzburg";
break;
case 46:
leagueName = "Elfmeter";
break;
case 47:
leagueName = "Relegation";
break;
case 48:
leagueName = "WTL-Pokal";
break;
case 49:
leagueName = "Liga-Cup";
break;
default: break;
}
return leagueName;
}
public static String getLeagueNameShort(int id) {
String leagueName = "";
switch (id) {
case 1:
leagueName = "1. TLW";
break;
case 2:
leagueName = "2. TLW";
break;
case 46:
leagueName = "ELF";
break;
case 47:
leagueName = "REL";
break;
case 48:
leagueName = "WTL";
break;
case 49:
leagueName = "LC";
break;
default: break;
}
return leagueName;
}
public static String getLeagueNameCalendar(int id) {
String leagueName = "";
switch (id) {
case 1:
case 2:
leagueName = "TLW";
break;
case 46:
leagueName = "ELF";
break;
case 47:
leagueName = "REL";
break;
case 48:
leagueName = "WTL";
break;
case 49:
leagueName = "LC";
break;
default: break;
}
return leagueName;
}
}

View File

@@ -0,0 +1,225 @@
package de.jeyp91.tippliga;
import java.sql.ResultSet;
import java.sql.SQLException;
import de.jeyp91.BaseMatch;
import de.jeyp91.TeamIDMatcher;
import de.jeyp91.apifootball.APIFootballMatch;
import de.jeyp91.openligadb.OpenLigaDBMatch;
/**
*
*/
public class TLWMatch extends BaseMatch {
public final Integer STATUS_NOTSTARTED = 0;
public final Integer STATUS_STARTED = 1;
public final Integer STATUS_PROVISIONAL_RESULT_AVAILABLE = 2;
public final Integer STATUS_FINISHED = 3;
private Integer season = null;
private Integer league = null;
private Integer matchNo = null;
private String groupId = null;
private String formulaHome = null;
private String formulaGuest = null;
private Integer status = null;
private Integer koMatch = 0;
private Integer goalsOvertimeHome = null;
private Integer goalsOvertimeGuest = null;
private Integer showTable = null;
private String trend = null;
private Float odd1 = null;
private Float oddX = null;
private Float odd2 = null;
private Float rating = null;
public TLWMatch(ResultSet rset) {
final int SEASON = 1;
final int LEAGUE = 2;
final int MATCH_NO = 3;
final int TEAM_ID_HOME = 4;
final int TEAM_ID_GUEST = 5;
final int GOALS_HOME = 6;
final int GOALS_GUEST = 7;
final int MATCHDAY = 8;
final int STATUS = 9;
final int MATCH_DATETIME = 10;
final int GROUP_ID = 11;
final int FORMULA_HOME = 12;
final int FORMULA_GUEST = 13;
final int KO_MATCH = 14;
final int GOALS_OVERTIME_HOME = 15;
final int GOALS_OVERTIME_GUEST = 16;
final int SHOW_TABLE = 17;
final int TREND = 18;
final int ODD1 = 19;
final int ODDX = 20;
final int ODD2 = 21;
final int RATING = 22;
try {
this.season = Integer.parseInt(rset.getString(SEASON));
this.league = Integer.parseInt(rset.getString(LEAGUE));
this.matchNo = Integer.parseInt(rset.getString(MATCH_NO));
this.teamIdHome = Integer.parseInt(rset.getString(TEAM_ID_HOME));
this.teamIdGuest = Integer.parseInt(rset.getString(TEAM_ID_GUEST));
this.goalsHome = rset.getString(GOALS_HOME).isEmpty()?null:Integer.parseInt(rset.getString(GOALS_HOME));
this.goalsGuest = rset.getString(GOALS_GUEST).isEmpty()?null:Integer.parseInt(rset.getString(GOALS_GUEST));
this.matchday = Integer.parseInt(rset.getString(MATCHDAY));
this.status = Integer.parseInt(rset.getString(STATUS));
this.matchDatetime = rset.getString(MATCH_DATETIME);
this.groupId = rset.getString(GROUP_ID);
this.formulaHome = rset.getString(FORMULA_HOME);
this.formulaGuest = rset.getString(FORMULA_GUEST);
this.koMatch = Integer.parseInt(rset.getString(KO_MATCH));
this.goalsOvertimeHome = rset.getString(GOALS_OVERTIME_HOME).isEmpty()?null:Integer.parseInt(rset.getString(GOALS_OVERTIME_HOME));
this.goalsOvertimeGuest = rset.getString(GOALS_OVERTIME_GUEST).isEmpty()?null:Integer.parseInt(rset.getString(GOALS_OVERTIME_GUEST));
this.showTable = Integer.parseInt(rset.getString(SHOW_TABLE));
this.trend = rset.getString(TREND);
this.odd1 = Float.parseFloat(rset.getString(ODD1));
this.oddX = Float.parseFloat(rset.getString(ODDX));
this.odd2 = Float.parseFloat(rset.getString(ODD2));
this.rating = Float.parseFloat(rset.getString(RATING));
} catch (SQLException e) {
/* TODO */
e.printStackTrace();
}
}
public TLWMatch(OpenLigaDBMatch oldbmatch, int season, int league, int matchday, int matchNo) {
this.season = season;
this.league = league;
this.matchday = matchday;
this.matchNo = matchNo;
this.teamIdHome = TeamIDMatcher.getTippligaIdFromOpenLigaDbId(oldbmatch.getTeamIdHome());
this.teamIdGuest = TeamIDMatcher.getTippligaIdFromOpenLigaDbId(oldbmatch.getTeamIdGuest());
this.goalsHome = oldbmatch.getGoalsHome();
this.goalsGuest = oldbmatch.getGoalsGuest();
this.matchDatetime = oldbmatch.getMatchDateTime().replace("T", " ");
this.groupId = "";
this.formulaHome = "";
this.formulaGuest = "";
this.status = 0;
}
public TLWMatch(APIFootballMatch APIFootballMatch, int season, int league, int matchday, int matchNo, int status, int koMatch) {
this.season = season;
this.league = league;
this.matchday = matchday;
this.matchNo = matchNo;
this.teamIdHome = TeamIDMatcher.getTippligaIdFromOpenLigaDbId(APIFootballMatch.getTeamIdHome());
this.teamIdGuest = TeamIDMatcher.getTippligaIdFromOpenLigaDbId(APIFootballMatch.getTeamIdGuest());
this.goalsHome = APIFootballMatch.getGoalsHome();
this.goalsGuest = APIFootballMatch.getGoalsGuest();
this.matchDatetime = APIFootballMatch.getMatchDateTime().replace("T", " ").substring(0, 19);
this.groupId = "";
this.formulaHome = "";
this.formulaGuest = "";
this.status = status;
this.koMatch = koMatch;
}
public TLWMatch(int season, int league, int matchday, int matchNo, String matchDatetime, int status, int koMatch) {
this.season = season;
this.matchday = matchday;
this.league = league;
this.matchNo = matchNo;
this.formulaHome = "D";
this.formulaGuest = "D";
this.status = status;
this.koMatch = koMatch;
this.matchDatetime = matchDatetime;
}
public TLWMatch(int season, int league, int matchday, int matchNo, int teamIdHome, int teamIdGuest, String matchDatetime) {
this.season = season;
this.matchday = matchday;
this.league = league;
this.matchNo = matchNo;
this.teamIdHome = teamIdHome;
this.teamIdGuest = teamIdGuest;
this.matchDatetime = matchDatetime;
this.status = 0;
}
public Integer getSeason() {
return this.season;
}
public Integer getLeague() {
return this.league;
}
public Integer getMatchNo() {
return this.matchNo;
}
public Integer getStatus() {
return this.status;
}
public Integer getKoMatch() {
return this.koMatch;
}
public String getGroupId() {
return this.groupId;
}
public Integer isSameMatch(OpenLigaDBMatch compareMatch) {
if(this.getSeason() != compareMatch.getSeason()) {
return COMPARISON_DIFFERENT;
}
if(this.getMatchday() != compareMatch.getMatchday()) {
return COMPARISON_DIFFERENT;
}
if(this.getTeamIdHome() != compareMatch.getTeamIdHome()) {
return COMPARISON_DIFFERENT;
}
if(this.getTeamIdGuest() != compareMatch.getTeamIdGuest()) {
return COMPARISON_DIFFERENT;
}
String thisDateTime = this.getMatchDateTime().replace("T", " ");
String tempDateTime = compareMatch.getMatchDateTime().replace("T", " ");
if(!tempDateTime.equals(thisDateTime)) {
return COMPARISON_DIFFERENT_DATETIME;
}
if(this.goalsHome != compareMatch.getGoalsHome() ||
this.goalsGuest != compareMatch.getGoalsGuest()) {
return COMPARISON_DIFFERENT_RESULT;
}
return COMPARISON_IDENTICAL;
}
public String getSQLQueryReplace() {
String query = "REPLACE INTO phpbb_footb_matches VALUES (" +
this.season + ", " +
this.league + ", " +
this.matchNo + ", " +
nullToSqlEmptyString(this.teamIdHome) + ", " +
nullToSqlEmptyString(this.teamIdGuest) + ", " +
nullToSqlEmptyString(this.goalsHome) + ", " +
nullToSqlEmptyString(this.goalsGuest) + ", " +
this.matchday + ", " +
this.status + ", " +
"'" + this.matchDatetime + "', " +
"'" + this.groupId + "', " +
"'" + this.formulaHome + "', " +
"'" + this.formulaGuest + "', " +
nullToSqlEmptyString(this.koMatch) + ", " +
nullToSqlEmptyString(this.goalsOvertimeHome) + ", " +
nullToSqlEmptyString(this.goalsOvertimeGuest) + ", " +
nullToSqlEmptyString(this.showTable) + ", " +
"'0.00','0.00','0.00','0.00');";
return query;
}
private String nullToSqlEmptyString(Integer number) {
return number != null ? number.toString() : "''";
}
}

View File

@@ -0,0 +1,99 @@
package de.jeyp91.tippliga;
import java.sql.ResultSet;
import java.sql.SQLException;
public class TLWMatchday {
final Integer STATUS_NOTSTARTED = 0;
final Integer STATUS_STARTED = 1;
final Integer STATUS_PROVISIONAL_RESULT_AVAILABLE = 2;
final Integer STATUS_FINISHED = 3;
private Integer season = null;
private Integer league = null;
private Integer matchday = null;
private Integer status = null;
private String deliveryDate = null;
private String deliveryDate2 = null;
private String deliveryDate3 = null;
private String matchdayName = null;
private Integer matches = null;
public TLWMatchday(ResultSet rset) {
final int SEASON = 1;
final int LEAGUE = 2;
final int MATCHDAY = 3;
final int STATUS = 4;
final int DELIVERY_DATE = 5;
final int DELIVERY_DATE_2 = 6;
final int DELIVERY_DATE_3 = 7;
final int MATCHDAY_NAME = 8;
final int MATCHES = 9;
try {
this.season = Integer.parseInt(rset.getString(SEASON));
this.league = Integer.parseInt(rset.getString(LEAGUE));
this.matchday = Integer.parseInt(rset.getString(MATCHDAY));
this.status = Integer.parseInt(rset.getString(STATUS));
this.deliveryDate = rset.getString(DELIVERY_DATE);
this.deliveryDate2 = rset.getString(DELIVERY_DATE_2);
this.deliveryDate3 = rset.getString(DELIVERY_DATE_3);
this.matchdayName = rset.getString(MATCHDAY_NAME);
this.matches = Integer.parseInt(rset.getString(MATCHES));
} catch (SQLException e) {
/* TODO */
e.printStackTrace();
}
}
public TLWMatchday(int season, int league, int matchday, int status, String deliveryDate1, String deliveryDate2, String deliveryDate3, String matchdayName, int numberOfMatches) {
this.season = season;
this.league = league;
this.matchday = matchday;
this.status = status;
this.deliveryDate = deliveryDate1;
this.deliveryDate2 = deliveryDate2;
this.deliveryDate3 = deliveryDate3;
this.matchdayName = matchdayName;
this.matches = numberOfMatches;
}
public Integer getSeason() {
return this.season;
}
public Integer getLeague() {
return this.league;
}
public Integer getMatchday() {
return this.matchday;
}
public Integer getStatus() {
return this.status;
}
public String getDeliveryDate() {
return this.deliveryDate == null ? "" : this.deliveryDate;
}
public String getDeliveryDate2() {
return this.deliveryDate2 == null ? "" : this.deliveryDate2;
}
public String getDeliveryDate3() {
return this.deliveryDate3 == null ? "" : this.deliveryDate3;
}
public String getMatchdayName() {
return this.matchdayName;
}
public Integer getMatches() {
return this.matches;
}
}

View File

@@ -0,0 +1,71 @@
package de.jeyp91.tippliga;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
*
*/
public class TLWTeam {
private int season;
private int league;
private int teamId;
private String teamName;
private String teamNameShort;
private String teamSymbol;
private String groupId;
private int matchday;
public TLWTeam(ResultSet rset) throws SQLException {
final int SEASON = 1;
final int LEAGUE = 2;
final int TEAM_ID = 3;
final int TEAM_NAME = 4;
final int TEAM_NAME_SHORT = 5;
final int TEAM_SYMBOL = 6;
final int GROUP_ID = 7;
final int MATCHDAY = 8;
this.season = Integer.parseInt(rset.getString(SEASON));
this.league = Integer.parseInt(rset.getString(LEAGUE));
this.teamId = Integer.parseInt(rset.getString(TEAM_ID));
this.teamName = rset.getString(TEAM_NAME);
this.teamNameShort = rset.getString(TEAM_NAME_SHORT);
this.teamSymbol = rset.getString(TEAM_SYMBOL);
this.groupId = rset.getString(GROUP_ID);
this.matchday = Integer.parseInt(rset.getString(MATCHDAY));
}
public int getSeason() {
return this.season;
}
public int getLeague() {
return this.league;
}
public int getTeamId() {
return this.teamId;
}
public String getTeamName() {
return this.teamName;
}
public String getTeamNameShort() {
return this.teamNameShort;
}
public String getTeamSymbol() {
return this.teamSymbol;
}
public String getGroupId() {
return this.groupId;
}
public int getMatchday() {
return this.matchday;
}
}

View File

@@ -0,0 +1,62 @@
package de.jeyp91.tippliga;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.Set;
public class TLWTeamsPokalCreator {
int season;
int league;
ArrayList<TLWMatch> matches;
TippligaSQLConnector connector = new TippligaSQLConnector();
public TLWTeamsPokalCreator(int season, int league, ArrayList<TLWMatch> matches) {
this.season = season;
this.league = league;
this.matches = matches;
}
public Set<Integer> getTeamIds() {
Set<Integer> teamIds = new LinkedHashSet<>();
for(TLWMatch match : matches) {
if(match.getTeamIdHome() != null) {
teamIds.add(match.getTeamIdHome());
}
if(match.getTeamIdGuest() != null) {
teamIds.add(match.getTeamIdGuest());
}
}
return teamIds;
}
public String getSql() {
Set<Integer> teamIds = getTeamIds();
String sql = "";
for (Integer id : teamIds) {
ArrayList<TLWTeam> teams = connector.getTeamsById(String.valueOf(id));
String teamName = teams.get(0).getTeamName();
String teamNameShort = teams.get(0).getTeamNameShort();
String teamSymbol = teams.get(0).getTeamSymbol();
String groupId = "";
int matchday = 0;
sql += "REPLACE INTO phpbb_footb_teams VALUES ('";
sql += this.season;
sql += "', '";
sql += this.league;
sql += "', '";
sql += id;
sql += "', '";
sql += teamName;
sql += "', '";
sql += teamNameShort;
sql += "', '";
sql += teamSymbol;
sql += "', '";
sql += groupId;
sql += "', '";
sql += matchday;
sql += "');\n";
}
return sql;
}
}

View File

@@ -0,0 +1,143 @@
package de.jeyp91.tippliga;
import com.google.common.io.Resources;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import java.io.IOException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
public class TLWTipperMatchesCreator {
int season;
int league;
ArrayList<TLWMatch> TLWMatches;
JSONArray matchPairingConfig;
JSONObject tipperList;
JSONArray tipperTeamConfig;
ArrayList<TLWMatchday> matchdays;
public TLWTipperMatchesCreator(int season, int league, String configFileName, ArrayList<TLWMatchday> matchdays) {
this.season = season;
this.league = league;
this.matchdays = matchdays;
URL matchPairConfigUrl = Resources.getResource("Tipper_Match_Pair_Config.json");
URL tipperListUrl = Resources.getResource(season + "\\" + configFileName);
URL tipperTeamConfigUrl = Resources.getResource("Tipper_Team_Config.json");
this.TLWMatches = new ArrayList<>();
try {
JSONParser jsonParser = new JSONParser();
String matchPairingConfigString = Resources.toString(matchPairConfigUrl, StandardCharsets.UTF_8);
this.matchPairingConfig = (JSONArray) jsonParser.parse(matchPairingConfigString);
String tipperListString = Resources.toString(tipperListUrl, StandardCharsets.UTF_8);
this.tipperList = (JSONObject) jsonParser.parse(tipperListString);
String tipperTeamConfigString = Resources.toString(tipperTeamConfigUrl, StandardCharsets.UTF_8);
this.tipperTeamConfig = (JSONArray) jsonParser.parse(tipperTeamConfigString);
} catch (IOException | ParseException e) {
e.printStackTrace();
}
this.publicateMatchObjects();
}
private void publicateMatchObjects() {
for(Object matchdayConfig : this.matchPairingConfig) {
int matchday = ((Long) ((JSONObject) matchdayConfig).get("matchday")).intValue();
JSONArray matchesConfig = (JSONArray)((JSONObject) matchdayConfig).get("matches");
for(int i = 0; i < matchesConfig.size(); i++) {
int homeTipperNumber = ((Long) ((JSONObject) matchesConfig.get(i)).get("home")).intValue();
int guestTipperNumber = ((Long) ((JSONObject) matchesConfig.get(i)).get("guest")).intValue();
String homeName = this.tipperList.get(String.valueOf(homeTipperNumber)).toString();
String guestName = this.tipperList.get(String.valueOf(guestTipperNumber)).toString();
int teamIdHome = getTeamIdFromTipperName(homeName);
int teamIdGuest = getTeamIdFromTipperName(guestName);
int matchNo = (matchday - 1) * matchesConfig.size() + i + 1;
String matchDatetime = getDeliveryDateForMatchday(matchday);
TLWMatch tlwMatch = new TLWMatch(this.season, this.league, matchday, matchNo, teamIdHome, teamIdGuest, matchDatetime);
this.TLWMatches.add(tlwMatch);
}
}
}
private int getTeamIdFromTipperName(String name) {
int teamId = 0;
for(Object config : tipperTeamConfig) {
if (((JSONObject) config).get("team_name").toString().equals(name)) {
teamId = ((Long) (((JSONObject) config).get("team_id"))).intValue();
}
}
if(teamId == 0) {
System.out.println("Did not find Tipper ID for " + name);
}
return teamId;
}
public ArrayList<TLWMatch> getMatches() {
return this.TLWMatches;
}
public String getSQLInsertString() {
String sql = "";
ArrayList<TLWMatch> tlwMatches = getMatches();
// Add matches from config
for(TLWMatch match : tlwMatches) {
String matchSql = "REPLACE INTO phpbb_footb_matches VALUES(";
matchSql += match.getSeason().toString();
matchSql += ", ";
matchSql += match.getLeague().toString();
matchSql += ", ";
matchSql += match.getMatchNo().toString();
matchSql += ", ";
matchSql += match.getTeamIdHome().toString();
matchSql += ", ";
matchSql += match.getTeamIdGuest().toString();
// No goals while creating league
matchSql += ", '', '', ";
matchSql += match.getMatchday().toString();
// status 0 while creating
matchSql += ", 0, '";
matchSql += match.getMatchDateTime();
// group_id, formula_home, formula_guest, ko_match, goals_overtime_home, goals_overtime_guest
matchSql += "', '', '', '', 0, '', '', ";
// show_table
matchSql += "0";
// trend, odd_1, odd_x, odd_2, rating
matchSql += ", '', '0.00', '0.00', '0.00', '0.00');\n";
sql += matchSql;
}
return sql;
}
private String getDeliveryDateForMatchday(int matchday) {
String deliveryDate = "";
for (TLWMatchday matchdayObject : this.matchdays) {
if(matchdayObject.getMatchday() == matchday) {
deliveryDate = matchdayObject.getDeliveryDate();
}
}
return deliveryDate;
}
}

View File

@@ -0,0 +1,132 @@
package de.jeyp91.tippliga;
import com.google.common.io.Resources;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import java.io.IOException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
public class TLWTipperPokalMatchesCreator {
int season;
int league;
ArrayList<TLWMatch> TLWMatches;
JSONObject tipperList;
JSONArray tipperTeamConfig;
ArrayList<TLWMatchday> matchdays;
public TLWTipperPokalMatchesCreator(int season, int league, String configFileName, ArrayList<TLWMatchday> matchdays) {
this.season = season;
this.league = league;
this.matchdays = matchdays;
URL tipperListUrl = Resources.getResource(season + "\\" + configFileName);
URL tipperTeamConfigUrl = Resources.getResource("Tipper_Team_Config.json");
this.TLWMatches = new ArrayList<>();
try {
JSONParser jsonParser = new JSONParser();
String tipperListString = Resources.toString(tipperListUrl, StandardCharsets.UTF_8);
this.tipperList = (JSONObject) jsonParser.parse(tipperListString);
String tipperTeamConfigString = Resources.toString(tipperTeamConfigUrl, StandardCharsets.UTF_8);
this.tipperTeamConfig = (JSONArray) jsonParser.parse(tipperTeamConfigString);
} catch (IOException | ParseException e) {
e.printStackTrace();
}
this.publicateMatchObjects();
}
private void publicateMatchObjects() {
int matchday = 1;
for(int i = 1; i < 13; i++) {
String homeName = this.tipperList.get(String.valueOf(2 * i - 1)).toString();
String guestName = this.tipperList.get(String.valueOf(2 * i)).toString();
int teamIdHome = getTeamIdFromTipperName(homeName);
int teamIdGuest = getTeamIdFromTipperName(guestName);
int matchNo = i;
String matchDatetime = getDeliveryDateForMatchday(matchday);
TLWMatch tlwMatch = new TLWMatch(this.season, this.league, matchday, matchNo, teamIdHome, teamIdGuest, matchDatetime);
this.TLWMatches.add(tlwMatch);
}
}
private int getTeamIdFromTipperName(String name) {
int teamId = 0;
for(Object config : tipperTeamConfig) {
if (((JSONObject) config).get("team_name").toString().equals(name)) {
teamId = ((Long) (((JSONObject) config).get("team_id"))).intValue();
}
}
if(teamId == 0) {
System.out.println("Did not find Tipper ID for " + name);
}
return teamId;
}
public ArrayList<TLWMatch> getMatches() {
return this.TLWMatches;
}
public String getSQLInsertString() {
String sql = "";
ArrayList<TLWMatch> tlwMatches = getMatches();
// Add matches from config
for(TLWMatch match : tlwMatches) {
String matchSql = "REPLACE INTO phpbb_footb_matches VALUES(";
matchSql += match.getSeason().toString();
matchSql += ", ";
matchSql += match.getLeague().toString();
matchSql += ", ";
matchSql += match.getMatchNo().toString();
matchSql += ", ";
matchSql += match.getTeamIdHome().toString();
matchSql += ", ";
matchSql += match.getTeamIdGuest().toString();
// No goals while creating league
matchSql += ", '', '', ";
matchSql += match.getMatchday().toString();
// status 0 while creating
matchSql += ", 0, '";
matchSql += match.getMatchDateTime();
// group_id, formula_home, formula_guest, ko_match, goals_overtime_home, goals_overtime_guest
matchSql += "', '', '', '', 0, '', '', ";
// show_table
matchSql += "0";
// trend, odd_1, odd_x, odd_2, rating
matchSql += ", '', '0.00', '0.00', '0.00', '0.00');\n";
sql += matchSql;
}
return sql;
}
private String getDeliveryDateForMatchday(int matchday) {
String deliveryDate = "";
for (TLWMatchday matchdayObject : this.matchdays) {
if(matchdayObject.getMatchday() == matchday) {
deliveryDate = matchdayObject.getDeliveryDate();
}
}
return deliveryDate;
}
}

View File

@@ -0,0 +1,99 @@
package de.jeyp91.tippliga;
import de.jeyp91.tippliga.TLWMatch;
import de.jeyp91.tippliga.TLWTeam;
import java.util.ArrayList;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class TippligaSQLConnector {
Connection con;
static {
try {
Class.forName("com.mysql.cj.jdbc.Driver");
} catch (ClassNotFoundException ex) {
System.err.println("Unable to load MySQL Driver");
}
}
public TippligaSQLConnector() {
String jdbcUrl = "jdbc:mysql://localhost/d0144ddb?user=root&password=&useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC";
try {
con = DriverManager.getConnection(jdbcUrl);
} catch (SQLException e) {
/* TODO */
e.printStackTrace();
}
}
public ArrayList<TLWTeam> getTeamsBySeasonAndLeague(String season, String league) {
String queryString = "SELECT * FROM `phpbb_footb_teams` WHERE `season` = " + season + " AND `league` = " + league + ";";
Statement stmt = null;
ResultSet rset = null;
ArrayList<TLWTeam> teams = new ArrayList<TLWTeam>();
try {
stmt = con.createStatement();
rset = stmt.executeQuery(queryString);
while ( rset.next()) {
teams.add(new TLWTeam(rset));
}
} catch (SQLException e) {
/* TODO */
e.printStackTrace();
}
teams.sort((t1, t2) -> t1.getTeamId() - t2.getTeamId());
return teams;
}
public ArrayList<TLWTeam> getTeamsById(String id) {
String queryString = "SELECT * FROM `phpbb_footb_teams` WHERE `team_id` = " + id + ";";
Statement stmt = null;
ResultSet rset = null;
ArrayList<TLWTeam> teams = new ArrayList<TLWTeam>();
try {
stmt = con.createStatement();
rset = stmt.executeQuery(queryString);
while ( rset.next()) {
teams.add(new TLWTeam(rset));
}
} catch (SQLException e) {
/* TODO */
e.printStackTrace();
}
return teams;
}
public ArrayList<TLWMatch> getMatchesBySeasonAndLeague(String season, String league) {
String queryString = "SELECT * FROM `phpbb_footb_matches` WHERE `season` = " + season + " AND `league` = " + league + ";";
Statement stmt = null;
ResultSet rset = null;
ArrayList<TLWMatch> matches = new ArrayList<TLWMatch>();
try {
stmt = con.createStatement();
rset = stmt.executeQuery(queryString);
while (rset.next()) {
matches.add(new TLWMatch(rset));
}
} catch (SQLException throwables) {
throwables.printStackTrace();
}
return matches;
}
public void updateMatchDateTime(String season, String league, String matchNo, String datetime) {
String queryString = "UPDATE `phpbb_footb_matches` "
+ "SET match_datetime = " + datetime
+ " WHERE `season` = " + season
+ " AND `league` = " + league
+ " AND match_no = " + matchNo + ";";
}
}

View File

@@ -0,0 +1,16 @@
{
"1": "Stefan",
"2": "Sascha",
"3": "Werner",
"4": "Jimmy",
"5": "Patrick",
"6": "Kay",
"7": "Nicole (TG Rhön)",
"8": "Flo",
"9": "Demian",
"10": "Julian",
"11": "Hilde",
"12": "Lukas",
"13": "Tristan",
"14": "Martin"
}

View File

@@ -0,0 +1,16 @@
{
"1": "Maxi Z.",
"2": "Olli L.",
"3": "Friedrich",
"4": "Oliver",
"5": "Arno",
"6": "Michael",
"7": "Matthias",
"8": "TG Nürnberg",
"9": "Max",
"10": "Armin",
"11": "Marcel",
"12": "Bastian",
"13": "Philipp",
"14": "Marcel U."
}

View File

@@ -0,0 +1,207 @@
{
"numberOfMatchdays": 39,
"matchesPerMatchday": 12,
"pointMode": 4,
"pointsTendency": 1,
"pointsDifference": 2,
"pointsDirectHit": 3,
"matchdayConfig": [
{
"TLWMatchday": 1,
"matchesLeague": "bl2",
"leagueMatchday": 1
},
{
"TLWMatchday": 2,
"matchesLeague": "bl2",
"leagueMatchday": 2
},
{
"TLWMatchday": 3,
"matchesLeague": "bl1",
"leagueMatchday": 1
},
{
"TLWMatchday": 4,
"matchesLeague": "bl1",
"leagueMatchday": 2
},
{
"TLWMatchday": 5,
"matchesLeague": "bl1",
"leagueMatchday": 3
},
{
"TLWMatchday": 6,
"matchesLeague": "bl1",
"leagueMatchday": 4
},
{
"TLWMatchday": 7,
"matchesLeague": "bl1",
"leagueMatchday": 5
},
{
"TLWMatchday": 8,
"matchesLeague": "bl1",
"leagueMatchday": 6
},
{
"TLWMatchday": 9,
"matchesLeague": "bl1",
"leagueMatchday": 7
},
{
"TLWMatchday": 10,
"matchesLeague": "bl1",
"leagueMatchday": 8
},
{
"TLWMatchday": 11,
"matchesLeague": "bl1",
"leagueMatchday": 9
},
{
"TLWMatchday": 12,
"matchesLeague": "bl1",
"leagueMatchday": 10
},
{
"TLWMatchday": 13,
"matchesLeague": "bl1",
"leagueMatchday": 11
},
{
"TLWMatchday": 14,
"matchesLeague": "bl1",
"leagueMatchday": 12
},
{
"TLWMatchday": 15,
"matchesLeague": "bl1",
"leagueMatchday": 13
},
{
"TLWMatchday": 16,
"matchesLeague": "bl1",
"leagueMatchday": 14
},
{
"TLWMatchday": 17,
"matchesLeague": "bl1",
"leagueMatchday": 15
},
{
"TLWMatchday": 18,
"matchesLeague": "bl1",
"leagueMatchday": 16
},
{
"TLWMatchday": 19,
"matchesLeague": "bl1",
"leagueMatchday": 17
},
{
"TLWMatchday": 20,
"matchesLeague": "bl1",
"leagueMatchday": 18
},
{
"TLWMatchday": 21,
"matchesLeague": "bl1",
"leagueMatchday": 19
},
{
"TLWMatchday": 22,
"matchesLeague": "bl2",
"leagueMatchday": 19
},
{
"TLWMatchday": 23,
"matchesLeague": "bl1",
"leagueMatchday": 20
},
{
"TLWMatchday": 24,
"matchesLeague": "bl1",
"leagueMatchday": 21
},
{
"TLWMatchday": 25,
"matchesLeague": "bl1",
"leagueMatchday": 22
},
{
"TLWMatchday": 26,
"matchesLeague": "bl1",
"leagueMatchday": 23
},
{
"TLWMatchday": 27,
"matchesLeague": "bl1",
"leagueMatchday": 24
},
{
"TLWMatchday": 28,
"matchesLeague": "bl1",
"leagueMatchday": 25
},
{
"TLWMatchday": 29,
"matchesLeague": "bl1",
"leagueMatchday": 26
},
{
"TLWMatchday": 30,
"matchesLeague": "bl1",
"leagueMatchday": 27
},
{
"TLWMatchday": 31,
"matchesLeague": "bl1",
"leagueMatchday": 28
},
{
"TLWMatchday": 32,
"matchesLeague": "bl1",
"leagueMatchday": 29
},
{
"TLWMatchday": 33,
"matchesLeague": "bl1",
"leagueMatchday": 30
},
{
"TLWMatchday": 34,
"matchesLeague": "bl1",
"leagueMatchday": 31
},
{
"TLWMatchday": 35,
"matchesLeague": "bl1",
"leagueMatchday": 32
},
{
"TLWMatchday": 36,
"matchesLeague": "bl2",
"leagueMatchday": 33
},
{
"TLWMatchday": 37,
"matchesLeague": "bl1",
"leagueMatchday": 33
},
{
"TLWMatchday": 38,
"matchesLeague": "bl2",
"leagueMatchday": 34
},
{
"TLWMatchday": 39,
"matchesLeague": "bl1",
"leagueMatchday": 34
}
]
}

View File

@@ -0,0 +1,26 @@
{
"1": "Bastian",
"2": "Lukas",
"3": "Jimmy",
"4": "Marcel U.",
"5": "Tristan",
"6": "Demian",
"7": "Michael",
"8": "Sascha",
"9": "Friedrich",
"10": "Werner",
"11": "Hilde",
"12": "Julian",
"13": "Martin",
"14": "Max",
"15": "Arno",
"16": "Flo",
"17": "Olli L.",
"18": "Patrick",
"19": "Matthias",
"20": "Philipp",
"21": "Armin",
"22": "Marcel",
"23": "TG Nürnberg",
"24": "Maxi Z."
}

View File

@@ -0,0 +1,331 @@
{
"api": {
"results": 12,
"leagues": [
{
"league_id": 583,
"name": "DFB Pokal",
"type": "Cup",
"country": "Germany",
"country_code": "DE",
"season": 2019,
"season_start": "2019-08-09",
"season_end": "2020-07-04",
"logo": "https:\/\/media.api-sports.io\/football\/leagues\/81.png",
"flag": "https:\/\/media.api-sports.io\/flags\/de.svg",
"standings": 0,
"is_current": 0,
"coverage": {
"standings": false,
"fixtures": {
"events": true,
"lineups": true,
"statistics": true,
"players_statistics": true
},
"players": true,
"topScorers": true,
"predictions": true,
"odds": true
}
},
{
"league_id": 753,
"name": "Liga 3",
"type": "League",
"country": "Germany",
"country_code": "DE",
"season": 2019,
"season_start": "2019-07-19",
"season_end": "2020-07-04",
"logo": "https:\/\/media.api-sports.io\/football\/leagues\/80.png",
"flag": "https:\/\/media.api-sports.io\/flags\/de.svg",
"standings": 1,
"is_current": 0,
"coverage": {
"standings": true,
"fixtures": {
"events": true,
"lineups": true,
"statistics": true,
"players_statistics": false
},
"players": true,
"topScorers": true,
"predictions": true,
"odds": true
}
},
{
"league_id": 754,
"name": "Bundesliga 1",
"type": "League",
"country": "Germany",
"country_code": "DE",
"season": 2019,
"season_start": "2019-08-16",
"season_end": "2020-07-06",
"logo": "https:\/\/media.api-sports.io\/football\/leagues\/78.png",
"flag": "https:\/\/media.api-sports.io\/flags\/de.svg",
"standings": 1,
"is_current": 0,
"coverage": {
"standings": true,
"fixtures": {
"events": true,
"lineups": true,
"statistics": true,
"players_statistics": true
},
"players": true,
"topScorers": true,
"predictions": true,
"odds": true
}
},
{
"league_id": 755,
"name": "Bundesliga 2",
"type": "League",
"country": "Germany",
"country_code": "DE",
"season": 2019,
"season_start": "2019-07-26",
"season_end": "2020-07-11",
"logo": "https:\/\/media.api-sports.io\/football\/leagues\/79.png",
"flag": "https:\/\/media.api-sports.io\/flags\/de.svg",
"standings": 1,
"is_current": 0,
"coverage": {
"standings": true,
"fixtures": {
"events": true,
"lineups": true,
"statistics": true,
"players_statistics": true
},
"players": true,
"topScorers": true,
"predictions": true,
"odds": true
}
},
{
"league_id": 771,
"name": "Women Bundesliga",
"type": "League",
"country": "Germany",
"country_code": "DE",
"season": 2019,
"season_start": "2019-08-16",
"season_end": "2020-06-28",
"logo": "https:\/\/media.api-sports.io\/football\/leagues\/82.png",
"flag": "https:\/\/media.api-sports.io\/flags\/de.svg",
"standings": 0,
"is_current": 0,
"coverage": {
"standings": false,
"fixtures": {
"events": true,
"lineups": true,
"statistics": false,
"players_statistics": false
},
"players": false,
"topScorers": false,
"predictions": true,
"odds": true
}
},
{
"league_id": 1240,
"name": "Regionalliga - Bayern",
"type": "League",
"country": "Germany",
"country_code": "DE",
"season": 2019,
"season_start": "2019-07-11",
"season_end": "2020-05-23",
"logo": "https:\/\/media.api-sports.io\/football\/leagues\/83.png",
"flag": "https:\/\/media.api-sports.io\/flags\/de.svg",
"standings": 1,
"is_current": 1,
"coverage": {
"standings": true,
"fixtures": {
"events": true,
"lineups": true,
"statistics": false,
"players_statistics": false
},
"players": true,
"topScorers": true,
"predictions": true,
"odds": false
}
},
{
"league_id": 1241,
"name": "Regionalliga - Nord",
"type": "League",
"country": "Germany",
"country_code": "DE",
"season": 2019,
"season_start": "2019-07-26",
"season_end": "2020-05-17",
"logo": "https:\/\/media.api-sports.io\/football\/leagues\/84.png",
"flag": "https:\/\/media.api-sports.io\/flags\/de.svg",
"standings": 1,
"is_current": 0,
"coverage": {
"standings": true,
"fixtures": {
"events": true,
"lineups": true,
"statistics": false,
"players_statistics": false
},
"players": true,
"topScorers": true,
"predictions": true,
"odds": false
}
},
{
"league_id": 1242,
"name": "Regionalliga - Nordost",
"type": "League",
"country": "Germany",
"country_code": "DE",
"season": 2019,
"season_start": "2019-07-26",
"season_end": "2020-05-16",
"logo": "https:\/\/media.api-sports.io\/football\/leagues\/85.png",
"flag": "https:\/\/media.api-sports.io\/flags\/de.svg",
"standings": 1,
"is_current": 0,
"coverage": {
"standings": true,
"fixtures": {
"events": true,
"lineups": true,
"statistics": false,
"players_statistics": false
},
"players": true,
"topScorers": true,
"predictions": true,
"odds": false
}
},
{
"league_id": 1243,
"name": "Regionalliga - SudWest",
"type": "League",
"country": "Germany",
"country_code": "DE",
"season": 2019,
"season_start": "2019-07-26",
"season_end": "2020-05-16",
"logo": "https:\/\/media.api-sports.io\/football\/leagues\/86.png",
"flag": "https:\/\/media.api-sports.io\/flags\/de.svg",
"standings": 1,
"is_current": 0,
"coverage": {
"standings": true,
"fixtures": {
"events": true,
"lineups": true,
"statistics": false,
"players_statistics": false
},
"players": true,
"topScorers": true,
"predictions": true,
"odds": false
}
},
{
"league_id": 1244,
"name": "Regionalliga - West",
"type": "League",
"country": "Germany",
"country_code": "DE",
"season": 2019,
"season_start": "2019-07-26",
"season_end": "2020-05-16",
"logo": "https:\/\/media.api-sports.io\/football\/leagues\/87.png",
"flag": "https:\/\/media.api-sports.io\/flags\/de.svg",
"standings": 1,
"is_current": 0,
"coverage": {
"standings": true,
"fixtures": {
"events": true,
"lineups": true,
"statistics": false,
"players_statistics": false
},
"players": true,
"topScorers": true,
"predictions": true,
"odds": false
}
},
{
"league_id": 1405,
"name": "U19 Bundesliga",
"type": "League",
"country": "Germany",
"country_code": "DE",
"season": 2019,
"season_start": "2019-08-10",
"season_end": "2020-05-09",
"logo": "https:\/\/media.api-sports.io\/football\/leagues\/488.png",
"flag": "https:\/\/media.api-sports.io\/flags\/de.svg",
"standings": 1,
"is_current": 0,
"coverage": {
"standings": true,
"fixtures": {
"events": true,
"lineups": true,
"statistics": false,
"players_statistics": false
},
"players": false,
"topScorers": false,
"predictions": true,
"odds": false
}
},
{
"league_id": 1564,
"name": "Super Cup",
"type": "Cup",
"country": "Germany",
"country_code": "DE",
"season": 2019,
"season_start": "2019-08-03",
"season_end": "2019-08-03",
"logo": "https:\/\/media.api-sports.io\/football\/leagues\/529.png",
"flag": "https:\/\/media.api-sports.io\/flags\/de.svg",
"standings": 0,
"is_current": 0,
"coverage": {
"standings": false,
"fixtures": {
"events": true,
"lineups": true,
"statistics": true,
"players_statistics": true
},
"players": false,
"topScorers": false,
"predictions": true,
"odds": false
}
}
]
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,13 @@
{
"api": {
"results": 6,
"fixtures": [
"1st_Round",
"2nd_Round",
"3rd_Round",
"Quarter-finals",
"Semi-finals",
"Final"
]
}
}

View File

@@ -0,0 +1,16 @@
{
"1": "Michael",
"2": "Hilde",
"3": "Werner",
"4": "Kay",
"5": "Martin",
"6": "Flo",
"7": "Patrick",
"8": "Matthias",
"9": "Tristan",
"10": "Jimmy",
"11": "Nicole (TG Rhön)",
"12": "Julian",
"13": "Lukas",
"14": "Sascha"
}

View File

@@ -0,0 +1,16 @@
{
"1": "Maxi Z.",
"2": "Marcel",
"3": "Olli L.",
"4": "Armin",
"5": "TG Nürnberg",
"6": "Arno",
"7": "Marcel U.",
"8": "Philipp",
"9": "Max",
"10": "Bastian",
"11": "Friedrich",
"12": "Demian",
"13": "Stefan",
"14": "Oliver"
}

View File

@@ -0,0 +1,304 @@
{
"api": {
"results": 11,
"leagues": [
{
"league_id": 2677,
"name": "DFB Pokal",
"type": "Cup",
"country": "Germany",
"country_code": "DE",
"season": 2020,
"season_start": "2020-09-11",
"season_end": "2020-10-15",
"logo": "https:\/\/media.api-sports.io\/football\/leagues\/81.png",
"flag": "https:\/\/media.api-sports.io\/flags\/de.svg",
"standings": 0,
"is_current": 1,
"coverage": {
"standings": false,
"fixtures": {
"events": false,
"lineups": false,
"statistics": false,
"players_statistics": false
},
"players": true,
"topScorers": true,
"predictions": true,
"odds": true
}
},
{
"league_id": 2681,
"name": "Women Bundesliga",
"type": "League",
"country": "Germany",
"country_code": "DE",
"season": 2020,
"season_start": "2020-09-04",
"season_end": "2021-06-13",
"logo": "https:\/\/media.api-sports.io\/football\/leagues\/82.png",
"flag": "https:\/\/media.api-sports.io\/flags\/de.svg",
"standings": 0,
"is_current": 1,
"coverage": {
"standings": false,
"fixtures": {
"events": true,
"lineups": false,
"statistics": false,
"players_statistics": false
},
"players": false,
"topScorers": false,
"predictions": true,
"odds": true
}
},
{
"league_id": 2692,
"name": "U19 Bundesliga",
"type": "League",
"country": "Germany",
"country_code": "DE",
"season": 2020,
"season_start": "2020-09-20",
"season_end": "2021-04-17",
"logo": "https:\/\/media.api-sports.io\/football\/leagues\/488.png",
"flag": "https:\/\/media.api-sports.io\/flags\/de.svg",
"standings": 1,
"is_current": 1,
"coverage": {
"standings": true,
"fixtures": {
"events": false,
"lineups": false,
"statistics": false,
"players_statistics": false
},
"players": false,
"topScorers": false,
"predictions": true,
"odds": false
}
},
{
"league_id": 2738,
"name": "Regionalliga - West",
"type": "League",
"country": "Germany",
"country_code": "DE",
"season": 2020,
"season_start": "2020-09-04",
"season_end": "2021-06-05",
"logo": "https:\/\/media.api-sports.io\/football\/leagues\/87.png",
"flag": "https:\/\/media.api-sports.io\/flags\/de.svg",
"standings": 1,
"is_current": 1,
"coverage": {
"standings": true,
"fixtures": {
"events": true,
"lineups": false,
"statistics": false,
"players_statistics": false
},
"players": true,
"topScorers": true,
"predictions": true,
"odds": true
}
},
{
"league_id": 2743,
"name": "Bundesliga 2",
"type": "League",
"country": "Germany",
"country_code": "DE",
"season": 2020,
"season_start": "2020-09-18",
"season_end": "2021-05-23",
"logo": "https:\/\/media.api-sports.io\/football\/leagues\/79.png",
"flag": "https:\/\/media.api-sports.io\/flags\/de.svg",
"standings": 0,
"is_current": 1,
"coverage": {
"standings": false,
"fixtures": {
"events": false,
"lineups": false,
"statistics": false,
"players_statistics": false
},
"players": true,
"topScorers": true,
"predictions": true,
"odds": false
}
},
{
"league_id": 2751,
"name": "Super Cup",
"type": "Cup",
"country": "Germany",
"country_code": "DE",
"season": 2020,
"season_start": "2020-09-30",
"season_end": "2020-09-30",
"logo": "https:\/\/media.api-sports.io\/football\/leagues\/529.png",
"flag": "https:\/\/media.api-sports.io\/flags\/de.svg",
"standings": 0,
"is_current": 1,
"coverage": {
"standings": false,
"fixtures": {
"events": false,
"lineups": false,
"statistics": false,
"players_statistics": false
},
"players": false,
"topScorers": false,
"predictions": true,
"odds": false
}
},
{
"league_id": 2755,
"name": "Bundesliga 1",
"type": "League",
"country": "Germany",
"country_code": "DE",
"season": 2020,
"season_start": "2020-09-19",
"season_end": "2021-05-22",
"logo": "https:\/\/media.api-sports.io\/football\/leagues\/78.png",
"flag": "https:\/\/media.api-sports.io\/flags\/de.svg",
"standings": 1,
"is_current": 1,
"coverage": {
"standings": true,
"fixtures": {
"events": false,
"lineups": false,
"statistics": false,
"players_statistics": false
},
"players": true,
"topScorers": true,
"predictions": true,
"odds": false
}
},
{
"league_id": 2795,
"name": "Liga 3",
"type": "League",
"country": "Germany",
"country_code": "DE",
"season": 2020,
"season_start": "2020-09-18",
"season_end": "2021-05-22",
"logo": "https:\/\/media.api-sports.io\/football\/leagues\/80.png",
"flag": "https:\/\/media.api-sports.io\/flags\/de.svg",
"standings": 0,
"is_current": 1,
"coverage": {
"standings": false,
"fixtures": {
"events": false,
"lineups": false,
"statistics": false,
"players_statistics": false
},
"players": true,
"topScorers": true,
"predictions": true,
"odds": false
}
},
{
"league_id": 2821,
"name": "Regionalliga - Nord",
"type": "League",
"country": "Germany",
"country_code": "DE",
"season": 2020,
"season_start": "2020-09-04",
"season_end": "2021-01-31",
"logo": "https:\/\/media.api-sports.io\/football\/leagues\/84.png",
"flag": "https:\/\/media.api-sports.io\/flags\/de.svg",
"standings": 1,
"is_current": 1,
"coverage": {
"standings": true,
"fixtures": {
"events": true,
"lineups": false,
"statistics": false,
"players_statistics": false
},
"players": true,
"topScorers": true,
"predictions": true,
"odds": true
}
},
{
"league_id": 2822,
"name": "Regionalliga - Nordost",
"type": "League",
"country": "Germany",
"country_code": "DE",
"season": 2020,
"season_start": "2020-08-15",
"season_end": "2021-06-13",
"logo": "https:\/\/media.api-sports.io\/football\/leagues\/85.png",
"flag": "https:\/\/media.api-sports.io\/flags\/de.svg",
"standings": 1,
"is_current": 1,
"coverage": {
"standings": true,
"fixtures": {
"events": true,
"lineups": true,
"statistics": false,
"players_statistics": false
},
"players": true,
"topScorers": true,
"predictions": true,
"odds": true
}
},
{
"league_id": 2823,
"name": "Regionalliga - SudWest",
"type": "League",
"country": "Germany",
"country_code": "DE",
"season": 2020,
"season_start": "2020-09-01",
"season_end": "2021-06-12",
"logo": "https:\/\/media.api-sports.io\/football\/leagues\/86.png",
"flag": "https:\/\/media.api-sports.io\/flags\/de.svg",
"standings": 1,
"is_current": 1,
"coverage": {
"standings": true,
"fixtures": {
"events": true,
"lineups": true,
"statistics": false,
"players_statistics": false
},
"players": true,
"topScorers": true,
"predictions": true,
"odds": true
}
}
]
}
}

View File

@@ -0,0 +1,259 @@
{
"api": {
"results": 18,
"teams": [
{
"team_id": 157,
"name": "Bayern Munich",
"code": null,
"logo": "https:\/\/media.api-sports.io\/football\/teams\/157.png",
"country": "Germany",
"is_national": false,
"founded": 1900,
"venue_name": "Allianz Arena",
"venue_surface": "grass",
"venue_address": "Werner-Heisenberg-Allee 25",
"venue_city": "München",
"venue_capacity": 75000
},
{
"team_id": 174,
"name": "FC Schalke 04",
"code": null,
"logo": "https:\/\/media.api-sports.io\/football\/teams\/174.png",
"country": "Germany",
"is_national": false,
"founded": 1904,
"venue_name": "VELTINS-Arena",
"venue_surface": "grass",
"venue_address": "Arenaring 1",
"venue_city": "Gelsenkirchen",
"venue_capacity": 62271
},
{
"team_id": 165,
"name": "Borussia Dortmund",
"code": null,
"logo": "https:\/\/media.api-sports.io\/football\/teams\/165.png",
"country": "Germany",
"is_national": false,
"founded": 1909,
"venue_name": "Signal-Iduna-Park",
"venue_surface": "grass",
"venue_address": "Strobelalle 50",
"venue_city": "Dortmund",
"venue_capacity": 81365
},
{
"team_id": 163,
"name": "Borussia Monchengladbach",
"code": null,
"logo": "https:\/\/media.api-sports.io\/football\/teams\/163.png",
"country": "Germany",
"is_national": false,
"founded": 1900,
"venue_name": "Stadion im BORUSSIA-PARK",
"venue_surface": "grass",
"venue_address": "Hennes-Weisweiler-Allee 1",
"venue_city": "Mönchengladbach",
"venue_capacity": 54057
},
{
"team_id": 173,
"name": "RB Leipzig",
"code": null,
"logo": "https:\/\/media.api-sports.io\/football\/teams\/173.png",
"country": "Germany",
"is_national": false,
"founded": 2009,
"venue_name": "Red Bull Arena",
"venue_surface": "grass",
"venue_address": "Am Sportforum 3",
"venue_city": "Leipzig",
"venue_capacity": 44345
},
{
"team_id": 164,
"name": "FSV Mainz 05",
"code": null,
"logo": "https:\/\/media.api-sports.io\/football\/teams\/164.png",
"country": "Germany",
"is_national": false,
"founded": 1905,
"venue_name": "OPEL ARENA",
"venue_surface": "grass",
"venue_address": "Eugen-Salomon-Straße 1",
"venue_city": "Mainz",
"venue_capacity": 34034
},
{
"team_id": 161,
"name": "VfL Wolfsburg",
"code": null,
"logo": "https:\/\/media.api-sports.io\/football\/teams\/161.png",
"country": "Germany",
"is_national": false,
"founded": 1945,
"venue_name": "VOLKSWAGEN ARENA",
"venue_surface": "grass",
"venue_address": "In den Allerwiesen 1",
"venue_city": "Wolfsburg",
"venue_capacity": 30000
},
{
"team_id": 168,
"name": "Bayer Leverkusen",
"code": null,
"logo": "https:\/\/media.api-sports.io\/football\/teams\/168.png",
"country": "Germany",
"is_national": false,
"founded": 1904,
"venue_name": "BayArena",
"venue_surface": "grass",
"venue_address": "Bismarckstr. 122-124",
"venue_city": "Leverkusen",
"venue_capacity": 30210
},
{
"team_id": 169,
"name": "Eintracht Frankfurt",
"code": null,
"logo": "https:\/\/media.api-sports.io\/football\/teams\/169.png",
"country": "Germany",
"is_national": false,
"founded": 1899,
"venue_name": "Deutsche Bank Park",
"venue_surface": "grass",
"venue_address": "Mörfelder Landstr. 362",
"venue_city": "Frankfurt am Main",
"venue_capacity": 52300
},
{
"team_id": 188,
"name": "Arminia Bielefeld",
"code": null,
"logo": "https:\/\/media.api-sports.io\/football\/teams\/188.png",
"country": "Germany",
"is_national": false,
"founded": 1905,
"venue_name": "SchücoArena",
"venue_surface": "grass",
"venue_address": "Melanchthonstr. 31a",
"venue_city": "Bielefeld",
"venue_capacity": 27300
},
{
"team_id": 182,
"name": "Union Berlin",
"code": null,
"logo": "https:\/\/media.api-sports.io\/football\/teams\/182.png",
"country": "Germany",
"is_national": false,
"founded": 1966,
"venue_name": "Stadion An der Alten Försterei",
"venue_surface": "grass",
"venue_address": "Hämmerlingstraße 80-88, Köpenick",
"venue_city": "Berlin",
"venue_capacity": 22467
},
{
"team_id": 170,
"name": "FC Augsburg",
"code": null,
"logo": "https:\/\/media.api-sports.io\/football\/teams\/170.png",
"country": "Germany",
"is_national": false,
"founded": 1907,
"venue_name": "WWK Arena",
"venue_surface": "grass",
"venue_address": "Bürgermeister Ulrich-Straße 90",
"venue_city": "Augsburg",
"venue_capacity": 30662
},
{
"team_id": 192,
"name": "FC Koln",
"code": null,
"logo": "https:\/\/media.api-sports.io\/football\/teams\/192.png",
"country": "Germany",
"is_national": false,
"founded": 1948,
"venue_name": "RheinEnergieStadion",
"venue_surface": "grass",
"venue_address": "Aachener Str. 999",
"venue_city": "Köln",
"venue_capacity": 50076
},
{
"team_id": 167,
"name": "1899 Hoffenheim",
"code": null,
"logo": "https:\/\/media.api-sports.io\/football\/teams\/167.png",
"country": "Germany",
"is_national": false,
"founded": 1899,
"venue_name": "PreZero Arena",
"venue_surface": "grass",
"venue_address": "Dietmar-Hopp-Straße 1",
"venue_city": "Sinsheim",
"venue_capacity": 30164
},
{
"team_id": 162,
"name": "Werder Bremen",
"code": null,
"logo": "https:\/\/media.api-sports.io\/football\/teams\/162.png",
"country": "Germany",
"is_national": false,
"founded": 1899,
"venue_name": "wohninvest WESERSTADION",
"venue_surface": "grass",
"venue_address": "Franz-Böhmert-Straße 1c",
"venue_city": "Bremen",
"venue_capacity": 42358
},
{
"team_id": 159,
"name": "Hertha Berlin",
"code": null,
"logo": "https:\/\/media.api-sports.io\/football\/teams\/159.png",
"country": "Germany",
"is_national": false,
"founded": 1892,
"venue_name": "Olympiastadion Berlin",
"venue_surface": "grass",
"venue_address": "Olympischer Platz 3",
"venue_city": "Berlin",
"venue_capacity": 77116
},
{
"team_id": 172,
"name": "VfB Stuttgart",
"code": null,
"logo": "https:\/\/media.api-sports.io\/football\/teams\/172.png",
"country": "Germany",
"is_national": false,
"founded": 1893,
"venue_name": "Mercedes-Benz-Arena",
"venue_surface": "grass",
"venue_address": "Mercedesstrasse 87",
"venue_city": "Stuttgart",
"venue_capacity": 60469
},
{
"team_id": 160,
"name": "SC Freiburg",
"code": null,
"logo": "https:\/\/media.api-sports.io\/football\/teams\/160.png",
"country": "Germany",
"is_national": false,
"founded": 1904,
"venue_name": "Schwarzwald-Stadion",
"venue_surface": "grass",
"venue_address": "Schwarzwaldstraße 193",
"venue_city": "Freiburg im Breisgau",
"venue_capacity": 25000
}
]
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,8 @@
{
"api": {
"results": 1,
"fixtures": [
"1st_Round"
]
}
}

View File

@@ -0,0 +1,41 @@
{
"api": {
"results": 34,
"fixtures": [
"Regular_Season_-_1",
"Regular_Season_-_2",
"Regular_Season_-_3",
"Regular_Season_-_4",
"Regular_Season_-_5",
"Regular_Season_-_6",
"Regular_Season_-_7",
"Regular_Season_-_8",
"Regular_Season_-_9",
"Regular_Season_-_10",
"Regular_Season_-_11",
"Regular_Season_-_12",
"Regular_Season_-_13",
"Regular_Season_-_14",
"Regular_Season_-_15",
"Regular_Season_-_16",
"Regular_Season_-_17",
"Regular_Season_-_18",
"Regular_Season_-_19",
"Regular_Season_-_20",
"Regular_Season_-_21",
"Regular_Season_-_22",
"Regular_Season_-_23",
"Regular_Season_-_24",
"Regular_Season_-_25",
"Regular_Season_-_26",
"Regular_Season_-_27",
"Regular_Season_-_28",
"Regular_Season_-_29",
"Regular_Season_-_30",
"Regular_Season_-_31",
"Regular_Season_-_32",
"Regular_Season_-_33",
"Regular_Season_-_34"
]
}
}

View File

@@ -0,0 +1,41 @@
{
"api": {
"results": 34,
"fixtures": [
"Regular_Season_-_1",
"Regular_Season_-_2",
"Regular_Season_-_3",
"Regular_Season_-_4",
"Regular_Season_-_5",
"Regular_Season_-_6",
"Regular_Season_-_7",
"Regular_Season_-_8",
"Regular_Season_-_9",
"Regular_Season_-_10",
"Regular_Season_-_11",
"Regular_Season_-_12",
"Regular_Season_-_13",
"Regular_Season_-_14",
"Regular_Season_-_15",
"Regular_Season_-_16",
"Regular_Season_-_17",
"Regular_Season_-_18",
"Regular_Season_-_19",
"Regular_Season_-_20",
"Regular_Season_-_21",
"Regular_Season_-_22",
"Regular_Season_-_23",
"Regular_Season_-_24",
"Regular_Season_-_25",
"Regular_Season_-_26",
"Regular_Season_-_27",
"Regular_Season_-_28",
"Regular_Season_-_29",
"Regular_Season_-_30",
"Regular_Season_-_31",
"Regular_Season_-_32",
"Regular_Season_-_33",
"Regular_Season_-_34"
]
}
}

View File

@@ -0,0 +1,449 @@
{
"numberOfMatchdays": 39,
"matchesPerMatchday": 12,
"pointMode": 4,
"pointsTendency": 1,
"pointsDifference": 2,
"pointsDirectHit": 3,
"ko": 0,
"matchdayConfig": [
{
"TLWMatchday": 1,
"matchesConfig": [
{
"type": "AllMatchesOfMatchday",
"matchesLeague": 2755,
"leagueMatchday": 1
},
{
"type": "SingleMatch",
"matchLeague": 2743,
"matchId": 585064
},
{
"type": "SingleMatch",
"matchLeague": 2743,
"matchId": 585071
},
{
"type": "SingleMatch",
"matchLeague": 2743,
"matchId": 585067
}
]
},
{
"TLWMatchday": 2,
"matchesConfig": [
{
"type": "AllMatchesOfMatchday",
"matchesLeague": 2755,
"leagueMatchday": 2
},
{
"type": "SingleMatch",
"matchLeague": 2743,
"matchId": 585072
},
{
"type": "SingleMatch",
"matchLeague": 2743,
"matchId": 585079
},
{
"type": "SingleMatch",
"matchLeague": 2743,
"matchId": 585073
}
]
},
{
"TLWMatchday": 3,
"matchesConfig": [
{
"type": "AllMatchesOfMatchday",
"matchesLeague": 2755,
"leagueMatchday": 3
},
{
"type": "SingleMatch",
"matchLeague": 2743,
"matchId": 585088
},
{
"type": "SingleMatch",
"matchLeague": 2743,
"matchId": 585089
}
]
},
{
"TLWMatchday": 4,
"matchesConfig": [
{
"type": "AllMatchesOfMatchday",
"matchesLeague": 2755,
"leagueMatchday": 4
},
{
"type": "SingleMatch",
"matchLeague": 2743,
"matchId": 585095
},
{
"type": "SingleMatch",
"matchLeague": 2743,
"matchId": 585098
}
]
},
{
"TLWMatchday": 5,
"matchesConfig": [
{
"type": "AllMatchesOfMatchday",
"matchesLeague": 2755,
"leagueMatchday": 5
}
]
},
{
"TLWMatchday": 6,
"matchesConfig": [
{
"type": "AllMatchesOfMatchday",
"matchesLeague": 2755,
"leagueMatchday": 6
}
]
},
{
"TLWMatchday": 7,
"matchesConfig": [
{
"type": "AllMatchesOfMatchday",
"matchesLeague": 2755,
"leagueMatchday": 7
}
]
},
{
"TLWMatchday": 8,
"matchesConfig": [
{
"type": "AllMatchesOfMatchday",
"matchesLeague": 2755,
"leagueMatchday": 8
}
]
},
{
"TLWMatchday": 9,
"matchesConfig": [
{
"type": "AllMatchesOfMatchday",
"matchesLeague": 2755,
"leagueMatchday": 9
}
]
},
{
"TLWMatchday": 10,
"matchesConfig": [
{
"type": "AllMatchesOfMatchday",
"matchesLeague": 2755,
"leagueMatchday": 10
}
]
},
{
"TLWMatchday": 11,
"matchesConfig": [
{
"type": "AllMatchesOfMatchday",
"matchesLeague": 2755,
"leagueMatchday": 11
}
]
},
{
"TLWMatchday": 12,
"matchesConfig": [
{
"type": "AllMatchesOfMatchday",
"matchesLeague": 2755,
"leagueMatchday": 12
}
]
},
{
"TLWMatchday": 13,
"matchesConfig": [
{
"type": "AllMatchesOfMatchday",
"matchesLeague": 2755,
"leagueMatchday": 13
}
]
},
{
"TLWMatchday": 14,
"matchesConfig": [
{
"type": "AllMatchesOfMatchday",
"matchesLeague": 2755,
"leagueMatchday": 14
}
]
},
{
"TLWMatchday": 15,
"matchesConfig": [
{
"type": "AllMatchesOfMatchday",
"matchesLeague": 2755,
"leagueMatchday": 15
}
]
},
{
"TLWMatchday": 16,
"matchesConfig": [
{
"type": "AllMatchesOfMatchday",
"matchesLeague": 2755,
"leagueMatchday": 16
}
]
},
{
"TLWMatchday": 17,
"matchesConfig": [
{
"type": "AllMatchesOfMatchday",
"matchesLeague": 2755,
"leagueMatchday": 17
}
]
},
{
"TLWMatchday": 18,
"matchesConfig": [
{
"type": "AllMatchesOfMatchday",
"matchesLeague": 2755,
"leagueMatchday": 18
}
]
},
{
"TLWMatchday": 19,
"matchesConfig": [
{
"type": "AllMatchesOfMatchday",
"matchesLeague": 2743,
"leagueMatchday": 18
}
]
},
{
"TLWMatchday": 20,
"matchesConfig": [
{
"type": "AllMatchesOfMatchday",
"matchesLeague": 2755,
"leagueMatchday": 19
}
]
},
{
"TLWMatchday": 21,
"matchesConfig": [
{
"type": "AllMatchesOfMatchday",
"matchesLeague": 2755,
"leagueMatchday": 20
}
]
},
{
"TLWMatchday": 22,
"matchesConfig": [
{
"type": "AllMatchesOfMatchday",
"matchesLeague": 2755,
"leagueMatchday": 21
}
]
},
{
"TLWMatchday": 23,
"matchesConfig": [
{
"type": "AllMatchesOfMatchday",
"matchesLeague": 2755,
"leagueMatchday": 22
}
]
},
{
"TLWMatchday": 24,
"matchesConfig": [
{
"type": "AllMatchesOfMatchday",
"matchesLeague": 2755,
"leagueMatchday": 23
}
]
},
{
"TLWMatchday": 25,
"matchesConfig": [
{
"type": "AllMatchesOfMatchday",
"matchesLeague": 2755,
"leagueMatchday": 24
}
]
},
{
"TLWMatchday": 26,
"matchesConfig": [
{
"type": "AllMatchesOfMatchday",
"matchesLeague": 2755,
"leagueMatchday": 25
}
]
},
{
"TLWMatchday": 27,
"matchesConfig": [
{
"type": "ToBeDefined",
"placeholderDatetime": "2021-03-16 12:00:00"
}
]
},
{
"TLWMatchday": 28,
"matchesConfig": [
{
"type": "AllMatchesOfMatchday",
"matchesLeague": 2755,
"leagueMatchday": 26
}
]
},
{
"TLWMatchday": 29,
"matchesConfig": [
{
"type": "AllMatchesOfMatchday",
"matchesLeague": 2755,
"leagueMatchday": 27
}
]
},
{
"TLWMatchday": 30,
"matchesConfig": [
{
"type": "AllMatchesOfMatchday",
"matchesLeague": 2755,
"leagueMatchday": 28
}
]
},
{
"TLWMatchday": 31,
"matchesConfig": [
{
"type": "ToBeDefined",
"placeholderDatetime": "2021-04-13 12:00:00"
}
]
},
{
"TLWMatchday": 32,
"matchesConfig": [
{
"type": "AllMatchesOfMatchday",
"matchesLeague": 2755,
"leagueMatchday": 29
}
]
},
{
"TLWMatchday": 33,
"matchesConfig": [
{
"type": "AllMatchesOfMatchday",
"matchesLeague": 2755,
"leagueMatchday": 30
}
]
},
{
"TLWMatchday": 34,
"matchesConfig": [
{
"type": "AllMatchesOfMatchday",
"matchesLeague": 2755,
"leagueMatchday": 31
}
]
},
{
"TLWMatchday": 35,
"matchesConfig": [
{
"type": "AllMatchesOfMatchday",
"matchesLeague": 2755,
"leagueMatchday": 32
}
]
},
{
"TLWMatchday": 36,
"matchesConfig": [
{
"type": "AllMatchesOfMatchday",
"matchesLeague": 2755,
"leagueMatchday": 33
}
]
},
{
"TLWMatchday": 37,
"matchesConfig": [
{
"type": "AllMatchesOfMatchday",
"matchesLeague": 2743,
"leagueMatchday": 33
}
]
},
{
"TLWMatchday": 38,
"matchesConfig": [
{
"type": "AllMatchesOfMatchday",
"matchesLeague": 2755,
"leagueMatchday": 34
}
]
},
{
"TLWMatchday": 39,
"matchesConfig": [
{
"type": "AllMatchesOfMatchday",
"matchesLeague": 2743,
"leagueMatchday": 34
}
]
}
]
}

View File

@@ -0,0 +1,67 @@
{
"numberOfMatchdays": 5,
"matchesPerMatchday": 0,
"pointMode": 4,
"pointsTendency": 1,
"pointsDifference": 2,
"pointsDirectHit": 3,
"ko": 1,
"matchdayConfig": [
{
"TLWMatchday": 1,
"matchdayName": "1. Runde",
"numberOfMatches": 32,
"matchesConfig": [
{
"type": "AllMatchesOfMatchday",
"matchesLeague": 2677,
"leagueMatchday": 1
}
]
},
{
"TLWMatchday": 2,
"matchdayName": "Achtelfinale",
"numberOfMatches": 16,
"matchesConfig": [
{
"type": "ToBeDefined",
"placeholderDatetime": "2020-12-22 18:30:00"
}
]
},
{
"TLWMatchday": 3,
"matchdayName": "Viertelfinale",
"numberOfMatches": 8,
"matchesConfig": [
{
"type": "ToBeDefined",
"placeholderDatetime": "2021-02-02 18:30:00"
}
]
},
{
"TLWMatchday": 4,
"matchdayName": "Halbfinale",
"numberOfMatches": 4,
"matchesConfig": [
{
"type": "ToBeDefined",
"placeholderDatetime": "2021-03-02 18:30:00"
}
]
},
{
"TLWMatchday": 5,
"matchdayName": "Finale",
"numberOfMatches": 6,
"matchesConfig": [
{
"type": "ToBeDefined",
"placeholderDatetime": "2021-05-01 20:30:00"
}
]
}
]
}

View File

@@ -0,0 +1,26 @@
{
"1": "Jimmy",
"2": "Werner",
"3": "Lukas",
"4": "Sascha",
"5": "Olli L.",
"6": "Martin",
"7": "Armin",
"8": "Bastian",
"9": "Philipp",
"10": "Maxi Z.",
"11": "Nicole (TG Rhön)",
"12": "Kay",
"13": "Marcel U.",
"14": "Max",
"15": "Marcel",
"16": "Flo",
"17": "Matthias",
"18": "Julian",
"19": "Demian",
"20": "Arno",
"21": "Oliver",
"22": "Patrick",
"23": "Tristan",
"24": "Hilde"
}

View File

@@ -0,0 +1,22 @@
{
"1": {
"id": "825f79shtm9n3uknj99iuu2qho",
"url": "825f79shtm9n3uknj99iuu2qho@group.calendar.google.com"
},
"46": {
"id": "5adq7f0csmpihahran6nqmrhq8",
"url": "5adq7f0csmpihahran6nqmrhq8@group.calendar.google.com"
},
"47": {
"id": "em2778be5ogeu7qkcqembcfti0",
"url": "em2778be5ogeu7qkcqembcfti0@group.calendar.google.com"
},
"48": {
"id": "flmbok3dgujh9de0q2eml3tdcg",
"url": "flmbok3dgujh9de0q2eml3tdcg@group.calendar.google.com"
},
"49": {
"id": "1hled0c9s699ds43hp0ga5gecc",
"url": "1hled0c9s699ds43hp0ga5gecc@group.calendar.google.com"
}
}

View File

@@ -0,0 +1,14 @@
{
"installed":{
"client_id":"326748683996-ftm5p1qoscdm6pbvr1jpplsc3r8nd0sp.apps.googleusercontent.com",
"project_id":"quickstart-1564063275094",
"auth_uri":"https://accounts.google.com/o/oauth2/auth",
"token_uri":"https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs",
"client_secret":"rEn1rOHi_9Juw4HV6eOe5MVp",
"redirect_uris":[
"urn:ietf:wg:oauth:2.0:oob",
"http://localhost"
]
}
}

View File

@@ -0,0 +1,412 @@
[
{
"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
}
]

View File

@@ -0,0 +1,378 @@
[
{
"teamname": "FC Bayern München",
"tippligaID": 1,
"openligaDBID": 40,
"logoFilename": ""
},
{
"teamname": "Hertha BSC Berlin",
"tippligaID": 16,
"openligaDBID": 54
},
{
"teamname": "Borussia Dortmund",
"tippligaID": 12,
"openligaDBID": 7
},
{
"teamname": "FC Augsburg",
"tippligaID": 23,
"openligaDBID": 95
},
{
"teamname": "Bayer Leverkusen",
"tippligaID": 14,
"openligaDBID": 6
},
{
"teamname": "FC Paderborn 07",
"tippligaID": 33,
"openligaDBID": 31
},
{
"teamname": "1. FC Köln",
"tippligaID": 24,
"openligaDBID": 65
},
{
"teamname": "1. FC Union Berlin",
"tippligaID": 66,
"openligaDBID": 80
},
{
"teamname": "1. FSV Mainz",
"tippligaID": 6,
"openligaDBID": 81
},
{
"teamname": "Borussia Mönchengladbach",
"tippligaID": 2,
"openligaDBID": 87
},
{
"teamname": "Eintracht Frankfurt",
"tippligaID": 13,
"openligaDBID": 91
},
{
"teamname": "FC Schalke 04",
"tippligaID": 9,
"openligaDBID": 9
},
{
"teamname": "Fortuna Düsseldorf",
"tippligaID": 89,
"openligaDBID": 185
},
{
"teamname": "RB Leipzig",
"tippligaID": 110,
"openligaDBID": 1635
},
{
"teamname": "SC Freiburg",
"tippligaID": 28,
"openligaDBID": 112
},
{
"teamname": "TSG 1899 Hoffenheim",
"tippligaID": 47,
"openligaDBID": 123
},
{
"teamname": "Vfl Wolfsburg",
"tippligaID": 11,
"openligaDBID": 131
},
{
"teamname": "Werder Bremen",
"tippligaID": 17,
"openligaDBID": 134
},
{
"teamname": "1. FC Nürnberg",
"tippligaID": 4,
"openligaDBID": 79
},
{
"teamname": "Hannover 96",
"tippligaID": 15,
"openligaDBID": 55
},
{
"teamname": "VfB Stuttgart",
"tippligaID": 8,
"openligaDBID": 16
},
{
"teamname": "VfL Osnabrück",
"tippligaID": 42,
"openligaDBID": 36
},
{
"teamname": "Erzgebirge Aue",
"tippligaID": 30,
"openligaDBID": 66
},
{
"teamname": "Carl Zeiss Jena",
"tippligaID": 36,
"openligaDBID": 69
},
{
"teamname": "Eintracht Braunschweig",
"tippligaID": 25,
"openligaDBID": 74
},
{
"teamname": "1. FC Kaiserslautern",
"tippligaID": 19,
"openligaDBID": 76
},
{
"teamname": "1. FC Magdeburg",
"tippligaID": 59,
"openligaDBID": 78
},
{
"teamname": "Arminia Bielefeld",
"tippligaID": 18,
"openligaDBID": 83
},
{
"teamname": "FC St. Pauli",
"tippligaID": 49,
"openligaDBID": 98
},
{
"teamname": "Hamburger SV",
"tippligaID": 3,
"openligaDBID": 100
},
{
"teamname": "Hansa Rostock",
"tippligaID": 21,
"openligaDBID": 102
},
{
"teamname": "Holstein Kiel",
"tippligaID": 63,
"openligaDBID": 104
},
{
"teamname": "Karlsruher SC",
"tippligaID": 26,
"openligaDBID": 105
},
{
"teamname": "MSV Duisburg",
"tippligaID": 31,
"openligaDBID": 107
},
{
"teamname": "SpVgg Greuther Fürth",
"tippligaID": 27,
"openligaDBID": 115
},
{
"teamname": "SpVgg Unterhaching",
"tippligaID": 29,
"openligaDBID": 116
},
{
"teamname": "Darmstadt 98",
"tippligaID": 70,
"openligaDBID": 118
},
{
"teamname": "SV Sandhausen",
"tippligaID": 53,
"openligaDBID": 119
},
{
"teamname": "TSV 1860 München",
"tippligaID": 20,
"openligaDBID": 125
},
{
"teamname": "VfL Bochum",
"tippligaID": 5,
"openligaDBID": 129
},
{
"teamname": "FC Ingolstadt 04",
"tippligaID": 72,
"openligaDBID": 171
},
{
"teamname": "SV Wehen Wiesbaden",
"tippligaID": 48,
"openligaDBID": 174
},
{
"teamname": "Dynamo Dresden",
"tippligaID": 38,
"openligaDBID": 177
},
{
"teamname": "Bayern München II",
"tippligaID": 168,
"openligaDBID": 179
},
{
"teamname": "Jahn Regensburg",
"tippligaID": 43,
"openligaDBID": 181
},
{
"teamname": "Preußen Münster",
"tippligaID": 81,
"openligaDBID": 188
},
{
"teamname": "1. FC Heidenheim 1846",
"tippligaID": 85,
"openligaDBID": 199
},
{
"teamname": "Chemnitzer FC",
"tippligaID": 79,
"openligaDBID": 202
},
{
"teamname": "Hallescher FC",
"tippligaID": 78,
"openligaDBID": 208
},
{
"teamname": "Würzburger Kickers",
"tippligaID": 107,
"openligaDBID": 398
},
{
"teamname": "SG Sonnenhof Großaspach",
"tippligaID": 97,
"openligaDBID": 529
},
{
"teamname": "Waldhof Mannheim",
"tippligaID": 167,
"openligaDBID": 553
},
{
"teamname": "KFC Uerdingen 05",
"tippligaID": 119,
"openligaDBID": 563
},
{
"teamname": "SV Meppen",
"tippligaID": 139,
"openligaDBID": 599
},
{
"teamname": "FSV Zwickau",
"tippligaID": 146,
"openligaDBID": 1979
},
{
"teamname": "Viktoria Köln",
"tippligaID": 609,
"openligaDBID": 2199
},
{
"teamname": "Kickers Offenbach",
"tippligaID": 22,
"openligaDBID": 29
},
{
"teamname": "Rot-Weiss Essen",
"tippligaID": 34,
"openligaDBID": 109
},
{
"teamname": "SV Babelsberg 03",
"tippligaID": 67,
"openligaDBID": 117
},
{
"teamname": "FSV Frankfurt",
"tippligaID": 71,
"openligaDBID": 172
},
{
"teamname": "Sportfreunde Lotte",
"tippligaID": 95,
"openligaDBID": 191
},
{
"teamname": "FC 08 Homburg",
"tippligaID": 84,
"openligaDBID": 204
},
{
"teamname": "SG Wattenscheid 09",
"tippligaID": 145,
"openligaDBID": 429
},
{
"teamname": "Eintracht Trier",
"tippligaID": 46,
"openligaDBID": 531
},
{
"teamname": "VfB Lübeck",
"tippligaID": 40,
"openligaDBID": 532
},
{
"teamname": "FC Villingen",
"tippligaID": 69,
"openligaDBID": 534
},
{
"teamname": "Bremer SV",
"tippligaID": 602,
"openligaDBID": 2727
},
{
"teamname": "FC Astoria Walldorf",
"tippligaID": 603,
"openligaDBID": 2728
},
{
"teamname": "SV Drochtersen/Assel",
"tippligaID": 152,
"openligaDBID": 4341
},
{
"teamname": "Eintracht Norderstedt",
"tippligaID": 148,
"openligaDBID": 4342
},
{
"teamname": "Germ. Egestorf/Langreder",
"tippligaID": 150,
"openligaDBID": 4343
},
{
"teamname": "BFC Preussen",
"tippligaID": 147,
"openligaDBID": 4344
},
{
"teamname": "FV Ravensburg",
"tippligaID": 149,
"openligaDBID": 4345
},
{
"teamname": "SC Hauenstein",
"tippligaID": 151,
"openligaDBID": 4346
},
{
"teamname": "Würzburger Kickers",
"tippligaID": 107,
"openligaDBID": 4437
}
]

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View 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."
}
]

View File

@@ -0,0 +1,31 @@
package de.jeyp91;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class TeamIDMatcherTest {
@Test
public void getOpenLigaDbIdFromTippligaIdTest() {
int openligaDBID;
openligaDBID = TeamIDMatcher.getOpenLigaDbIdFromTippligaId(1);
assertEquals(40, openligaDBID);
openligaDBID = TeamIDMatcher.getOpenLigaDbIdFromTippligaId(16);
assertEquals(54, openligaDBID);
openligaDBID = TeamIDMatcher.getOpenLigaDbIdFromTippligaId(12);
assertEquals(7, openligaDBID);
}
@Test
public void getTippligaIdFromOpenLigaDbIdTest() {
int openligaDBID;
openligaDBID = TeamIDMatcher.getTippligaIdFromOpenLigaDbId(40);
assertEquals(1, openligaDBID);
openligaDBID = TeamIDMatcher.getTippligaIdFromOpenLigaDbId(54);
assertEquals(16, openligaDBID);
openligaDBID = TeamIDMatcher.getTippligaIdFromOpenLigaDbId(7);
assertEquals(12, openligaDBID);
}
}

View File

@@ -0,0 +1,17 @@
package de.jeyp91.apifootball;
import de.jeyp91.openligadb.OpenLigaDBConnector;
import org.junit.Test;
import java.util.ArrayList;
public class APIFootballConnectorTest {
@Test
public void APITestGetMatchDataOfMatchdayBundesliga() {
APIFootballConnector apiFootballConnector = new APIFootballConnector(2020);
ArrayList<APIFootballMatch> matchesOfMatchday = apiFootballConnector.getMatchDataByLeagueAndMatchday(2677, 1);
assert matchesOfMatchday.get(0).getTeamIdHome() == 744;
assert matchesOfMatchday.get(0).getTeamIdGuest() == 159;
}
}

View File

@@ -0,0 +1,36 @@
package de.jeyp91.googlecalendar;
import com.google.api.client.util.DateTime;
import com.google.api.services.calendar.model.Event;
import de.jeyp91.tippliga.TLWMatchday;
import org.junit.Test;
import java.util.List;
import static org.junit.Assert.assertEquals;
public class GoogleCalendarConnectorTest {
@Test
public void getAllEventsStartingFromDateTimeTest()
{
DateTime dateTime = new DateTime("2020-01-01T00:00:00");
List<Event> events = GoogleCalendarConnector.getAllEventsStartingFromDateTime(1, dateTime);
assertEquals("Tippliga 20. Spieltag tippen!", events.get(0).getSummary());
DateTime startExpected = new DateTime("2020-01-17T20:30:00+01:00");
DateTime startActual = events.get(0).getStart().getDateTime();
assertEquals(startExpected, startActual);
assertEquals("Tippliga 21. Spieltag tippen!", events.get(1).getSummary());
startExpected = new DateTime("2020-01-24T20:30:00+01:00");
startActual = events.get(1).getStart().getDateTime();
assertEquals(startExpected, startActual);
}
@Test
public void createEventTest() {
TLWMatchday matchday = new TLWMatchday(2020, 1, 1, 0, "2020-07-01 20:30:00", "", "", "", 1);
GoogleCalendarConnector.createNewEvent(matchday);
}
}

View File

@@ -0,0 +1,77 @@
package de.jeyp91.openligadb;
import org.junit.Test;
import java.util.ArrayList;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
public class OpenLigaDBConnectorTest {
@Test
public void APITestGetMatchDataOfMatchdayBundesliga() {
OpenLigaDBConnector openLigaDBConnector = new OpenLigaDBConnector();
ArrayList<OpenLigaDBMatch> matches = openLigaDBConnector.getMatchDataOfMatchday(2020, "bl1", 1);
assertEquals(9, matches.size());
OpenLigaDBMatch match;
match = matches.get(0);
assertEquals((Integer) 55277, match.getMatchId());
assertEquals((Integer) 40, match.getTeamIdHome());
assertEquals((Integer) 54, match.getTeamIdGuest());
assertEquals((Integer) 2020, match.getSeason());
assertEquals("2019-08-16T20:30:00", match.getMatchDateTime());
assertEquals((Integer) 1, match.getMatchday());
assertEquals((Integer) 2, match.getGoalsHome());
assertEquals((Integer) 2, match.getGoalsGuest());
assertTrue(match.getMatchIsFinished());
match = matches.get(1);
assertEquals((Integer) 55278, match.getMatchId());
assertEquals((Integer) 7, match.getTeamIdHome());
assertEquals((Integer) 95, match.getTeamIdGuest());
assertEquals((Integer) 2020, match.getSeason());
assertEquals("2019-08-17T15:30:00", match.getMatchDateTime());
assertEquals((Integer) 1, match.getMatchday());
assertEquals((Integer) 5, match.getGoalsHome());
assertEquals((Integer) 1, match.getGoalsGuest());
assertTrue(match.getMatchIsFinished());
}
@Test
public void APITestGetMatchDataOfMatchdayDFBPokal() {
OpenLigaDBConnector openLigaDBConnector = new OpenLigaDBConnector();
ArrayList<OpenLigaDBMatch> matches = openLigaDBConnector.getMatchDataOfMatchday(2020, "dfb2019", 1);
assert matches.size() == 32;
OpenLigaDBMatch match = matches.get(0);
assertEquals((Integer) 54926, match.getMatchId());
assertEquals((Integer) 563, match.getTeamIdHome());
assertEquals((Integer) 7, match.getTeamIdGuest());
assertEquals((Integer) 2020, match.getSeason());
assertEquals("2019-08-09T20:45:00", match.getMatchDateTime());
assertEquals((Integer) 1, match.getMatchday());
assertEquals((Integer) 0, match.getGoalsHome());
assertEquals((Integer) 2, match.getGoalsGuest());
assertTrue(match.getMatchIsFinished());
}
@Test
public void APITestGetMatchDataOfSingleMatch() {
OpenLigaDBConnector openLigaDBConnector = new OpenLigaDBConnector();
OpenLigaDBMatch match = openLigaDBConnector.getMatchDataOfSingleMatch(55583);
assertEquals((Integer) 55583, match.getMatchId());
assertEquals((Integer) 16, match.getTeamIdHome());
assertEquals((Integer) 55, match.getTeamIdGuest());
assertEquals((Integer) 2020, match.getSeason());
assertEquals("2019-07-26T20:30:00", match.getMatchDateTime());
assertEquals((Integer) 1, match.getMatchday());
assertEquals((Integer) 2, match.getGoalsHome());
assertEquals((Integer) 1, match.getGoalsGuest());
assertTrue(match.getMatchIsFinished());
}
}

View File

@@ -0,0 +1,43 @@
package de.jeyp91.tippliga;
import org.junit.Test;
import java.util.ArrayList;
import static org.junit.Assert.assertEquals;
public class TLWFootballMatchdaysCreatorTest {
@Test
public void getMatchdaysWTLPokalTest() {
TLWFootballMatchdaysCreator matchdaysCreator = new TLWFootballMatchdaysCreator(2021, 1, "WTL_Pokal.json");
ArrayList<TLWMatchday> matchdays = matchdaysCreator.getMatchdays();
assertEquals((Integer) 1, matchdays.get(0).getMatchday());
}
@Test
public void getMatchdaysWTLPokalSqlTest() {
TLWFootballMatchdaysCreator matchdaysCreator = new TLWFootballMatchdaysCreator(2021, 98, "WTL_Pokal.json");
String sql = matchdaysCreator.getMatchdaysSQL();
System.out.println(sql);
}
@Test
public void getMatchdaysTippligaTest() {
TLWFootballMatchdaysCreator matchdaysCreator = new TLWFootballMatchdaysCreator(2021, 1, "Tippliga.json");
ArrayList<TLWMatchday> matchdays = matchdaysCreator.getMatchdays();
assertEquals((Integer) 1, matchdays.get(0).getMatchday());
}
@Test
public void getMatchdaysTippligaSqlTest() {
TLWFootballMatchdaysCreator matchdaysCreator = new TLWFootballMatchdaysCreator(2021, 52, "Tippliga.json");
String sql = matchdaysCreator.getMatchdaysSQL();
System.out.println(sql);
}
}

View File

@@ -0,0 +1,34 @@
package de.jeyp91.tippliga;
import org.junit.Test;
import java.util.ArrayList;
import static org.junit.Assert.assertEquals;
public class TLWFootballMatchesCreatorTest {
@Test
public void getMatchesTest() {
TLWFootballMatchesCreator creator = new TLWFootballMatchesCreator(2021, 1, "WTL_Pokal.json");
ArrayList<TLWMatch> matches = creator.getMatches();
assertEquals((Integer) 1, matches.get(0).getMatchNo());
assertEquals((Integer) 11, matches.get(10).getMatchNo());
System.out.println(matches.get(0).getSQLQueryReplace());
}
@Test
public void getMatchesTippligaSqlTest() {
TLWFootballMatchesCreator creator = new TLWFootballMatchesCreator(2021, 2, "Tippliga.json");
String sql = creator.getSQLInsertString();
System.out.println(sql);
}
@Test
public void getMatchesWTLPokalSqlTest() {
TLWFootballMatchesCreator creator = new TLWFootballMatchesCreator(2021, 48, "WTL_Pokal.json");
String sql = creator.getSQLInsertString();
System.out.println(sql);
}
}

View File

@@ -0,0 +1,58 @@
package de.jeyp91.tippliga;
import org.junit.Test;
import java.util.ArrayList;
import static org.junit.Assert.assertEquals;
public class TLWTeamsPokalCreatorTest {
@Test
public void getTeamsWTLPokalTest() {
TLWFootballMatchesCreator matchesCreator = new TLWFootballMatchesCreator(2021, 2, "Tippliga.json");
ArrayList<TLWMatch> matches = matchesCreator.getMatches();
TLWTeamsPokalCreator teamCreator = new TLWTeamsPokalCreator(2021, 2, matches);
String sql = teamCreator.getSql();
System.out.println(sql);
}
@Test
public void getTeamsTipper1TLTest() {
TLWFootballMatchdaysCreator matchdaysCreator = new TLWFootballMatchdaysCreator(2021, 1, "Tippliga.json");
TLWTipperMatchesCreator creator = new TLWTipperMatchesCreator(2021, 51, "1TL_Tipper.json", matchdaysCreator.getMatchdays());
ArrayList<TLWMatch> matches = creator.getMatches();
TLWTeamsPokalCreator teamCreator = new TLWTeamsPokalCreator(2021, 51, matches);
String sql = teamCreator.getSql();
System.out.println(sql);
}
@Test
public void getTeamsTipper2TLTest() {
TLWFootballMatchdaysCreator matchdaysCreator = new TLWFootballMatchdaysCreator(2021, 2, "Tippliga.json");
TLWTipperMatchesCreator creator = new TLWTipperMatchesCreator(2021, 52, "2TL_Tipper.json", matchdaysCreator.getMatchdays());
ArrayList<TLWMatch> matches = creator.getMatches();
TLWTeamsPokalCreator teamCreator = new TLWTeamsPokalCreator(2021, 52, matches);
String sql = teamCreator.getSql();
System.out.println(sql);
}
@Test
public void getTeamsTipperWTLTest() {
TLWFootballMatchdaysCreator matchdaysCreator = new TLWFootballMatchdaysCreator(2021, 48, "WTL_Pokal.json");
TLWTipperPokalMatchesCreator creator = new TLWTipperPokalMatchesCreator(2021, 98, "WTL_Tipper.json", matchdaysCreator.getMatchdays());
ArrayList<TLWMatch> matches = creator.getMatches();
TLWTeamsPokalCreator teamCreator = new TLWTeamsPokalCreator(2021, 98, matches);
String sql = teamCreator.getSql();
System.out.println(sql);
}
}

View File

@@ -0,0 +1,20 @@
package de.jeyp91.tippliga;
import org.junit.Test;
import java.util.ArrayList;
import static org.junit.Assert.assertEquals;
public class TLWTipperMatchesCreatorTest {
@Test
public void getMatchesTippligaTest() {
TLWFootballMatchdaysCreator matchdaysCreator = new TLWFootballMatchdaysCreator(2021, 2, "Tippliga.json");
TLWTipperMatchesCreator creator = new TLWTipperMatchesCreator(2021, 52, "2TL_Tipper.json", matchdaysCreator.getMatchdays());
String sql = creator.getSQLInsertString();
System.out.println(sql);
}
}

View File

@@ -0,0 +1,16 @@
package de.jeyp91.tippliga;
import org.junit.Test;
public class TLWTipperPokalMatchesCreatorTest {
@Test
public void getMatchesWTLPokalTest() {
TLWFootballMatchdaysCreator matchdaysCreator = new TLWFootballMatchdaysCreator(2021, 48, "WTL_Pokal.json");
TLWTipperPokalMatchesCreator creator = new TLWTipperPokalMatchesCreator(2021, 98, "WTL_Tipper.json", matchdaysCreator.getMatchdays());
String sql = creator.getSQLInsertString();
System.out.println(sql);
}
}

View File

@@ -0,0 +1,71 @@
package de.jeyp91.tippliga;
import de.jeyp91.tippliga.TLWMatch;
import de.jeyp91.tippliga.TLWTeam;
import de.jeyp91.tippliga.TippligaSQLConnector;
import org.junit.Before;
import org.junit.Test;
import java.util.ArrayList;
import static org.junit.Assert.assertEquals;
public class TippligaSQLConnectorTest {
TippligaSQLConnector tl;
@Before
public void setup() {
tl = new TippligaSQLConnector();
}
@Test
public void getTeamsBySeasonAndLeagueTest() {
ArrayList<TLWTeam> teams = tl.getTeamsBySeasonAndLeague("2020", "1");
assertEquals(84, teams.size());
assertEquals(2020, teams.get(0).getSeason());
assertEquals(1, teams.get(0).getLeague());
assertEquals(1, teams.get(0).getTeamId());
assertEquals("Bayern München", teams.get(0).getTeamName());
assertEquals("Bayern", teams.get(0).getTeamNameShort());
assertEquals("FC Bayern Muenchen.png", teams.get(0).getTeamSymbol());
assertEquals("", teams.get(0).getGroupId());
assertEquals(0, teams.get(0).getMatchday());
}
@Test
public void getTeamsByIdTest() {
ArrayList<TLWTeam> teams = tl.getTeamsById("1");
assertEquals(39, teams.size());
assertEquals(2011, teams.get(0).getSeason());
assertEquals(1, teams.get(0).getLeague());
assertEquals(1, teams.get(0).getTeamId());
assertEquals("Bayern München", teams.get(0).getTeamName());
assertEquals("Bayern", teams.get(0).getTeamNameShort());
assertEquals("FC Bayern Muenchen.png", teams.get(0).getTeamSymbol());
assertEquals("", teams.get(0).getGroupId());
assertEquals(0, teams.get(0).getMatchday());
}
@Test
public void getMatchesBySeasonAndLeague() {
ArrayList<TLWMatch> matches = tl.getMatchesBySeasonAndLeague("2020", "1");
assertEquals(468, matches.size());
assertEquals((Integer) 2020, matches.get(0).getSeason());
assertEquals((Integer) 1, matches.get(0).getLeague());
assertEquals((Integer) 1, matches.get(0).getMatchday());
assertEquals("", matches.get(0).getGroupId());
assertEquals((Integer) 1, matches.get(0).getMatchNo());
assertEquals("2019-07-26 20:30:00", matches.get(0).getMatchDateTime());
assertEquals((Integer) 8, matches.get(0).getTeamIdHome());
assertEquals((Integer) 15, matches.get(0).getTeamIdGuest());
assertEquals((Integer) 2, matches.get(0).getGoalsHome());
assertEquals((Integer) 1, matches.get(0).getGoalsGuest());
}
}

BIN
tokens/StoredCredential Normal file

Binary file not shown.