Add api football files updater
This commit is contained in:
@@ -110,8 +110,8 @@ public class TLWMatch extends BaseMatch{
|
||||
this.league = league;
|
||||
this.matchday = matchday;
|
||||
this.matchNo = matchNo;
|
||||
this.teamIdHome = TeamIDMatcher.getTippligaIdFromApiFootballId(apiFootballMatch.getTeamIdHome());
|
||||
this.teamIdGuest = TeamIDMatcher.getTippligaIdFromApiFootballId(apiFootballMatch.getTeamIdGuest());
|
||||
this.teamIdHome = this.getTeamIdHomeFromApiFootballMatch(apiFootballMatch);
|
||||
this.teamIdGuest = this.getTeamIdGuestFromApiFootballMatch(apiFootballMatch);
|
||||
this.goalsHome = apiFootballMatch.getGoalsHome();
|
||||
this.goalsGuest = apiFootballMatch.getGoalsGuest();
|
||||
this.matchDatetime = apiFootballMatch.getMatchDateTime().replace("T", " ").substring(0, 19);
|
||||
@@ -270,4 +270,20 @@ public class TLWMatch extends BaseMatch{
|
||||
this.goalsGuest = apiFootballMatch.getGoalsGuest();
|
||||
this.matchDatetime = apiFootballMatch.getMatchDateTime().replace("T", " ").substring(0, 19);
|
||||
}
|
||||
|
||||
private Integer getTeamIdHomeFromApiFootballMatch(APIFootballMatch match) {
|
||||
Integer id = TeamIDMatcher.getTippligaIdFromApiFootballId(match.getTeamIdHome());
|
||||
if(id == null) {
|
||||
System.out.println("Could not find id " + match.getTeamIdHome() + " for " + match.getTeamNameHome());
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
private Integer getTeamIdGuestFromApiFootballMatch(APIFootballMatch match) {
|
||||
Integer id = TeamIDMatcher.getTippligaIdFromApiFootballId(match.getTeamIdGuest());
|
||||
if(id == null) {
|
||||
System.out.println("Could not find id " + match.getTeamIdGuest() + " for " + match.getTeamNameGuest());
|
||||
}
|
||||
return id;
|
||||
}
|
||||
}
|
||||
@@ -53,7 +53,7 @@ public class TLWMatchdaysUpdater {
|
||||
|
||||
if(earliestDate.after(now)) {
|
||||
|
||||
String updateStart = "UPDATE phpbb_footb_matches SET ";
|
||||
String updateStart = "UPDATE phpbb_footb_matchdays SET ";
|
||||
String condition = "WHERE season = " + matchdayOriginal.getSeason() + " " +
|
||||
"AND league = " + matchdayOriginal.getLeague() + " " +
|
||||
"AND matchday = " + matchdayOriginal.getMatchday() + ";\n";
|
||||
|
||||
@@ -24,9 +24,10 @@ public class TippligaSQLConnector {
|
||||
}
|
||||
|
||||
public TippligaSQLConnector() {
|
||||
String jdbcUrl = "jdbc:mysql://localhost/d0144ddb?user=root&password=&useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC";
|
||||
String jdbcUrlLocalhost = "jdbc:mysql://localhost/d0144ddb?user=root&password=&useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC";
|
||||
String jdbcUrlProd = "jdbc:mysql://dd16124.kasserver.com/d0144ddb?user=d0144ddb&password=TippligaWuerzb_1&useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC";
|
||||
try {
|
||||
con = DriverManager.getConnection(jdbcUrl);
|
||||
con = DriverManager.getConnection(jdbcUrlProd);
|
||||
} catch (SQLException e) {
|
||||
/* TODO */
|
||||
e.printStackTrace();
|
||||
|
||||
Reference in New Issue
Block a user