From 328738278b556d013b110769531e3a45347c52ec Mon Sep 17 00:00:00 2001 From: ZachIR Date: Tue, 10 Jan 2023 10:54:06 -0600 Subject: add projector script --- proj.py | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 proj.py 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) -- cgit v1.2.3