Main.java 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import java.io.BufferedReader;
  2. import java.io.IOException;
  3. import java.io.InputStreamReader;
  4. import parser.ExpektParser;
  5. import parser.OddsPortal;
  6. public class Main {
  7. public static void main(String[] args) {
  8. //testExpektParser();
  9. updateFromOddsportal();
  10. // op.getHistoricMatches("soccer", "japan", "j2-league", "2020");
  11. // callingRScript();
  12. }
  13. private static void testExpektParser() {
  14. ExpektParser expektParser = new ExpektParser();
  15. }
  16. private static void updateFromOddsportal() {
  17. final OddsPortal op = new OddsPortal();
  18. System.out.println("Getting Yesterdays matches");
  19. op.getYesterdaysMatches();
  20. System.out.println("Getting Todays Matches");
  21. op.getTodaysMatches();
  22. System.out.println("Getting tomorrows matches");
  23. op.getTomorrowsMatches();
  24. op.getNextDaysMatches();
  25. }
  26. private static void callingRScript() throws IOException {
  27. System.out.println(System.getProperty("user.dir"));
  28. final String rPath = System.getProperty("user.dir") + "\\src\\RScript\\scorePrediction.R";
  29. final Process exec = Runtime.getRuntime().exec("C:\\Program Files\\R\\R-3.6.3\\bin\\Rscript.exe " + rPath);
  30. final BufferedReader stdInput = new BufferedReader(new InputStreamReader(exec.getInputStream()));
  31. final BufferedReader stdError = new BufferedReader(new InputStreamReader(exec.getErrorStream()));
  32. // Read the output from the command
  33. System.out.println("Here is the standard output of the command:\n");
  34. String s = null;
  35. while ((s = stdInput.readLine()) != null) {
  36. System.out.println(s);
  37. }
  38. // Read any errors from the attempted command
  39. System.out.println("Here is the standard error of the command (if any):\n");
  40. while ((s = stdError.readLine()) != null) {
  41. System.out.println(s);
  42. }
  43. }
  44. }