-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
36 lines (28 loc) · 1.07 KB
/
main.py
File metadata and controls
36 lines (28 loc) · 1.07 KB
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
import argparse as ap
from typing import Tuple
from InputOscConverter import InputOSCConverter
from PS4GamepadManager import PS4GamepadManager
from networking.UdpMsgSender import UdpMsgSender
def parse_args() -> Tuple[int, int]:
"""
Parses the input args to get a target hostname and port to
send OSC messages to.
"""
parser = ap.ArgumentParser()
parser.add_argument("hostname",
type=str,
help="the hostname you want to send the messages to, "
"e.g. \"localhost\" or \"192.168.11.22\""
)
parser.add_argument("port",
type=int,
help="the port you want to send the messages to, "
"e.g. \"9001\"")
args = parser.parse_args()
_hostname = args.hostname
_port_num = args.port
return _hostname, _port_num
if __name__ == '__main__':
hostname, port = parse_args()
sender = UdpMsgSender(hostname, port)
mgr = PS4GamepadManager(InputOSCConverter("ps4"), sender)