diff options
-rwxr-xr-x | proj.py | 40 |
1 files changed, 40 insertions, 0 deletions
@@ -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) |