doc
This commit is contained in:
parent
cd650991bc
commit
88456e17ca
3 changed files with 11 additions and 12 deletions
|
|
@ -146,7 +146,8 @@ let f () =
|
||||||
***\n"
|
***\n"
|
||||||
in
|
in
|
||||||
let md =
|
let md =
|
||||||
sprintf "%s\n\n```text\n%s\n\nUTC-3/[local time]\n```\n\n%s" header schedules footer
|
sprintf "%s\n\n```text\n%s\n\nUTC-3/[local time]\n```\n\n%s" header
|
||||||
|
schedules footer
|
||||||
in
|
in
|
||||||
(* print_endline md *)
|
(* print_endline md *)
|
||||||
Rentry.update_page md
|
Rentry.update_page md
|
||||||
|
|
|
||||||
14
lib/lib.ml
14
lib/lib.ml
|
|
@ -139,13 +139,14 @@ module Tournament = struct
|
||||||
t.start_timestamp |> float_of_int |> Unix.gmtime
|
t.start_timestamp |> float_of_int |> Unix.gmtime
|
||||||
in
|
in
|
||||||
sprintf "%02d:%02d/%02d:%02d" ts1.tm_hour ts1.tm_min
|
sprintf "%02d:%02d/%02d:%02d" ts1.tm_hour ts1.tm_min
|
||||||
(mmod (ts2.tm_hour + off) 24) ts2.tm_min)
|
(mmod (ts2.tm_hour + off) 24)
|
||||||
|
ts2.tm_min)
|
||||||
in
|
in
|
||||||
sprintf "%s | %s x %s" timestamp x.home_team.name x.away_team.name)
|
sprintf "%s | %s x %s" timestamp x.home_team.name x.away_team.name)
|
||||||
|> String.concat "\n"
|
|> String.concat "\n"
|
||||||
in
|
in
|
||||||
if m = "" then ""
|
if m = "" then ""
|
||||||
else
|
else
|
||||||
match tournament.context.timezone_offset with
|
match tournament.context.timezone_offset with
|
||||||
| None -> sprintf ">%s\n%s" tournament.context.name m
|
| None -> sprintf ">%s\n%s" tournament.context.name m
|
||||||
| Some off -> sprintf ">%s (UTC%d)\n%s" tournament.context.name off m
|
| Some off -> sprintf ">%s (UTC%d)\n%s" tournament.context.name off m
|
||||||
|
|
@ -153,6 +154,7 @@ end
|
||||||
|
|
||||||
let ( let* ) = Lwt.bind
|
let ( let* ) = Lwt.bind
|
||||||
|
|
||||||
|
(* TODO: handle "resolution fai led: name resolution failed" *)
|
||||||
let get url : string =
|
let get url : string =
|
||||||
let http_get url =
|
let http_get url =
|
||||||
Printf.printf "\r%-90s" url;
|
Printf.printf "\r%-90s" url;
|
||||||
|
|
@ -191,11 +193,7 @@ let matches_of_api_events (e : api_events) =
|
||||||
injuryTime2 = y;
|
injuryTime2 = y;
|
||||||
currentPeriodStartTimestamp = _;
|
currentPeriodStartTimestamp = _;
|
||||||
} ->
|
} ->
|
||||||
SecondHalf
|
SecondHalf { injury_time1 = x; injury_time2 = y }
|
||||||
{
|
|
||||||
injury_time1 = x;
|
|
||||||
injury_time2 = y;
|
|
||||||
}
|
|
||||||
| {
|
| {
|
||||||
injuryTime1 = None;
|
injuryTime1 = None;
|
||||||
injuryTime2 = Some y;
|
injuryTime2 = Some y;
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,8 @@ let update_page content =
|
||||||
Cohttp_lwt.Body.of_form
|
Cohttp_lwt.Body.of_form
|
||||||
[
|
[
|
||||||
("csrfmiddlewaretoken", [ value ]);
|
("csrfmiddlewaretoken", [ value ]);
|
||||||
("edit_code", [ "foo perro bar caca" ]);
|
("edit_code", [ "foo perro bar caca" ]); (* TODO: use environmental variables *)
|
||||||
("metadata", ["ACCESS_RECOMMENDED_THEME=dark"]);
|
("metadata", [ "ACCESS_RECOMMENDED_THEME=dark" ]);
|
||||||
("text", [ content ]);
|
("text", [ content ]);
|
||||||
]
|
]
|
||||||
in
|
in
|
||||||
|
|
@ -31,7 +31,7 @@ let update_page content =
|
||||||
let h0 = init () in
|
let h0 = init () in
|
||||||
let h1 = add h0 "Referer" "https://rentry.org" in
|
let h1 = add h0 "Referer" "https://rentry.org" in
|
||||||
let h2 = add h1 "Content-Type" "application/x-www-form-urlencoded" in
|
let h2 = add h1 "Content-Type" "application/x-www-form-urlencoded" in
|
||||||
let h3 = add h2 "User-Agent" "copabot/v0.1.0" in
|
let h3 = add h2 "User-Agent" "copabot/0.1.0" in
|
||||||
let hname, hvalue =
|
let hname, hvalue =
|
||||||
cookies
|
cookies
|
||||||
|> List.map (fun (x : string * Cookie.Set_cookie_hdr.t) ->
|
|> List.map (fun (x : string * Cookie.Set_cookie_hdr.t) ->
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue