Main.java 2.1 KB

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