-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscript.py
45 lines (29 loc) · 914 Bytes
/
script.py
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import xbmcgui
from globs import fifo
from globs import Action
from globs import addon
import utils
from service import Receiver
if __name__ == '__main__':
cli_action = None
if len(sys.argv) > 1:
cli_action = sys.argv[1]
action = None
if cli_action == 'on':
action = Action.ON
elif cli_action == 'off':
action = Action.OFF
elif cli_action == 'toggle':
action = Action.TOGGLE
else:
options = [utils.translate(30016), # Toggle
utils.translate(30017), # Turn on
utils.translate(30018)] # Turn off
res = xbmcgui.Dialog().select(addon.getAddonInfo('name'), options)
if res == 0:
action = Action.TOGGLE
elif res == 1:
action = Action.ON
elif res == 2:
action = Action.OFF
if action is not None: Receiver(fifo).send(action)