• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

A Nix-friendly SQLite-enhanced fork of Flitter, a speedrunning split timer for Unix-style terminals


Commit MetaInfo

Revisãob108d273dd8362f31613ae57680bb4f0460b1675 (tree)
Hora2023-05-23 13:35:35
AutorCorbin <cds@corb...>
CommiterCorbin

Mensagem de Log

Start rebuilding summary tool.

Haven't ported the statistics yet. Need sleeps first.

Mudança Sumário

Diff

--- a/bin/summary_main.ml
+++ b/bin/summary_main.ml
@@ -1,10 +1,47 @@
1+open Core
2+open Sqlite3
3+
14 let usage =
2- "Usage:\n" ^ "flitter-summary <splits_path>\n"
3- ^ "Summarize the splits file pointed to by `splits_path`.\n"
5+ "Usage:\n" ^ "flitter-summary <splits_db>\n"
6+ ^ "Summarize the splits file pointed to by `splits_db`.\n"
7+
8+let check_select stmt vals f =
9+ Rc.check (bind_values stmt vals);
10+ Rc.check (iter stmt ~f)
411
512 let () =
6- match Sys.argv with
7- | [| _; path |] ->
8- let summary = Loadsave.load_summary path in
9- Summary.print_summary summary
13+ match Sys.get_argv () with
14+ | [| _; db_path |] ->
15+ let db = db_open db_path in
16+ Rc.check (exec db "pragma foreign_keys = on;");
17+ let stmt = prepare db "select count(*) from games;" in
18+ check_select stmt [] (fun row ->
19+ print_string
20+ (sprintf "Number of games: %d\n" (Data.to_int_exn row.(0))));
21+ let stmt = prepare db "select * from games;" in
22+ check_select stmt [] (fun row ->
23+ print_string (sprintf "* %s\n" (Data.to_string_exn row.(0))));
24+ let _ = db_close db in
25+ ()
26+ | [| _; db_path; game |] ->
27+ let db = db_open db_path in
28+ Rc.check (exec db "pragma foreign_keys = on;");
29+ let vals = [ Data.TEXT game ] in
30+ let stmt = prepare db "select count(*) from routes where game = ?;" in
31+ check_select stmt vals (fun row ->
32+ print_string
33+ (sprintf "Number of routes: %d\n" (Data.to_int_exn row.(0))));
34+ let stmt =
35+ prepare db
36+ "select category, penultimate, finish_line from routes where game = \
37+ ?;"
38+ in
39+ check_select stmt vals (fun row ->
40+ print_string
41+ (sprintf "* %s (%s, %s)\n"
42+ (Data.to_string_exn row.(0))
43+ (Data.to_string_exn row.(1))
44+ (Data.to_string_exn row.(2))));
45+ let _ = db_close db in
46+ ()
1047 | _ -> print_string usage