forked from joshjowen/script.json-cec
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.py
More file actions
25 lines (20 loc) · 685 Bytes
/
Copy pathscript.py
File metadata and controls
25 lines (20 loc) · 685 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import xbmc
import urllib.parse
import sys
import time
try:
params = urllib.parse.parse_qs('&'.join(sys.argv[1:]))
command = params.get('command',None)
except:
command = None
if command and command[0] == 'activate':
xbmc.executebuiltin('CECActivateSource')
elif command and command[0] == 'toggle':
xbmc.executebuiltin('CECToggleState')
elif command and command[0] == 'standby':
xbmc.executebuiltin('CECStandby')
elif command and command[0] == 'stop_and_standby':
if xbmc.Player().isPlaying():
xbmc.executebuiltin("PlayerControl(Stop)")
time.sleep(3)
xbmc.executebuiltin('CECStandby')