-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.py
More file actions
32 lines (22 loc) · 962 Bytes
/
cli.py
File metadata and controls
32 lines (22 loc) · 962 Bytes
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
import argparse
from udp import MarshallConnection
parser = argparse.ArgumentParser(description='Control Marshall camera.')
group = parser.add_mutually_exclusive_group(required=True)
parser.add_argument('-i', '--ip', metavar='Camera IP Address', action='store', type=str, required=True)
group.add_argument('-s', '--set', metavar='Memory Number', action='store', type=int)
group.add_argument('-r', '--reset', metavar='Memory Number', action='store', type=int)
group.add_argument('-c', '--call', metavar='Memory Number', action='store', type=int)
group.add_argument('--on', action='store_true')
group.add_argument('--off', action='store_true')
args = parser.parse_args()
conn = MarshallConnection(udp_ip=args.ip)
if args.on:
conn.power_on()
if args.off:
conn.power_off()
if args.set is not None:
conn.set_preset(args.set)
if args.call is not None:
conn.recall_preset(args.call)
if args.reset is not None:
conn.reset_preset(args.reset)