forked from tzwenn/PyOpenAirMirror
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
67 lines (55 loc) · 1.66 KB
/
config.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
64
65
66
model = "AppleTV3,1"
rmodel = model
server_name = "AirTunes"
server_version = "150.33"
rhd = "1.06.6"
service_name = "OpenAirMirror"
sdl_window_caption = service_name
selectedSinks = []
password = None
default_capabilities = {
"width": 1280,
"height": 720,
"overscanned": True,
"version": server_version,
"refreshRate": 1.0/60,
}
fplyServerPort = 20992
fplyServer = None
#####################################################################
import argparse
import output.FrameSink
args = None
def parseArguments():
parser = argparse.ArgumentParser()
parser.add_argument("name", type=str, nargs='?',
help="the name under which the service gets announced",
default=service_name)
parser.add_argument("--sink", "-s", nargs='+',
choices=output.FrameSink.availableSinks.keys(),
default=["sdl"],
help="What to do with received frames")
parser.add_argument("--password", "-p",
help="server's password (none if not provided)")
parser.add_argument("--fply-server", "-f", type=str,
help="a server that can answer FPLY challenges")
global args
args = parser.parse_args()
applyArguments()
def applyArguments():
global service_name
global password
global selectedSinks
global fplyServer, fplyServerPort
service_name = args.name
password = args.password
try:
selectedSinks = [output.FrameSink.availableSinks[key] for key in args.sink]
except KeyError, e:
import sys
sys.stderr.write("Cannot find sink %s. Have you installed all dependencies?\n" % e)
sys.exit(1)
fplyServer = args.fply_server
if fplyServer is not None and ':' in fplyServer:
fplyServer, _, fsp = fplyServer.rpartition(':')
fplyServerPort = int(fsp)