From 903f4a61ed0a6955940e56c07f187ce0a0114451 Mon Sep 17 00:00:00 2001 From: Anthony Nash Date: Sun, 14 Jun 2020 20:19:42 +0100 Subject: [PATCH] Add ability to send generic cec-client commands --- script.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/script.py b/script.py index 1764491..4da915d 100644 --- a/script.py +++ b/script.py @@ -2,10 +2,11 @@ import urlparse import sys import time +import os try: params = urlparse.parse_qs('&'.join(sys.argv[1:])) - command = params.get('command',None) + command = params.get('command',None)[0].split(" ") except: command = None @@ -23,3 +24,7 @@ xbmc.executebuiltin("PlayerControl(Stop)") time.sleep(3) xbmc.executebuiltin('CECStandby') + +elif command[0] == 'cec_client': + cec_command = "echo '{}' | cec-client -s".format(" ".join(command[1:]) + os.system(cec_command)