Finish gist
This commit is contained in:
@@ -1,15 +1,11 @@
|
||||
package de.jeyp91.tippliga;
|
||||
|
||||
import com.google.common.io.Resources;
|
||||
import de.jeyp91.gists.GistProvider;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
import org.json.simple.parser.ParseException;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
@@ -25,18 +21,17 @@ public class TLWMatchesManagerBase {
|
||||
|
||||
protected void initConfigParamsFromFile(String configFileName) {
|
||||
|
||||
URL url = Resources.getResource(season + File.separator + configFileName);
|
||||
String jsonConfig = null;
|
||||
GistProvider prov = GistProvider.getInstance();
|
||||
String jsonConfig = prov.getTippligaConfig(season, configFileName);
|
||||
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) {
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user