-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path__main__.py
49 lines (40 loc) · 1.1 KB
/
__main__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import argparse
from dataclasses import asdict
from json import dumps
from time import monotonic
from covyx import analyze
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="""
Analyze a CT video,
see https://github.com/catneep/covyx#readme
for more information.
"""
)
parser.add_argument("path", type=str, help="Path to local .mp4 file")
parser.add_argument(
"--time",
dest="time",
default=False,
action="store_true",
help="output the analysis time",
)
parser.add_argument(
"--pretty",
dest="pretty",
default=False,
action="store_true",
help="pretty print the result",
)
args = parser.parse_args()
path, time, pretty = args.path, args.time, args.pretty
start = monotonic()
result = analyze(path)
end = monotonic() - start
result_dict = asdict(result)
if time:
result_dict["runtime"] = round(end, 4)
if pretty:
print(dumps(result_dict, indent=2, sort_keys=True))
else:
print(result_dict)