summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZachIR <zachir@librem.one>2023-01-10 10:54:06 -0600
committerZachIR <zachir@librem.one>2023-01-10 10:54:06 -0600
commit328738278b556d013b110769531e3a45347c52ec (patch)
tree81016723097173ebabe1263f351f03ad6c271d49
parenteb455c5b1adc0b6baf6171fec804c86c4f95a33f (diff)
add projector script
-rwxr-xr-xproj.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/proj.py b/proj.py
new file mode 100755
index 0000000..a9b2a96
--- /dev/null
+++ b/proj.py
@@ -0,0 +1,40 @@
+#!/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)
+
+get_sleep = False
+
+if args_len == 1:
+ exit()
+
+pj = Projector(PROJ_IP_ADDRESS)
+
+for i in range(1, args_len):
+ if get_sleep == False:
+ if sys.argv[i] == "power_on":
+ pj.set_power(True)
+ elif sys.argv[i] == "power_off":
+ pj.set_power(False)
+ elif sys.argv[i] == "mute_on":
+ pj.set_mute(True)
+ elif sys.argv[i] == "mute_off":
+ pj.set_mute(False)
+ elif sys.argv[i] == "sleep":
+ get_sleep = True
+ else:
+ print("Command not understood.")
+ exit()
+ else:
+ get_sleep = False
+ try:
+ s = float(sys.argv[i])
+ except ValueError:
+ print(f"Value {sys.argv[i]} doesn't look like a number!")
+ continue
+ sleep(s)