Compare commits
2 Commits
ee6245d77a
...
284b9342ce
| Author | SHA1 | Date | |
|---|---|---|---|
| 284b9342ce | |||
| a09c0f86d5 |
@@ -37,10 +37,6 @@
|
||||
:max (:max params)
|
||||
:header (:header params)))
|
||||
|
||||
(defn to-epoch
|
||||
[time]
|
||||
(- (/ (System/currentTimeMillis) 1000) (* 60 60 24)))
|
||||
|
||||
(defn cmd-show-matches-adapter
|
||||
[params]
|
||||
(check-debug params)
|
||||
@@ -49,7 +45,10 @@
|
||||
:lol (:lol params)
|
||||
:tft (:tft params)
|
||||
:format (:format params)
|
||||
:since (to-epoch (:since params))))
|
||||
:since (:since params)
|
||||
:until (:until params)
|
||||
:max (:max params)
|
||||
))
|
||||
|
||||
|
||||
;;[player-name player-tag & {:keys [lol tft template continuous every-seconds max]
|
||||
@@ -63,8 +62,8 @@
|
||||
"--[no-]tft" {:doc "Check if playing TFT" :default true}
|
||||
"-t, --template <template>" {:doc "Text template"}
|
||||
"-c, --[no-]continuous" {:doc "Print continuosly" :default false}
|
||||
"--period <seconds>" {:doc "If printing continuosly, period in seconds" :parse parse-long :default 60}
|
||||
"--max <max>" {:doc "If printing continuosly, max number of checks." :parse parse-long :default -1}
|
||||
"-p, --period <seconds>" {:doc "If printing continuosly, period in seconds" :parse parse-long :default 60}
|
||||
"-m, --max <max>" {:doc "If printing continuosly, max number of checks." :parse parse-long :default -1}
|
||||
"--[no-]header" {:doc "If true, print a header over each check" :default true}]}
|
||||
|
||||
"matches <username> <usertag>"
|
||||
@@ -73,7 +72,9 @@
|
||||
:flags ["--[no-]lol" {:doc "Check if playing LOL" :default true}
|
||||
"--[no-]tft" {:doc "Check if playing TFT" :default true}
|
||||
"-f, --format <table|edn|csv>" {:doc "Output format" :parse keyword :default "table"}
|
||||
"-s, --since <time>" {:doc "Obtain registries since <time>" :default "today"}]}
|
||||
"-s, --since <time>" {:doc "Obtain registries since <time>"}
|
||||
"-u, --until <time>" {:doc "Obtain registries until <time>"}
|
||||
"-m, --max <max>" {:doc "Max number of registries for each game type"}]}
|
||||
]
|
||||
:flags ["-v, --verbose" "Increases verbosity"
|
||||
"--debug-http" "Show HTTP request/response data"
|
||||
|
||||
@@ -67,20 +67,21 @@
|
||||
(print "CSV"))
|
||||
|
||||
(defn get-matches
|
||||
[player-name player-tag & {:keys [lol tft since max]
|
||||
[player-name player-tag & {:keys [lol tft since until max]
|
||||
:or {lol true
|
||||
tft true
|
||||
since "today"
|
||||
max 10
|
||||
}
|
||||
tft true}
|
||||
:as params}]
|
||||
(let [millis (process-time-literal since)]
|
||||
(when @debug (println "Parsed date:" millis))
|
||||
(let [call-params (cond-> {}
|
||||
max (assoc :count max)
|
||||
since (assoc :startTime (process-time-literal since))
|
||||
until (assoc :endTime (process-time-literal until)))]
|
||||
(when @debug (println "Params")
|
||||
(pp/pprint call-params))
|
||||
(cond-> []
|
||||
lol (concat (map get-lol-match-data
|
||||
(get-lol-matches (lol-get-uuid player-name player-tag) :count max :startTime millis)))
|
||||
lol (concat (map get-lol-match-data
|
||||
(get-lol-matches (lol-get-uuid player-name player-tag) call-params)))
|
||||
tft (concat (map get-tft-match-data
|
||||
(get-tft-matches (tft-get-uuid player-name player-tag) :count max :startTime millis))))))
|
||||
(get-tft-matches (tft-get-uuid player-name player-tag) call-params))))))
|
||||
|
||||
(comment
|
||||
(get-matches "Walid Georgey" "EUW")
|
||||
@@ -88,7 +89,7 @@
|
||||
|
||||
|
||||
(defn cmd-show-matches
|
||||
[player-name player-tag & {:keys [lol tft format since max]
|
||||
[player-name player-tag & {:keys [lol tft format since until max]
|
||||
:or {lol true
|
||||
tft true
|
||||
format :table
|
||||
@@ -108,5 +109,6 @@
|
||||
|
||||
(comment
|
||||
(set-riot-api-key :RIOT_DEV_KEY "RGAPI-9fcdee6d-620f-443e-959f-b43fc445f51b")
|
||||
(cmd-show-matches "Walid Georgey" "EUW")
|
||||
(cmd-show-matches "Walid Georgey" "EUW" :since "yesterday" :max 2)
|
||||
)
|
||||
Reference in New Issue
Block a user