blob: a85b38cc02a8b50abb7955c04a6e34ccb11d15c8 (
plain)
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
|
#!/usr/bin/env python3
from pysdcp import Projector
from time import sleep
import sys
PROJ_IP_ADDRESS="10.45.0.100"
args_len = len(sys.argv)
first_part = ""
is_second_part = False
if args_len == 1:
exit()
pj = Projector(PROJ_IP_ADDRESS)
for i in range(1, args_len):
if is_second_part == False:
if sys.argv[i] == "power":
is_second_part = True
elif sys.argv[i] == "mute":
is_second_part = True
elif sys.argv[i] == "sleep":
is_second_part = True
else:
print("Command not understood.")
exit()
first_part = sys.argv[i]
else:
is_second_part = False
if first_part == "sleep":
try:
s = float(sys.argv[i])
except ValueError:
print(f"Value {sys.argv[i]} doesn't look like a number!")
continue
sleep(s)
elif first_part == "power":
if sys.argv[i] == "on":
pj.set_power(True)
elif sys.argv[i] == "off":
pj.set_power(False)
elif sys.argv[i] == "get":
print(pj.get_power())
else:
print("Command not understood.")
elif first_part == "mute":
if sys.argv[i] == "on":
pj.set_mute(True)
elif sys.argv[i] == "off":
pj.set_mute(False)
elif sys.argv[i] == "get":
print(pj.get_mute())
else:
print("Command not understood.")
|