-
Notifications
You must be signed in to change notification settings - Fork 0
/
CommandLineParser.py
63 lines (60 loc) · 2.21 KB
/
CommandLineParser.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import argparse
import pathlib
class CommandLineParser:
def __init__(self) -> None:
# Initialize the argument parser with description
self.parser = argparse.ArgumentParser(
description='Digitize analog Super V8 films.'
)
# Add argument for version
self.parser.add_argument('--version', action='version', version='1.0.0')
# Add argument for device selection
self.parser.add_argument(
'-d', '--device',
dest="device",
type=int,
nargs='?',
choices=range(0,10),
default=0,
help='Device number of attached camera - default is device 0.'
)
# Add arguments for output path
self.parser.add_argument(
'-o', '--output-path',
dest="output_path",
type=pathlib.Path,
nargs='?',
default=pathlib.Path(".").resolve(),
help='Output directory for digitized png frames - default is current directory.'
)
# Add arguments for emergency brake
self.parser.add_argument(
'-m', '--max-count',
dest="maxcount",
type=int,
nargs='?',
choices=[3600, 7200, 14400, 21800, 43600, 60000],
default=7200,
help='The End Of Film (EOF) is signalled by optocoupler 2. In case the optocoupler 2 signal is not '
'emitted stop digitizing when specified number of images is reached - default is 7200 frames.'
)
# Add arguments for monitoring frames
self.parser.add_argument(
'-s', '--show-monitor',
dest="monitor",
action="store_true",
default=False,
help='Show monitoring window'
)
# Add arguments for chunk size
self.parser.add_argument(
'-c', '--chunk-size',
dest="chunk_size",
type=int,
nargs='?',
default=8,
help='Chunk size (number of frames) passed to each process - default is 8 frames'
)
def parse_args(self) -> argparse.Namespace:
# Parse arguments and return the namespace
return self.parser.parse_args()