diff options
author | ZachIR <zachir@librem.one> | 2023-01-10 10:54:06 -0600 |
---|---|---|
committer | ZachIR <zachir@librem.one> | 2023-01-10 10:54:06 -0600 |
commit | 328738278b556d013b110769531e3a45347c52ec (patch) | |
tree | 81016723097173ebabe1263f351f03ad6c271d49 | |
parent | eb455c5b1adc0b6baf6171fec804c86c4f95a33f (diff) |
add projector script
-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) |